Veda 4B: tool-routing fine-tune of Qwen3-4B
veda is a LoRA fine-tune of Qwen3-4B for the Veda voice assistant. Its job is
narrow: read a spoken request (English or Hindi) plus the assistant's tool list, and answer with a short JSON decision
that says which tool to call and with which arguments, or that no tool is needed.
It is not a general-purpose chat model. It was trained for one prompt format (below) and is meant to run locally with
llama.cpp on a CPU.
Files
| File | Size | What it is |
|---|---|---|
veda-4b-Q4_K_M.gguf | 2.4 GB | Merged model, 4-bit quantised. The one Veda uses. |
veda-4b-Q5_K_M.gguf | 2.7 GB | Merged model, 5-bit quantised. Slightly higher quality, slightly larger. |
adapter-epoch2/ | about 130 MB | The LoRA adapter after epoch 2 (PEFT format). Apply it to Qwen/Qwen3-4B. |
Intended use
- Routing: turn "what's the weather in Kochi" into
{"needs_live_data":true,"calls":[{"tool":"get_weather","args":{"place":"Kochi"}}]}. - Declining or asking for clarification when no tool fits ("cancel my 5 pm meeting", "and in lucknow" with no earlier question).
- Not intended for open-ended chat, code, or any task outside Veda's tool set.
Prompt and output format
The model was trained on ChatML prompts that hold the persona, the tool list, a few examples, the session state, and the
user's message, ending with /no_think. The reply is one line of JSON:
<|im_start|>user
ACTIVE: none
RECENT: none
TODAY: Wednesday 21 Oct 2026, 18:15.
USER: what's the euro rate
/no_think<|im_end|>
<|im_start|>assistant
{"needs_live_data":true,"calls":[{"tool":"convert_currency","args":{"amount":1,"from":"EUR","to":"INR"}}]}<|im_end|>
The full system prompt (about 2,200 to 3,100 tokens) comes from the Veda project. Without it the model will not behave as evaluated.
Running it
llama-cli -m veda-4b-Q4_K_M.gguf -c 4096 --no-conversation -p "<your Veda control prompt>"
or with llama-cpp-python, Llama(model_path="veda-4b-Q4_K_M.gguf", n_ctx=4096).
Training
| Base model | Qwen/Qwen3-4B (bf16) |
| Method | LoRA, rank 16, applied to the attention and MLP layers (about 33M trainable parameters, 0.81%) |
| Loss | On the completion only (the JSON answer), not on the prompt |
| Data | "small-4k": 3,986 training and 399 validation examples (15 of 4,001 were dropped for exceeding the 3,200-token cap) |
| Data mix | Router 84% (English 3,000, Hindi 350), responder 16% (English 500, Hindi 151: chat, advise, narrate, translate) |
| Epochs | 2 |
| Learning rate | 1e-4 |
| Batch | 2 per step with 16 accumulation steps, effective batch 32 (250 optimiser steps in total) |
| Hardware | 1x NVIDIA A100 SXM4 80 GB, about 155 minutes |
| Validation loss | 1.658 (before training), 0.080 (after epoch 1), 0.065 (after epoch 2) |
| Quantisation | Adapter merged into the bf16 base, converted with llama.cpp to GGUF, then Q4_K_M and Q5_K_M |
Evaluation
Measured with the Veda project's own router evals (tests/eval/, scripts/spike_decision_protocol.py) on the Q4_K_M file.
The base model (Qwen3-4B-Q4_K_M) was run on the same cases with the same harness. A case counts as correct only if the
tool(s) and the arguments match what is expected, or the model correctly makes no call or asks for clarification.
| Test set | Cases | Qwen3-4B base | This model |
|---|---|---|---|
| Golden (prompts were tuned against it) | 70 | 57 (81%) | 61 (87%) |
| Held-out (never tuned against) | 46 | 33 (72%) | 42 (91%) |
| Edge (calendar and clock probes) | 27 | 14 (52%) | 26 (96%) |
| Clean (sample of the 346-case set) | 40 | 23 (58%) | 28 (70%) |
| Overall | 183 | 127 (69%) | 157 (86%) |
Error types across the 183 cases:
| Error | Base | This model |
|---|---|---|
| False call (a tool used when none was needed) | 27 | 3 |
| Wrong tool | 8 | 4 |
| Wrong arguments | 12 | 15 |
| Invalid or unparseable output | 0 | 0 |
Median decision time on a laptop CPU was about 7 to 10 seconds for both models.
Caveats
- Each score is from a single run.
- The clean figure is a 40-case sample of 346, so it carries a margin of roughly plus or minus 14 points.
- The golden set was used to tune the surrounding prompts, so held-out and edge carry more weight.
- Training and eval overlap was checked on the final user utterance only: 0 exact matches in golden, 2 in held-out (of 46), 0 in edge. About 10 further cases are near-duplicates (90% or more similar). Follow-up cases that depend on earlier turns were not checked for context.
- Wrong arguments did not improve (12 to 15). The remaining misses are mostly dates and places in weather requests.
Limitations
- Trained for one tool set and one prompt format. Changing the tools or the prompt will lower accuracy.
- Hindi examples are about 13% of the data (501 of 4,001), so Hindi routing is less tested than English.
- The model can still make a wrong call, and Veda should keep its own validation and approval steps for actions that change data (calendar, email, tasks).
- Not evaluated for safety, bias, or general knowledge.
License
The base model, Qwen3-4B, is released under Apache 2.0, and this fine-tune is released under the same licence. The training data is not published with this repository.