--- language: - en - ko library_name: transformers pipeline_tag: text-generation tags: - terminal - sft - vllm - tb2-lite base_model: LiquidAI/LFM2.5-1.2B-Instruct --- # LLM-OS-Models/LFM2.5-1.2B-Terminal-SFT-2Epoch-Unsloth 터미널 작업 자동화를 위한 Terminal SFT 모델입니다. 입력된 작업/이전 터미널 상태를 보고 다음에 실행할 명령을 JSON 형태로 생성하는 용도로 학습했습니다. ## 모델 요약 - Base model: `LiquidAI/LFM2.5-1.2B-Instruct` - Training setup: `2 epochs, Unsloth SFT` - Evaluation snapshot: `2026-05-07 22:44:35 UTC` - Evaluation result id: `lfm25_1p2b_sft_unsloth_e2` ## 사용 방법 Transformers 예시: ```python from transformers import AutoModelForCausalLM, AutoTokenizer import torch model_id = "LLM-OS-Models/LFM2.5-1.2B-Terminal-SFT-2Epoch-Unsloth" tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained( model_id, torch_dtype=torch.bfloat16, device_map="auto", trust_remote_code=True, ) messages = [ {"role": "system", "content": "You are a terminal automation assistant. Return JSON only."}, {"role": "user", "content": "List the current directory and identify Python files."}, ] prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True) inputs = tokenizer(prompt, return_tensors="pt").to(model.device) outputs = model.generate(**inputs, max_new_tokens=512, do_sample=False) print(tokenizer.decode(outputs[0][inputs.input_ids.shape[-1]:], skip_special_tokens=False)) ``` vLLM 예시: ```python from vllm import LLM, SamplingParams from transformers import AutoTokenizer model_id = "LLM-OS-Models/LFM2.5-1.2B-Terminal-SFT-2Epoch-Unsloth" tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True) llm = LLM(model=model_id, dtype="bfloat16", trust_remote_code=True) messages = [{"role": "user", "content": "Show disk usage for the current folder."}] prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True) result = llm.generate([prompt], SamplingParams(temperature=0.0, max_tokens=512)) print(result[0].outputs[0].text) ``` 권장 출력 형식: ```json { "analysis": "brief reasoning about the next terminal action", "plan": "short execution plan", "commands": [ {"keystrokes": "ls -la\n", "duration": 0.1} ], "task_complete": false } ``` ## 평가 결과 평가는 corrected TB2-lite replay set에서 vLLM으로 수행했습니다. 순위 점수는 `100 * avg_command_f1`만 사용하고, `first_cmd_exact_pct`는 보조 지표로만 봅니다. - Rank: `36 / 44` - Score: `22.45` - Command F1: `0.2245` - Command precision: `0.3097` - Command recall: `0.2314` - First command exact: `18.8%` - Valid JSON: `47.2%` - Steps / tasks: `303 / 50` - Template status: `chat_template` - Rank eligible: `True` - Eval timestamp: `2026-05-07T21:50:36.580647` - 현재 집계된 평가 결과 수: `44` 재현 명령 예시: ```bash python tb2_lite/scripts/replay_eval.py \ --model LLM-OS-Models/LFM2.5-1.2B-Terminal-SFT-2Epoch-Unsloth \ --model-short lfm25_1p2b_sft_unsloth_e2 \ --eval-path tb2_lite/data/replay_full.jsonl \ --output-dir /home/work/.data/tb2_lite_eval/corrected_readme_models_vllm \ --dtype bfloat16 \ --max-model-len 49152 \ --max-tokens 1024 \ --temperature 0.0 \ --top-p 1.0 \ --gpu-memory-utilization 0.94 \ --language-model-only ``` Prompt/template audit: ```json { "template_status": "chat_template", "rank_eligible": true, "steps": 303, "tasks": 50 } ``` ## 장점 - 특정 크기/가속 경로에서 비용 대비 빠른 추론을 기대할 수 있습니다. - 잘못된 명령을 많이 내기보다 보수적으로 맞는 명령을 내는 경향이 있습니다. - LFM 계열은 Liquid chat template과 터미널 SFT 포맷을 맞춘 경량/효율 실험에 유리합니다. ## 한계와 주의사항 - recall이 상대적으로 낮아 필요한 명령 일부를 빠뜨릴 수 있습니다. - JSON 형식 실패가 있어 실행 전에 파싱 검증/재시도가 필요합니다. - Qwen 상위권 대비 command F1이 낮게 나온 결과는 지능 차이와 함께 포맷, 토크나이저, 학습 경로 차이가 섞인 값입니다. - 이 모델은 자동 터미널 조작 보조용 SFT 모델이며, 일반 대화/범용 추론 성능을 보장하지 않습니다. - 생성 명령은 실제 실행 전에 sandbox, allowlist, human review 같은 안전장치를 거쳐야 합니다. ## 해석 메모 TB2-lite 점수는 일반 지능 벤치마크가 아니라 터미널 next-action JSON 재현 능력을 측정합니다. 따라서 모델 크기, chat template 일치, assistant-only masking, tokenizer, 학습 데이터 holdout 여부가 모두 점수에 영향을 줍니다. README.md와 MODEL_EVALUATION_REPORT.md의 값이 더 최신이면 해당 값을 우선 확인하세요. 이 모델카드는 완료된 평가 JSON을 기준으로 개별 저장소에 빠르게 반영한 스냅샷입니다.