# Teaching a small model the YANG schema — and benchmarking it

By Avinash Gosavi · 2026-12-05 · https://www.avinashgosavi.com/post/teaching-a-small-model-the-yang-schema-and-benchmarking-it/
Topics: AI, Networking, Open source

> A small model taught the IOS XE YANG schema from data generated out of the schema itself: how the corpus is built, how the model was trained for $0, and how it scored on my own frozen benchmark and on the external NetConfEval benchmark.

---

This is a follow-up to my [prework post](https://www.avinashgosavi.com/post/building-a-purpose-built-small-model-the-prework/), where I laid out the plan for a small, open model for network configuration. This round is about the layer underneath it: teaching a model the *schema* itself — the rules that decide whether a config is even valid.

## The problem

A large language model will happily generate a network config that looks perfect and is wrong. Wrong range, wrong type, a value the device would reject on sight. And until now there was no good test data to prove a generated config really works against the YANG schema — the formal model that describes every setting a device accepts. You can't scrape that data. It has to be made, and every label in it has to be earned.

## How the data is made

So I generate the training data *from* the schema, not from examples found online:

- **Facts come from the schema itself.** A tool called pyang extracts them from the native YANG modules for IOS XE 26.2.1 on the Catalyst 9300 family — every path, type, and range the device actually defines.
- **Five task families.** Path-meaning (what does this schema path mean?), instance-validity (is this config valid?), state reconstruction (rebuild the state from a description), typed edits (change this value, correctly), and range satisfiability (can these constraints all hold at once?).
- **Every verdict is computed, not guessed.** A library called yangson validates each instance against the schema. If yangson can't prove it, it doesn't go in.
- **Held-out data stays held out.** Before each build I reserve fresh test sets, and they are never trained on. The benchmark below is frozen, so scores from months apart are comparable.

The corpus has grown to **112,973 training records** as of today, and it is still growing. Both dashboards are public: the [coverage map](https://aag1091-alt.github.io/netconfig-slm/) and the [build log](https://slm.aag1091.com/).

## The model

The model is a LoRA adapter — rank 32, a small add-on trained while the base model stays frozen — on top of Inkling 2 Mini, an open model from Thinking Machines. I trained it on Tinker's free tier over a snapshot of 105,406 records, one pass through the data, and watched the training loss fall from 4.01 to 0.096. Total cost: **$0**.

It's published, open under Apache 2.0: [aag1091/netconfig-yang-inkling-2-mini](https://huggingface.co/aag1091/netconfig-yang-inkling-2-mini). One clarification, because it matters: what's published is the adapter, not a standalone model. It loads on top of the public base model.

## Results: my own benchmark

Bench v1 is my frozen set of 217 items, graded mechanically — no human judgement in the loop:

| Arm | Score |
| --- | --- |
| Inkling 2 Mini, untuned | 3.2% |
| Early checkpoint (320 records) | 42.4% |
| **Full model (105,406 records)** | **94.9%** |
| Previous model (Qwen3-4B) | 77.4% |

The untuned base deserves a footnote: its 3.2% is a *format* failure, not a knowledge failure. It never stops generating, and never produces the citation format the grader expects — even though, underneath that, its range verdicts were right 28 times out of 28. Teaching it the schema is what the corpus is for.

Per task family, full model vs. the previous Qwen3-4B model:

| Task | Full model | Qwen3-4B |
| --- | --- | --- |
| Path-meaning | 94.1 | 64.7 |
| Instance-validity | 89.0 | 72.6 |
| State reconstruction | 100 | 100 |
| Typed edits | 97.6 | 97.6 |
| Range satisfiability | 100 | 82.1 |

## Results: NetConfEval

My own benchmark can flatter me, so yes — I also ran the model against [NetConfEval](https://aliireza.github.io/files/netconfeval-conext24.pdf), the external benchmark from CoNEXT 2024. Before running anything, I verified there is zero overlap between its items and my training corpus; a benchmark you've trained on proves nothing.

NetConfEval's step 1 turns a plain-language policy into a formal spec. Two parts:

- **Translation**, over the full set of 1,665 items: mean accuracy rose from 0.909 for the untuned base to **0.982** for the fine-tuned model.
- **Conflict detection** — spotting policies that contradict each other — ran on a seeded random subset of 500 of the 1,680 items, and I want to state that plainly rather than let the number imply the full set: mean accuracy rose from 0.450 to **0.938**, and the conflict-flag accuracy was **0.966 with zero false positives**.

## The honest caveats

Schema-valid is not device-accepted. These scores grade schema- and spec-level judgements — does this obey the rules on paper — not what a live switch does when the config lands. That gap is real, and closing it is later work. The frozen benchmark also has a small 8-item held-out slice, and the model went 4 out of 8 on it; small numbers swing wildly, but it's in the record, so here it is. And this is a personal research project, built in public — not a product, and not my employer's work.

## What's next

The corpus keeps growing; coverage of the schema is at 97.5% of paths and the remaining families are being worked through. The longer arc is what I call **plans, not payloads**: instead of the model emitting a finished config, it proposes a small typed change plan, and deterministic code validates that plan before anything touches a device. A model that can be checked is worth more than a model that merely sounds right — that was the bet in the prework post, and the numbers above are the first real evidence for it.

---

Original post: https://www.avinashgosavi.com/post/teaching-a-small-model-the-yang-schema-and-benchmarking-it/
