netconfig-yang-qwen3-4b
A 4B model fine-tuned to reason about the Cisco IOS XE native YANG schema (release 26.2.1, Catalyst 9300 / cat9k module set): what a leaf's type means, whether a configuration instance is schema-valid and why, what a complete interface state looks like, how to express a typed edit — and whether a stricter deployment profile allows a given value.
Current weights: run 2 (2026-11-27) — see Evaluation below. Run 1's results are kept for comparison.
Part of the NetConfig SLM project (built in public; log at https://slm.aag1091.com). Sibling model: netconfig-slm-qwen3-4b, which generates IOS XE CLI configurations.
Training
- Base: Qwen/Qwen3-4B-Base, full fine-tune (2 epochs, effective batch 16, lr 1e-5 cosine, max_len 1536, completion-only loss).
- Run 2 (current): corpus v1 + v2 additions — 1,418 training records. Final train loss 0.213. The v2 additions (+434 records across train/dev) target run 1's three measured gaps: schema type-expression recall, exact rule citations, and clean stopping. The training recipe is identical to run 1; the corpus is the only variable.
- Run 1: corpus v1 — 1,047 training records. Final train loss 0.184.
- Data: five task families (path meaning, instance validity,
state reconstruction, typed edits, revised-schema/profile
judgements). Every fact was extracted with pyang and every
instance verdict produced by yangson 1.7.9 against a scoped
RFC 7895 library — labels and verdicts never come from the
model or from the same tool. Corpus v1 frozen at commit
5189d33, v2 additions at commitf3a9b1dof the project repo (yang-learn/corpus/).
Evaluation — bench v1 (217 items, mechanically graded)
Benchmark profiles and interfaces are disjoint from training. Grading is mechanical only (verbatim type expressions, verdict match, deep JSON equality, exact rule citations). Run 2 was evaluated with a separate batched generation job (batch 16); run 1's generations were produced sequentially inside its training job.
| task family | run 2 | run 1 |
|---|---|---|
| state reconstruction | 40/40 = 100% | 40/40 = 100% |
| typed edits | 41/42 = 97.6% | 38/42 = 90.5% |
| path meaning (verbatim type) | 22/34 = 64.7% | 13/34 = 38.2% |
| instance validity (verdict) | 53/73 = 72.6% | 56/73 = 76.7% |
| revised schema (verdict only) | 23/28 = 82.1% | 26/28 = 92.9% |
| revised schema (verdict + exact citation) | 12/28 = 42.9% | 13/28 = 46.4% |
| overall | 168/217 = 77.4% | 160/217 = 73.7% |
Generations that stop cleanly: 95.4% in run 2 (run 1: 69.1%). On the dev split's original 78 records, run 2 scores 85.9% (run 1: 80.8%).
Known weaknesses, stated plainly: clean stopping and
type-expression recall improved substantially, and typed edits
are near-perfect; but invalid-instance detection still leans
"valid" (13 of 33 invalid bench instances are called valid),
and profile judgements on profiles never seen in training
regressed — the model reaches the right verdict less often and
still usually omits the exact rule citation there. Full
analysis: yang-learn/RUN2_RESULTS.md (and RUN1_RESULTS.md)
in the project repo.
Usage
ChatML prompting, greedy decoding recommended:
<|im_start|>user
{question about the IOS XE 26.2.1 native schema}<|im_end|>
<|im_start|>assistant
A Q4_K_M GGUF for local use with Ollama/llama.cpp is included in this repo.
Caveats
- Schema-valid is not device-accepted. Verdicts describe the YANG schema, not live-device behavior; real IOS XE applies additional checks. Verify against a device or lab before use.
- The platform slice is the cat9k family module set; exact per-SKU (e.g. a specific Catalyst 9300 model) behavior is not separately verified.
- Research artifact from an open, built-in-public project — not a production network tool.