yammi/frago-router-qwen3-1.7b
frago-router-qwen3-1.7b
A narrow-purpose model that routes Chinese natural-language instructions to frago CLI commands. LoRA supervised fine-tune (SFT) of Qwen3-1.7B.
What this model is for (specific purpose)
frago is an agent runtime / automation infrastructure invoked as uv run frago <command> (browser automation, unified timeline, task board, recipes, knowledge base, etc.). A general LLM, asked to "search something" or "show what happened recently", defaults to WebSearch or writing ad-hoc curl/python — not frago. This model internalizes the instinct to reach for frago commands into the weights, so the agent runtime no longer needs to inject routing rules via hooks on every session.
Input: one Chinese user instruction. Output: a ``bash code block containing the matching uv run frago ...` command, with arguments filled in from the instruction.
It covers ~22 frago commands, e.g.:
- web search →
frago chrome navigate "https://www.google.com/search?q=<query>" - recent activity →
frago timeline view --recent 24h - in-progress tasks →
frago task list/frago task active - run/list/inspect recipes →
frago recipe run|list|info - todos →
frago todo list/frago todo add "..." - frago usage docs →
frago book <topic> - knowledge domains / recall →
frago def list/frago run insights --query "..."
Evaluation
The decisive test is without any system prompt — if frago routing only worked when a "use frago" system prompt is present, it would not be internalized. Below are the model's actual greedy-decoding outputs on six held-out instructions.
Without system prompt (the real test):
All six reach for frago (no curl/python fallback), and arguments are filled with real values copied from the instruction rather than placeholders. Behavior with a frago-oriented system prompt is equivalent.
What makes it work (ablation)
An earlier iteration of this dataset got these same prompts wrong, and the two failures pinpoint exactly which design choices matter:
Two fixes turned the failures into the passes above:
- Fill real argument values into the training targets (never leave
<placeholder>tokens). Training on placeholders teaches the model to echo the symbol; training on filled values teaches it to copy the relevant span from the instruction. - Mix the system prompt — about a third of training examples carry a frago-oriented system prompt, a third a neutral one, a third none, all still targeting frago commands. Without this, the model only used frago when the prompt told it to, and collapsed back to curl/python once the prompt was removed. Mixing makes "use frago" unconditional.
Out of scope / not for
- Not a general chat or code-generation model — only frago command routing.
- Single-step instructions only. Dependency chains that require "run A, observe its output, then run B" are not covered; that needs multi-turn training.
- Depends on the frago CLI — meaningless outside a frago environment.
- The frago CLI evolves; commands may drift (e.g. the old
threadgroup was removed and folded intotimeline/task). This model reflects the command surface at one point in time. - Verify generated commands exist and have valid arguments before production use.
Usage
transformers:
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
m = "yammi/frago-router-qwen3-1.7b"
tok = AutoTokenizer.from_pretrained(m)
model = AutoModelForCausalLM.from_pretrained(m, torch_dtype=torch.float16, device_map="auto")
msgs = [{"role": "user", "content": "帮我搜一下 Qwen3 的发布说明"}]
inp = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt",
return_dict=True, enable_thinking=False).to(model.device)
out = model.generate(**inp, max_new_tokens=128, do_sample=False)
print(tok.decode(out[0][inp["input_ids"].shape[1]:], skip_special_tokens=True))
# -> ```bash\nuv run frago chrome navigate "https://www.google.com/search?q=Qwen3发布说明"\n```A companion Q8_0 GGUF (~1.8GB) is included for llama.cpp / Ollama:
ollama create frago-router -f Modelfile # Modelfile: FROM ./frago-qwen3-1.7b-v4-q8_0.gguf
ollama run frago-router "我的待办还有哪些"Training
- Base:
Qwen/Qwen3-1.7B - Method: LoRA (r=16, alpha=32, dropout=0.05, on all attention + MLP linear layers) + SFT
- Data: ~792 examples (722 train / 70 eval). The instruction side was generated by DeepSeek in diverse Chinese phrasings; the command side is locked to real, currently-existing frago commands with real argument values filled in (no placeholders, no invented commands). Real instruction→command pairs mined from frago session archives were mixed in.
- Key design: training examples are split roughly 1/3 each into frago-hint system prompt / neutral system prompt / no system prompt, all targeting frago commands — so "use frago" becomes an unconditional habit independent of any prompt.
- Hyperparameters: 3 epochs, effective batch 16, lr 2e-4, max_length 1024, fp16 (trained on a T4).
Known limitations
- Small dataset (~800 examples); limited command and argument diversity, so edge-case instructions may pick the wrong subcommand.
- Some argument flags can be imprecise (e.g. it may emit
run insights --addinstead of--save --payload). - Chinese instructions only.
License
Qwen3-1.7B is Apache-2.0; this derivative is released under Apache-2.0.
