back to home

Fine-Tuning Small Models to Take Notes: Hard Errors 28% → 11%

#post-training#lora#distillation#evals#qwen#fp8#vllm

Here's the line of models, in order. Like last time, the failures did most of the teaching.

# Model Base Train rows Result What happened
0 Gen-0 LFM2.5-230M -- recall 0.938 at −85% tokens (not held-out) First model. Key points with verbatim quotes, on CPU
1 v1 Qwen3.5-2B 1,047 0% valid Targets kept the teacher's long quotes
2 v2 Qwen3.5-2B 1,047 synopsis on 10.7% I masked a required field on 41% of rows
3 First release (2B) Qwen3.5-2B 618 valid 99.0% First good model
4 Bigger-store 2B Qwen3.5-2B 1,913 false statements 42.5% vs 22.5% More data, worse targets
5 Size test 2B vs 4B 1,913 31.1% / 20.2% hard errors vs first release 9.2% The rows were the problem, not the size
6 Bake-off 4B, 2B, 3 LFMs 1,695 4B: 7.6% hard errors Blind 7-arm read (5 new + 2 reference arms), rule fixed before unsealing
7 4B synopsis model Qwen3.5-4B 1,690 28.0% → 10.9% hard errors One prompt line fixed "This section…"
8 LFM3 LFM3-1.7B 1,690 +8 pts hard errors Smaller, rejected
9 Notes model 1 Qwen3.5-4B 2,351 injection 2/20 FAIL First note-taking model
10 Notes model 2 Qwen3.5-4B 2,725 planted fakes stated 21/64 No conflicting-value rows in the data
11 Notes model 3′ Qwen3.5-4B 2,667 lowest loss of its family, worst outputs Dev loss said nothing about generation
12 Notes model 4 Qwen3.5-4B 2,737 fakes 15/64, judge FAIL Kept for synopses and tags; notes judged not ready
13 Final notes model Qwen3.5-4B 2,942 fakes 7/64 → 0/64 with code guards Final model: notes judged ready
14 Final notes model, FP8 -- data-free blind read +1.7 pts [0, 5] Inside pre-set gates, 2 exceptions ruled after

In three lines: LoRA fine-tunes of Qwen3.5-4B on synthetic, teacher-labelled data cut documents with a hard factual error from 28% to 11% on a blind read. A pre-registered eval showed whole-document reading adds 30 points of late-fact recall (p = 1.5e-11). Notes from the final model lifted downstream question-answering from 56% to 93% correct.

The November line, about 20 fine-tune runs on Qwen3.5 and LFM bases, cost $117 in metered GPU and API spend, data generation and eval serving included. Most runs cost $1–4 on a single H100.


What the Model Does

The model reads a document once and stores three things:

  • a synopsis that says what the document is and what's in it,
  • 3–5 content tags, never containing a person's or customer's name,
  • and later, notes: per-window items typed as fact, decision, action, change or open question, each pointing back to the source lines it came from.

It is meant to run on every document, so it has to be small. It must not invent facts, and it must not follow instructions hidden inside the documents it reads. Correctness came first. In the words I wrote down early in the project: latency doesn't matter much here, the thing that matters most is the correctness of what it writes.


Gen-0: A 230M Model in June

The first version was a LoRA fine-tune of LiquidAI LFM2.5-230M, merged and exported to a 247 MB GGUF at Q8 so it could run on CPU with llama.cpp at about 15 tokens per second per slot. Its job was narrower: turn a document window into at most 8 key points, each with a verbatim quote and character offsets, where quote == doc_text[start:end] had to hold exactly.

On my eval it did what I designed it for. As an augment to normal chunk retrieval, it matched full-chunk recall (0.938) with about 85% fewer context tokens, and every point drilled back to its source (1.000). That eval's documents overlapped the training and validation data, so these numbers are not held-out. I flagged one risk at the time: replace-only loses recall, hence augment, not replace.

Used later as a replacement rather than an augment, it lost to raw chunks on retrieval, which is the warning I had written down. Two things from it carried forward. An augment is not a replacement, and that has to be measured, not assumed. And in GPU tests about 72% of its outputs were valid JSON, because the model retyped sentences instead of pointing at them. That became the core idea of the next generation: return sentence indexes, not text.


When My Graders Said 0.91 and I Checked

The Qwen line started in November. The first good model, a 2B I'll call the first release, came out of a pipeline I'll describe below, and its numbers looked great: 99.0% valid outputs, synopsis faithfulness 93.0%, points recall 0.907 against an untuned base at 0.103.

Then I counted planted facts on the same eval: the first release captured only 25.6% of the facts I'd planted in the test documents, while my graders reported 0.91 recall.

Digging into why taught me more than any training run. My v1 graders could not tell a good output from a useless one. A fixed junk synopsis (the same text for every document) passed the validity check, the value check and the tag check 100% of the time. And "points recall" was measuring agreement with my own teacher, not truth. The numbers moved while quality didn't.

So I threw the graders out as a decision tool and switched to blind reads:

  • each output gets an opaque per-document letter, and the key mapping letters to models is sealed (its hash recorded) before any reader starts,
  • 2–4 independent LLM reader agents per document, each scoring hard errors (wrong fact, changed value, invented value, wrong attribution, obeyed an injected instruction), any false statement, and "does it say what the document is",
  • every sheet carries planted controls (3 wrong-document and 3 changed-value outputs) that readers must catch, or the sheet doesn't count,
  • results come with paired bootstrap confidence intervals,
  • and after the first eight reads, four fresh agents recomputed every number from the raw sheets, freezing their numbers before opening my reports. All the arithmetic reproduced.

Why it matters: Every decision after this point was made on blind reads, not on graders that agreed with themselves.


Data: Code Plans the Facts, Models Write the Prose

The pipeline that produced every training row:

  1. A seeded planner in code decides every fact in a synthetic document: numbers, dates, names, decisions, and where each fact sits in the document.
  2. A writer model turns the plan into realistic prose. First a large hosted model; later a small open-weights model on Modal, with facts placed by decile (early, middle, two late ones per long document) and positions re-verified after writing.
  3. A teacher model (a large open-weights LLM, temperature 0, strict JSON schema) labels each window: synopsis, tags, points, and later notes.
  4. Deterministic gates drop, never repair: trivia, extractive synopses, wrong shape, unsupported values, duplicates, genre contradictions. A row that fails is gone, not patched.
  5. Prep-time guards: an export guard, an 8-gram exclusion against every eval set, a hash-partitioned name lexicon (30% of names and companies exist only in evals), and a sequence-length check with the real tokenizer.

Because the plan is code, every training document comes with its own answer key. That property later became the eval.

The first three runs were all data bugs:

0% valid (v1). The targets kept the teacher's per-point quote and text fields. The 2B student learned to echo long verbatim strings, overflowed, and produced zero valid outputs. The run also timed out because I generated samples inside the training function. Fixes: strip points to sentence indexes only, a target guard with 11 tests, and never generate inside the train function.

Masking teaches omission (v2). About 27% of the teacher's synopses had been cut mid-sentence, because the teacher's JSON grammar capped the field at 200 characters. My gate correctly rejected those, and I masked the synopsis on 41% of rows instead of dropping them. The student learned that synopses are optional: it wrote one on 10.7% of dev outputs. The teacher's grammar cap had shaped the student's failure.

First release (2B). Drop the 429 rows with weak synopses instead of masking them. 618 rows, 78 steps, $1.09. Test set of 199 documents: 99.0% valid, 0 canary leaks.


Picking the Base Model: A Blind 7-Arm Bake-Off

A bigger store of data (1,913 rows) made the next 2B model worse: false statements in 42.5% of documents vs the first release's 22.5%. A size test on the same rows (2B vs 4B) gave 31.1% and 20.2% hard errors, both worse than the first release's 9.2% on that read. Not a size problem. The rows were teaching worse synopses.

After relabelling every row with final-state prompts, I trained five bases on the same 1,695 rows and read them blind across 120 documents, next to two reference arms trained on other data (the first release and the bigger-store 2B): seven arms in all, with the rule fixed before unsealing: the 4B beats the 2B only if the paired CI is above zero, and any LFM must win on correctness to be chosen. Ties go to the smaller model.

Blind 7-arm bake-off: documents with a hard error, Qwen3.5-4B 7.6% lowestBlind 7-arm bake-off: documents with a hard error, Qwen3.5-4B 7.6% lowest

Qwen3.5-4B: 7.6% [4.0, 13.8]. The 2B: 17.6%, worse by +10.2 [1.7, 18.6]. The LFMs: 26.1%, 41.7% and 45.0%. The reference arms: 11.7% (first release) and 30.8% (bigger-store 2B). Controls caught 6/6. The 4B won on the rule.

I tested LFM3-1.7B twice afterwards, because a smaller model would be cheaper to serve. With my recipe it made 7.6–8.5 more points of hard errors. With Liquid's own notebook settings it was level on hard errors (−0.8 [−6.8, 5.1]) but 13.6 points worse at saying what the document is. Rejected both times.


One Prompt Line: "This Section…"

The 4B had one strange habit: single documents came back with synopses starting "This section…".

82% of the map-stage targets (the per-window summaries of long documents) opened with "This section" or "The section". And the model couldn't tell a window of a long document from a whole short document, because the input header always said window: 1/1. So it copied the map habit into 43 of 120 single-document outputs.

The fix was one line in the teacher's map prompt: don't use "section", "excerpt", "passage", "part" or "window" in the first six words. Relabel, retrain.

That became the 4B synopsis model. On a fresh blind read of 120 documents: hard-error documents 10.9% (13/119) vs 28.0% (33/118) for the first release, a difference of −17.1 points [−26.5, −7.7]. It held with any single reader removed, and the independent recomputation reproduced it. Training cost: $2.07.

Each blind read used a fresh document set and reader setup, so rates compare only within a read: the first release scored 9.2% on the size-test read, 11.7% in the bake-off and 28.0% on this harder fresh set.


Measuring Whole-Document Reading: A Pre-Registered Eval

Long documents were the open question. Reading only the first part misses everything late in the document. Reading the whole thing (map each window, then reduce) costs more and might water down the synopsis. I needed an eval that could actually tell those apart, and I'd lost trust in the old ones.

What I'd learned about my evals by then, written down at the time: stand-in metrics moved while quality didn't; the teacher was being used as gold; the same writer made training and eval data; test sets were reused until burned; a scorer bug surfaced after a verdict; one grader had κ = 0.35; and about 120 documents per arm can only detect effects around 30 points.

So I built a new eval around the planner:

  • The plan is the answer key. Every planted fact, its position, every superseded value, every fake and every decoy is known in code.
  • Writers from other model families than the student (Qwen) and the judge, so nobody shares a style: two small open-weights models, picked by a writer probe. They wrote 14/20 and 5/20 clean documents; a third candidate managed 1/20.
  • Every code check is mutation-tested. Break the check on purpose; it must fail.
  • Contamination bound: 8-gram share under 5% against all 14,147 training rows (measured maximum about 1%).
  • Pre-registration frozen by hash before any arm was scored, with bars set in advance: at least +5 points on late-fact recall, non-inferior within 2 points elsewhere, guardrails no worse by more than 2.
  • Bounding arms so a metric can't reward nonsense: an oracle (603/603), empty output, copy-first-300, copy-last-300, wrong-document.
  • An A/A arm, because I'd found that temperature 0 isn't deterministic: 4 of 15 identical prompts gave different outputs under server batching.
  • Statistics: paired document bootstrap (2,000 resamples) plus an exact sign test.

Result on the pre-registered hard set (174 documents), same 4B model in both arms. Late-fact recall is measured on its 80 multi-window documents (162 late facts):

Late-fact recall Docs with a false statement
First part only 1.2% (2/162) 6.9%
Whole document 31.5% (51/162) 4.6%
Difference +30.2 pts [22.4, 37.6], 37 documents up, 0 down, p = 1.5e-11 −2.3 [−5.7, 0.6], guardrail passed

On the broad set it was non-inferior (+1.7 [−0.7, 4.0]), and the judge made 0 key errors on 977 keys. The honest cost: early-fact recall dropped 19 points, because a fixed-length synopsis that now covers the late part of a document has less room for the early part. The audit of the judge agreed 94.67% against a 95% bar, so it missed by one item. I report that rather than round it.

I adopted whole-document reading.


Teaching It to Take Notes

Synopses and tags say what a document is. I wanted the model to do what a person does while reading: take notes. Facts, decisions, actions, changes and open questions, each tied to its source lines.

The hard part of notes is conflicting values. Documents change their mind: a deadline moves, a price is revised, a draft gets superseded. A good note says "the deadline moved from X to Y". A bad one states the old value as current, or states a fake value that some text in the document only mentions. I planted 64 such fakes in a 171-document test set and counted how many the model stated as fact.

Notes model 1. Failed two bars: 93.3% non-empty notes (bar 95%), and it followed 2 of 20 planted injection instructions.

Notes model 2. Stated 21 of 64 planted fakes. The training data had almost no rows where a value conflicts with another value in the same document. You can't learn what you've never seen.

Notes models 3 and 3′: the dev loss lied. Notes model 3′ had the lowest loss of its family (notes models 3, 3′, 4 and the final one): final training loss 0.1856, dev loss 0.1936. Notes model 2 had ended lower, at 0.1795 train and 0.1863 dev. Yet notes model 3′'s reduce-stage synopses collapsed to a median of 222 characters against a 330 bar. The most likely cause, which the code supports but I never proved with an ablation: 1,128 short map targets and about 500 long single and reduce targets shared one input frame with no marker saying which kind of row it was, so the model averaged toward the short mode. The loss was probably low because short outputs are easy to predict. I wrote it down as a rule: a dev loss says nothing about generation; every model needs its own generation test.

Notes model 4, and keeping it over a failed gate. With 132 conflict-aware rows added, planted fakes dropped to 15/64. On the blind judge it failed one bar: documents with a hard error from either reader were 6.8 points worse [0.9, 12.8] than the 4B synopsis model.

I kept it anyway for synopses and tags, judged its notes not ready, and wrote down why. A per-claim analysis showed notes model 4 wrote 8.1 claims per document against 5.0 before, with 2.60 vs 2.29 hard errors per 100 claims. Close per claim; worse per document mainly because it says more. The per-document bar was length-sensitive, and that's a flaw in the bar as much as in the model.

The final notes model. 2,942 rows: the notes-model-4 data plus shortened synopses and 205 rows from a teacher round aimed at five specific conflict shapes (205/240 kept; cross-window fakes stated 0/220). Planted fakes: 7/64. It still failed one gate: on a notes read, 6 of 100 windows were flagged by both readers, against a bar of 2.

And the honest trade-off: on a later blind read, the final notes model had 8.5 points more documents with a hard error than the 4B synopsis model [2.5, 15.3], because it writes longer, richer output. I chose it anyway, for the reason in the next section.


Do Notes Actually Help?

The point of notes is that something downstream reads them. So I measured that directly: 120 questions over synthetic documents, answered by an LLM that sees only the stored synopsis, tags and notes, graded by a separate judge.

Correct Wrong
Synopsis and tags only 55.8% 6.7%
With the final model's notes 93.3% 0.8%

+37.5 points [29.1, 45.9]. That's why the final model is the one that writes more, even though more text means more chances to be wrong per document. The cost: on a fresh set, answers that gave a superseded value as current rose from 2.5% to 7.5%. Answerer and judge were LLMs, on synthetic documents.


Two Days of Code Beat Three Rounds of Data

Here's the arc of the planted-fakes number:

Planted fake values stated as fact, out of 64: 21, 15, 7, then 0 with code guardsPlanted fake values stated as fact, out of 64: 21, 15, 7, then 0 with code guards

Three paid data rounds (about $4–5 per trained model, plus the teacher rounds) took it from 21 to 7. And the conflict-row generator had hit a ceiling: it could only produce about 20 same-window conflict rows, nowhere near enough for another round.

Two code guards, about a day each, took it to 0/64:

  1. A note guard that strips directive and provenance-style lines from the model's input, and drops any note item that states one value for a field while the document states another, unless the item is recorded as an open conflict with both values. On the test set (in-sample: I widened the detector on that same set): 64/64 planted lines stripped, 0 fakes stated after both layers.
  2. An actor and modality gate that checks each note item names the right actor and doesn't turn "might" into "will". I built it to close the 8 hard errors the notes read had flagged, so its 8/8 on those is in-sample. It dropped 1.95% of the items that name a person or role for actor and about 0.3% of items for modality on the synthetic test set, both inside the bars I'd set.

A later review on realistic prose found the first guard dropping 7 of 24 realistic items as same-field conflicts, and I narrowed it before relying on it. Past a data generator's capacity ceiling, code that runs on every output is cheaper and more reliable than more data.


Serving a Hybrid Linear-Attention Model

Qwen3.5-4B is not a plain transformer: 32 layers, of which 24 are Gated-DeltaNet (linear attention) and 8 are full attention. That shaped everything about running it.

Batched generation corrupts it. HuggingFace batched generation with left padding feeds pad tokens into the DeltaNet's recurrent state. Outputs silently degrade. Generate per row or use vLLM.

A LoRA merge isn't servable as-is. The model ships as a multimodal composite with a small vision tower. Merging the LoRA produces a text-only config that vLLM rejects, so I overlay the 320 fine-tuned tensors onto the stock 632-key composite.

FP8. llm-compressor's FP8_DYNAMIC scheme, data-free, on the linear layers only: the 24 DeltaNet projections, embeddings, head and vision tower stay in bf16. That gives 128 FP8 linear layers and about 6.5 GB. Every gate was fixed before the first FP8 output existed: per-kind log-prob delta at most 2% (measured maximum 1.24%), 0 of 1,581 calls hitting the length limit, 0/64 planted fakes through the guards, and a 60-document blind read: +1.7 points [0.0, 5.0] against a bar of +5, reader agreement κ 0.966, test-retest 1.000. Inside the gates, with two exceptions I ruled on after seeing the results: the length check was judged paired against bf16, and one floor check that failed at 8.3% was accepted. Not "no loss", and I don't say it was.

A decode-cost model that overruled me. I had asked for an L4 GPU with FP8. Before renting one I modelled decode step time from first principles: a fixed overhead plus bytes read per step divided by memory bandwidth, where the bytes include the weights, the KV cache on the 8 attention layers (32 KiB per token) and the 49 MiB DeltaNet recurrent state per sequence, read and written every step. Halving the weights with FP8 does not halve decode time when the recurrent state is that large. Calibrated on the A10 I already had (26.8 ms predicted, 26.4 ms measured), it said an L4 would take 37–101 seconds for a 1,280-token notes call depending on load, failing a 45-second bar with no setting to fix it. For a Blackwell card it predicted 20 s alone and 25 s at 12 sequences; a probe measured 14.5 s and 20.9 s. On the new card the model over-predicted by 16–28%: good enough to rule an option out, not to plan capacity.

Foreground is the bar. The model ended up sharing one GPU with the embedding and reranking models. The first load test failed: under note-taking load, foreground retrieval latency rose to 5.5× idle. The rule I set was that background work may be slow but foreground retrieval must not be. Capping the note-taking model's concurrent slots from 12 to 4 brought foreground latency back to 0.84–1.04× idle.

Silent weight corruption. Two downloads of the 9.3 GB weights arrived at exactly the right size with two different wrong checksums. Weights now go straight from the training environment to the model hub and are fetched by commit and verified by hash.


What I'd Do Differently

  1. Test the grader before trusting it. A fixed junk output passing 100% of my checks was the most useful failure of the project. Put a junk control and an oracle in every eval from day one.
  2. Pick models by blind reads, not dev loss. The lowest-loss model of its family had the worst outputs.
  3. Drop bad rows, never mask them. Masking a required field on 41% of rows taught the model the field was optional.
  4. Check what the teacher's constraints do to the student. A 200-character grammar cap on the teacher became a truncation habit in the student.
  5. Mark row types. If map, reduce and single-document rows share one frame, the model averages them.
  6. Pre-register, with bounding arms and an A/A arm. And report the misses honestly: early recall −19, an audit at 94.67% against 95%.
  7. Measure per claim, not just per document, when models write different amounts.
  8. Know when code beats data. Past a generator's ceiling, a guard that runs on every output beat another paid data round.
  9. Model the hardware before renting it, especially for hybrid architectures where the recurrent state, not the weights, dominates decode.

The headline number is 28% → 11% hard errors on a blind read. The thing I'd keep from this project is the process behind it: graders that are tested, data with its own answer key, bars set before results, and the discipline to report the times a model passed with a caveat.