Training
- Base:
unsloth/Qwen3-4B-Instruct-2507, QLoRA (4-bit NF4 base, fp16) with Unsloth
- LoRA: r=16, alpha=16, dropout 0, all attention and MLP projections; 200 steps, effective batch 8, lr 0.0002, max length 2048, 25.4 min on Tesla T4
- Data:
NousResearch/hermes-function-calling-v1, only examples whose reference answer consists of strictly valid JSON tool calls: func_calling_singleturn (the Information Extraction part has malformed JSON and is excluded) plus first turns of glaive_func_calling, deduplicated by query. Train 1800, held-out test 100 ({'func_calling_singleturn': 57, 'glaive_func_calling': 43}).
- Format: native Qwen3 tool calling (tools passed via the chat template,
<tool_call>{"name": ..., "arguments": ...}</tool_call>), loss on assistant tokens only.
Evaluation (100 held-out examples, never seen in training or imatrix calibration)
All models run in the same engine (llama.cpp v1.0.0 llama-server) on identical prompt tokens with greedy decoding. "Fully correct" = same function names and arguments as the reference (order-insensitive); 95% Wilson CI in brackets.
Table with columns: model, has <tool_call>, %, valid JSON, %, correct functions, %, fully correct call, %| model | has <tool_call>, % | valid JSON, % | correct functions, % | fully correct call, % |
|---|
| Base F16 | 100 | 99 | 89 | 73 (64–81) |
| FT F16 | 100 | 100 | 92 | 81 (72–87) |
| FT Q4_K_M-imat | 100 | 99 | 92 | 78 (69–85) |
| FT Q8_0 | 100 | 100 | 92 | 81 (72–87) |
| FT Q4_K_M | 100 | 100 | 92 | 81 (72–87) |
Perplexity and KL divergence vs the fine-tuned F16 model (llama-perplexity --kl-divergence, ctx 512, 100 chunks of the held-out text):
Table with columns: quant, size, GB, bpw, PPL, Mean KLD vs F16, 99% KLD, same top-p, %| quant | size, GB | bpw | PPL | Mean KLD vs F16 | 99% KLD | same top-p, % |
|---|
| F16 | 8.05 | 16.01 | 2.6767 | — | — | — |
| Q8_0 | 4.28 | 8.51 | 2.6775 | 0.00104 ± 0.00002 | 0.0088 | 98.79 |
| Q4_K_M | 2.50 | 4.97 | 2.6989 | 0.01778 ± 0.00101 | 0.1380 | 95.82 |
| Q4_K_M-imat | 2.50 | 4.97 | 2.6830 | 0.01109 ± 0.00047 | 0.1004 | 96.30 |