Qwen3.8-9B Hermes Function Calling v1
A QLoRA fine-tune of Empero/Qwen3.8-9B (Qwen3.5 hybrid-architecture distill,
9B dense, 262,144-token context) that specializes the model in Hermes-style
tool-call envelopes: given a <tools> XML schema in the system prompt, it
emits <tool_call><function=NAME><parameter=KEY>VALUE</parameter></function></tool_call>.
- Base model: Empero/Qwen3.8-9B (Apache-2.0)
- Training data: 1,090 tool-call conversations rendered in ShareGPT format,
all with
<tools>XML schemas in the system prompt (synthetic/curated tool-use examples across ~2,000 tool names and dozens of domains) - Method: QLoRA 4-bit, rank 16 / alpha 16, dropout 0, targets q/k/v/o/gate/up/down_proj, lr 2e-4, max seq 4096, batch 2 x grad-accum 4 (effective 8), 2 epochs = 274 steps, cosine schedule
- Trainable params: 29,097,984 / 8,980,926,976 (0.32%)
- Embeddings: frozen (tool tokens are EOS-anchored copies, not trained)
- Vocabulary: resized 248044 → 248079 (2 added tool tokens + base additions)
- Weights: BF16 full merge (12 shards), plus a ROCmFPX quantized GGUF (see the GGUF companion repo)
What this model does
The fine-tune teaches the format: when the system prompt carries function
signatures inside <tools> </tools> XML tags (the training preamble), the model
reliably produces the exact Hermes envelope with correct function names and
parameters, with no prose around it.
Format-fidelity probe (45 fresh training-distribution rows, temp 0, identical prompts for both models):
| metric | fine-tune | base |
|---|---|---|
| fired | 43/45 (95.6%) | 39/45 (86.7%) |
| name match | 43/45 (95.6%) | 39/45 (86.7%) |
| args OK | 43/45 (95.6%) | 39/45 (86.7%) |
| format exact | 43/45 (95.6%) | 39/45 (86.7%) |
| emission kind | 43 <tool_call> envelopes | 39 native JSON |
The base model answers the same prompts in native Qwen JSON; the fine-tune emits the trained Hermes envelope.
Honest limitations
- No trigger generalization. Evaluated on 45 held-out real agent
trajectories (ambiguous queries, real tool names like
terminal,search_files,patch— none of which appear in training), both the fine-tune and the base score 0/45. A 0.32% LoRA on 1,090 examples does not teach when to decide to call a tool, especially for unseen tool names and ambiguous user intent. - Parity, not gains, in OpenAI-style tool-calling paths. Through an
OpenAI-compatible
toolsparameter (the path most serving stacks use), fine-tune and base perform identically — both fire valid calls at ~55–58 tok/s on this rig; the fine-tune shows no regression and no measurable gain there, because the chat template already formats tool calls server-side and the base was already competent. - The trained envelope only pays off in raw-text tool-call paths: prompts
that embed the schema as
<tools>XML and parse<tool_call>envelopes from the output (e.g. Hermes's mined-trajectory format, custom parsers).
Reproducibility
All scripts that produced this model are in scripts/:
| file | purpose |
|---|---|
qwen38_train.py | QLoRA training via Unsloth (274 steps, ~19.4 h on an RX 7700 XT 12 GB) |
convert_hf_hermes.py | ShareGPT training-example converter (the 1,090 rows) |
merge_qwen38.py | shard-streamed BF16 merge (vision tower dropped; embedding/lm_head resized with EOS-anchor rows; MTP head preserved) |
eval_fc_heldout.py | Tier-1a eval: held-out real-trajectory trigger test (the 0/45 result) |
probe2_fc.py | Tier-1b probe: format-fidelity on training-distribution prompts (the 43/45 result) |
subagent-qwen38-workloads.py + subagent-qwen38.sh | Tier-2 harness: Hermes system prompt + real tool schemas, workloads A–E |
The scripts carry the author's machine paths (F:/models/..., C:/AI/...) and
run on this rig's ROCm stack (Unsloth 2026.8.18, torch 2.11 ROCm, RX 7700 XT);
adjust paths for your environment.
Convert/quantize: llama-rocmfpx fork, convert_hf_to_gguf.py --outtype bf16
→ llama-quantize Q4_0_ROCMFP4_FAST (see GGUF repo).
Quantized version
Q4_0_ROCMFP4_FAST GGUF (ROCmFPX format, for AMD RDNA3 kernels) is published
in the companion repo. Note: ROCmFPX quants target AMD ROCm inference
(ROCMFP4 kernels); for portable use, convert from the BF16 merge here.
Acknowledgements
Base model and license inherited from Empero/Qwen3.8-9B (Apache-2.0). Training
data derived from Hermes agent trajectories; tool schemas rendered in the
Hermes <tools> XML format.