# Route-training data plan (LLM-as-router) Goal: training data that teaches the CPT'd Qwen3-1.7B to emit the **route contract** — `[{"intent":, key?, value?, text?, verb?}, ...]`, GBNF-constrained — matching `internal/router/llmrouter.go` (`routeSystem` + `routeGrammar`) verbatim. Train=deploy parity: label with the EXACT prompt the daemon sends. 7 intents: `fact, reminder, note, query, act, chat, system`. Hard cases (grammar can't enforce): note vs reminder («запомни» vs «напомни»), fact vs note (trackable state vs static memo). ## Steps 1. **Source utterances** — real RU turns, not synthetic. Main: `function_calling.jsonl` (473); plus `user-*.jsonl` fragments for chat/fact/system coverage. `gen_route_data.py` dedups across all. 2. **Relabel, don't convert** — old taxonomy (time/weather/timer) ≠ 7 intents. Feed each utterance through `routeSystem` to a strong router model → take its `{intent,...}`. 3. **Validate** — intent ∈ enum, keys ⊆ {intent,key,value,text,verb}. Drop invalid. 4. **Balance check** — after a run, count intents. `act`/`system`/`fact` likely thin (function_calling skews query/act). Author extra examples for the holes; re-run. 5. **Better prompt first** — improve `routeSystem` for 1.7B disambiguation before a big generation run (awaiting prompt-guy input). Re-labeling is cheap; regenerate. 6. **Train** — locked decision: fold route and persona examples into one balanced Qwen3 SFT. The system prompt selects the contract. Evaluate the two tasks separately; a separate route adapter is the fallback if joint SFT interferes. ## Blocking - Router at `inference.kvmx.ru` / `localhost:6446` must be up (currently down). - CPT must finish and pass the raw-vs-CPT decision gate before joint SFT. ## Files - `esp32-whisper-fine-tune/llm/gen_route_data.py` — the relabeler (done, self-checks). `ROUTE_SYSTEM` const = verbatim copy of Go `routeSystem`; **keep in sync**. - Output: `llm/data/route_train.jsonl` (resumable append). - Held-out: `llm/data/route_eval.jsonl`, generated from human labels by `build_route_eval.py`; never include it in route training generation. ## Prompt-guy question (sent 2026-07-11) How to structure the router system prompt for a 1.7B model doing 7-intent classification + slot extraction, GBNF-constrained — example ordering/count, contrastive near-miss pairs (note vs reminder) vs more singles, rule placement.