CoolFace
Modelpublic

yammi/frago-router-qwen3-1.7b

sourceHugging Faceapache-2.0updated 3mo agoView on Hugging Face
0likes31downloads
Model Card

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):

Instruction (zh)OutputVerdict
查一下今天 BTC 的价格 (check BTC price)uv run frago chrome navigate "https://www.google.com/search?q=BTC价格"✅ correct + real value filled
看看最近 24 小时发生了什么 (what happened in 24h)uv run frago timeline view --recent 24h✅
帮我搜一下 Qwen3 的发布说明 (search Qwen3 release notes)uv run frago chrome navigate "https://www.google.com/search?q=Qwen3发布说明"✅ value filled
现在有哪些任务在进行 (what tasks are running)uv run frago task list✅
把这条经验记到知识库:T4 不支持 bf16 (save this lesson)uv run frago run insights --add "T4 不支持 bf16"⚠️ right command + content, imprecise flag (--add vs --save --payload)
我的待办还有哪些 (my todos)uv run frago todo list✅

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:

InstructionEarlier iteration (no fixes)This model
帮我搜一下 Qwen3 的发布说明chrome navigate "...q=<关键词>" (literal placeholder, never filled)chrome navigate "...q=Qwen3发布说明" (real value)
现在有哪些任务在进行 (no system prompt)chrome navigate "<网址>" — wrong command, literal placeholdertask list
查一下今天 BTC 的价格 (no system prompt)python3 .../eth-price-checker.py — abandons frago entirelychrome navigate "...q=BTC价格"

Two fixes turned the failures into the passes above:

  1. 1.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.
  2. 2.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 thread group was removed and folded into timeline/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:

python
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 --add instead of --save --payload).
  • —Chinese instructions only.

License

Qwen3-1.7B is Apache-2.0; this derivative is released under Apache-2.0.