Post-Training an Agentic LLM: 18% → 42% on Unseen Tasks, and Why the Ruler Kept Being the Bug
Here's every model that mattered, in order. Most of the interesting rows are the ones that didn't work.
| # | Model | Method | Data | Result | What happened |
|---|---|---|---|---|---|
| 1 | Qwen3-32B (stock) | -- | -- | 18.3% held-out (n = 71) | Baseline. Every pass was a correct abstention |
| 2 | 32B iter-1 | QLoRA SFT | 41 trajectories | 20% = base (eval split, n = 20) | Perfect null. Trained under the wrong system prompt |
| 3 | 32B run4 | QLoRA SFT | 150 | 35.2% held-out, p = 0.0075 | First real lift. Unseen task families 3.1% → 21.9% |
| 4 | 32B run5 | QLoRA SFT | 294 | 42.3% held-out, p = 0.00002 | Best result. 17 tasks gained, 0 lost |
| 5 | 32B run6 | QLoRA SFT | 404, lower LR | 30/65 vs run5 36/65 (65 re-scorable held-out tasks) | Worse. More data and lower LR at once, not adopted |
| 6 | 32B DPO-1 | DPO | 381 pairs | routing +0 | Preference margins grew 11×, behaviour didn't move |
| 7 | 8B sft2 | QLoRA SFT | 615 | refuse 0/12 | Collapsed: 255 rows shared one reasoning template |
| 8 | 8B sft4 | QLoRA SFT | 722, rewritten | 18.3 → 14.3 | Diversifying reasoning after the fact destroyed the signal |
| 9 | 8B DPO-2 | on-policy DPO | K=8 own samples | 17.0/41 | Below its own SFT starting point |
| 10 | 8B v9 | QLoRA SFT | 4,206 | held-out connectors 62.5% | Champion for the small model |
| 11 | 8B v10 | QLoRA SFT | ~8,500 | held-out connectors 71.7% | Breadth up. Reliability flat |
| 12 | 8B RFT | rejection-sampling FT | 247 own winners | +6.7 pts on targets | Zero erosion, missed the +8 bar |
| 13 | 8B GRPO | GRPO | 93 tasks | +4.8 same-task, −0.6 transfer | Sharpened what it saw. Transferred nothing |
| 14 | Qwen3.8-27B (stock) | none | -- | 0.67 vs reference ~0.68 | Tied a frontier reference model in the full agent loop, with no training |
In three lines: QLoRA SFT took Qwen3-32B from 18% to 42% on 71 unseen tool-use tasks (p = 2e-5, zero regressions). DPO failed three times, GRPO sharpened what it saw but didn't transfer, and pass@k showed why. A stock 27B, measured properly, tied a frontier reference model with no training at all.
The question was whether an open model we could train and inspect could match a frontier API model inside a real agent loop. Five weeks, about two dozen training runs, five base models evaluated and three fine-tuned, four post-training methods. The best fine-tune is row 4. The model that answered the question is row 14, and it was never trained.
This is the full log: the eval I had to build before any of it meant anything, every training method I tried, and the bugs that would have fooled me.
What the Model Had to Do
An agent loop is not a chat completion. On every turn the model reads a long system prompt and the state of the user's connected apps, then decides: answer directly, ask a clarifying question, load the right tools, call them with correct arguments, recover when a call returns nothing, and write a grounded final answer. Or decide that the right move is to do nothing.
The reference was a frontier model behind an API (the reference model changed once during the program). The question I wrote down at the start:
Does scorer-filtered SFT move a stock open model toward the reference model on our eval?
The metric was reliability: pass^k, not just pass@1. A model that is right 60% of the time on one sample and 20% of the time across five samples is not reliable, and reliability is what an agent loop needs.
Building the Ruler First
Before training anything, I needed an eval I could trust. My first one passed garbage. It checked whether the model called the expected tools in the expected order, and a model that called the right tools with nonsense arguments sailed through.
So I rebuilt it around outcome contracts. Each task asserts what must be true at the end, not how to get there: which records were targeted, which arguments carried the load, which facts surfaced in the answer, which writes happened, or that the model correctly did nothing. Order-independent, authored from the user's intent. The tools behind it are a stateful simulator: filters really filter, lookups really resolve, and one deliberately dead search index returns nothing so the model gets scored on recovering through structured reads.
Then the part I'd skip if I were in a hurry, and shouldn't have: I measured the scorer as a classifier. I built negatives by corrupting one load-bearing dimension of a correct trajectory (does the scorer catch it? that's precision) and positives judged only from the prompt and world state, never from the contract (does the scorer accept valid alternatives? that's recall).
| Iteration | Labeled items | Precision | Recall | F1 |
|---|---|---|---|---|
| First measurement | 59 | 0.93 | 0.72 | 0.81 |
| Spec encoding fixed | 59 | 0.90 | 1.00 | 0.95 |
| Larger labeled set | 94 | 0.85 | 0.94 | 0.89 |
| Simulator over-correction (reverted) | -- | 0.87 | 0.84 | 0.85 |
| Clean slice | 64 | 0.875 | 1.00 | 0.933 |
| Frozen eval | 20 tasks | 0.955 | 1.00 | 0.977 |
A recall of 0.72 means the first scorer rejected more than a quarter of valid answers. Every model would have looked worse than it was, and every comparison between models would have been noise.
A blind spec check on the eval tasks found 4 of 20 were mis-authored, including one that rewarded the wrong record. And the reference model's first score, 25%, turned out to be an eval artifact: 3 of 24 contracts failed their own ground truth, and 14 of 17 rejected valid rephrasings of arguments.
Once the scorer was honest and the eval ran under production conditions (the real system prompt, connected apps, the production sampling temperature, the eval clock pinned), the reference model scored 23% pass@1 and 20% pass^5 on the 20-task eval split. That was the real ceiling I was chasing. Not 90%. Twenty-three. (The 42% later in this post is on a different set, 71 held-out tasks, so the two are not a head-to-head comparison.)
Why it matters: Every number later in this post depends on this table. If I'd trained against the first scorer, I'd have optimised for a ruler that rejected a quarter of correct answers.
The Perfect Null (Score: 20% = 20%)
The first fine-tune used 41 trajectories sampled from a frontier model, filtered by the scorer. Full tool coverage, 19 demonstrations of the key tool-loading convention.
Score: 20%. The base model scored 20%. Not close. Identical.
The adapter was working. 16 of 20 behaviours changed. Training clearly did something. It just didn't do anything useful.
It took a coverage diagnostic (coverage was complete, so this wasn't a data gap) and a prompt-length comparison to find it. The data generator built every trajectory under the default 843-character system prompt. The eval served the real production prompt: 17,390 characters. I had fixed the eval for production conditions two days earlier. The generator never got the same fix.
The model learned to behave well under a prompt it would never see again.
The fix was to build the real per-task prompt inside the generator, plus a parity guard that fails loudly if training and eval prompts ever drift again. The lesson I wrote down that night: always dump the model's actual input. Not the input you think it gets. The bytes.
Where the Training Data Came From
A "gold" here is a full trajectory: system prompt, user turn, the model's reasoning, every tool call, every tool result, and the final answer. It counts only if it passes the outcome-contract scorer when replayed through the simulator under the real prompt.
Sampling golds from a frontier model was low-yield: 39 usable golds from 142 attempts, clustered in two easy task families. So from the second iteration on, golds were scripted replays: each task's correct tool sequence and key arguments played through the real simulator, with authored reasoning for each step and the authored final answer. They are correct by construction, and every one is checked by the scorer.
The trap with scripted data is that it's easy to generate a lot of it that teaches nothing new. The first 150 tasks across five families contained only 26 distinct "signatures" (family, tool sequence, set of argument keys). Renaming entities and changing filter values doesn't count. A model trained on that learns 26 things, 6 times each.
So I added a structural-novelty gate: every new batch of 30 tasks had to introduce at least 20 signatures that appear in no earlier batch. Batches 2 to 5 had added 1, 0, 0 and 0 new signatures. Batch 6 was the first to clear the gate, with 22. Later I replaced the flat bar with a saturation cap (at most 5 golds per signature), because some families are rigid by nature and the flat bar was a mathematical ceiling for them.
On top of that: 8-gram decontamination against every held-out set (0 hits), a frozen registry of eval task ids enforced at data-prep time, fresh fictional companies in held-out worlds, and a prompt-level gate added the day two training golds were found carrying near-verbatim held-out prompts.
The 32B Curve: 18% → 35% → 42%
The recipe stayed fixed so the data was the only variable: QLoRA on Qwen3-32B, rank 16, alpha 32, dropout 0.1, peak LR 1e-4 with cosine decay and 10% warmup, effective batch 8, bf16, max length 8,192, 3 epochs. Loss only on the assistant's own tokens (reasoning, tool calls, answer). System, user and tool messages masked out, verified by decoding the labels.
The supervised signal is tiny. In the 294-gold run, supervised tokens were 5.3% of the sequence: 67,937 tokens, a median of 224 per example. Everything else is context the model reads but isn't trained to produce.
run4 (150 golds). 57 steps, about $1 on one H100. The eval split went from 20% to 45%. On 71 held-out tasks the model never saw, 18.3% → 35.2% (+16.9 points, McNemar p = 0.0075, 15 gains / 3 losses). The rule I'd set before looking was +15 points and p < 0.05, so the gain held on tasks it had never seen.
The more interesting test: 32 tasks from four families that were completely absent from training. 3.1% → 21.9% (+18.8 points, p = 0.031, 6 gains / 0 losses). One family, long chains, stayed at 0/8 before and after.
run5 (294 golds). Data only, everything else identical, pre-registered before the run with a bar of +22 points. 111 steps, 57 minutes, about $2. After epoch 1: 22.5%. After epoch 3:
| Held-out (71 unseen tasks) | Pass rate |
|---|---|
| Stock Qwen3-32B | 18.3% (13/71) |
| run4, 150 golds | 35.2% |
| run5, 294 golds | 42.3% (30/71) |


+23.9 points over base, McNemar p = 0.00002, 17 gains and 0 losses. It cleared the bar, so the conclusion was: the data slope continues, scale the data.
Two things from this run I keep coming back to.
The loss curve lied about epochs. After the first epoch the loss had flattened, and mid-run I read that as "one pass got most of the signal." Held-out after epoch 1 was 22.5%. After epoch 3 it was 42.3%. The flat loss hid two-thirds of the gain. I trust held-out numbers only now.
Conventions transfer. Skills don't. At equal coverage (30 golds per family), lazy tool loading went from 0% to 39%, while argument precision went from 0% to 11%. Argument precision had the most golds (54) and stayed the most stuck: 2/18 after run5. Abstention went from 77% to 100% with just 9 targeted examples. A convention is a pattern you can copy. A skill like constructing exactly the right filter from an ambiguous request is not something 50 demonstrations install.
The next run tested the obvious move: more data (404 golds) and a lower learning rate (5e-5) together, to save a GPU session. It scored 30/65 against run5's 36/65 (p = 0.146), and 5 of its 9 losses were abstention. An offline re-score settled that the data, not the LR, caused it. Not adopted. Lesson re-learned: change one thing.
Going Small: Breadth, Not Reliability
The design then shifted: a small model orchestrates the loop and a stronger model writes the final answer. From week three the main student was Qwen3-8B (14/41 on the decision set, stock), with LFM2.5-2.6B as a cheaper option (5/41). Qwen3-4B was out within a day: 9/41, 0 on intent, and about 6,000 tokens of rambling when served with thinking on.
Data scaling did what data scaling does. On whole connectors held out of training, generalisation rose with data (8B: 50% → 62.5% → 71.7%, up to about 8,500 rows) and with size (32B 57.5% / 8B 50% / LFM 34% on the same data). But intent handling, multi-turn follow-through and formatting did not move across 8,500 rows. The model wasn't missing knowledge; it was missing execution discipline. On one family it passed 53% of single attempts but only 40% of tasks across all three samples. Capable, not reliable.
Two data bugs from this stretch:
Refuse collapse. Refusals on tasks it should refuse dropped to 0/12. 255 training rows shared one verbatim reasoning opener that always led into acting, so the model learned "start like this, then act" everywhere. Diversifying those openers fixed it.
Then I over-corrected. I rewrote the reasoning of 294 other rows after the fact, and the 8B regressed 18.3 → 14.3. Paraphrasing reasoning in bulk destroyed the contrast between why one task should act and another should wait. Since then: author diverse reasoning from the start, never paraphrase it later.
DPO, Three Times
SFT plateaued on discipline, so I tried preference optimisation.
DPO-1 (32B, 381 pairs). Chosen = the SFT target. Rejected = an authored wrong trajectory, each pair certified by the scorer (chosen passes, rejected fails). cDPO with label smoothing 0.1, β = 0.1, LR 5e-6, loss on action tokens only (reasoning excluded, so the model isn't taught to sound right).
The preflight should have warned me. At initialisation, the policy's log-probability of the chosen side was −27.96 and of the rejected side −41.55. The rejected trajectories were 13.6 nats away from anything the model would actually generate. Training dutifully pushed the margin up 11× and generation barely moved: routing +0, arguments +2 points. The model was learning to further down-weight mistakes it never made.
Preference data only changes behaviour when the rejected side is what the policy actually does. The fix is distributional, not volumetric.
There was a second, quieter bug. The abort metric I'd planned to watch, reward accuracy, is degenerate at step zero: policy equals reference, every implicit reward is 0, and eval loss is exactly ln 2 = 0.6931. It can't tell you anything at the start. The right preflight is the raw per-pair log-prob preference fraction on the policy you're about to train.
DPO-2 (8B and LFM, on-policy). Pairs from the model's own K=8 samples, scorer-certified. Both models landed at 17.0/41, below their SFT starting points.
DPO-3 (on-policy on the 8B champion). −1.4 on the decision set, −7.5 on held-out connectors. Three strikes. DPO retired for this problem.
RL: Sharper, Not Broader
Rejection-sampling fine-tuning. Sample the champion K=8 times per task through the real loop, keep the winners, mix in replay, train at 10× lower LR. 157 winners + 90 replay rows. Target families went 0.333 → 0.400 (+6.7 points) with zero erosion on the strong families. The bar I'd set was +8. Missed by 1.3, not promoted.
The reward that almost taught refusals. Before spending GPU on the next RL round, I ran the reward offline on a local server. The single-turn behaviour looked fine (89% correct routing). The multi-turn smoke test showed the real failure: when the model didn't know something, it deflected ("That's a hardware spec I can't read, ask the vendor") and the crude verifier passed the deflection. RL would have harvested refusals as winners and reinforced them. One regex and two GPU rounds avoided, one of them harmful.
GRPO. TRL GRPO with vLLM rollouts, bf16, KL β = 0.04, rollout temperature 0.3, a binary reward from the outcome-contract scorer, canary tasks, and an erosion detector on a held-out set that halts training if it drops. On the 93 training tasks: +4.8 points. On the held-out connector set it read +4.2, which looked like transfer.
I didn't believe a single-sample gain, so I re-measured with K=8 paired samples on the same server. Transfer: 0.538 vs 0.543, Δ −0.6 ± 1.8. Zero. GRPO sharpened exactly the tasks it saw and taught nothing general. I retracted the +4.2.
The A/B That Was Measured With a Bent Ruler
By now the design was a small orchestrator with a stronger model writing the final answer. I ran a three-arm A/B in the full agent loop: 8B alone, 8B orchestrating with a stronger writer, and the frontier reference model. 10 scenarios × 8 repetitions each, deterministic per-family checkers, tripwires for fabrication and leaked reasoning.
The headline was good: the gated orchestrator at 75.3% vs the 8B alone at 63.5% vs the reference model at 73.4%. The solo 8B leaked its reasoning into the user-facing answer in 69% of turns. With the gate, 0.
The next morning I audited the checkers instead of celebrating.
- The correction checker only measured word overlap. It passed "reworded but ignored the correction." It scored 8/8 on every arm, including the model I knew was bad at it. Proof case: "20% of 150 is 30" → user: "I meant 250" → model: "the figure comes out to 30." Old checker: PASS.
- The task-switch checker scored switching into an unavailable task at random.
- The presentation checker passed a pure lead-in ("Here are your emails:") with zero items. The grounding checker only checked length.
Then I attacked my own fixes and found three more bugs, including a substring collision: "50" is a substring of "250", so a stale echoed answer false-passed the new correction check. Final state: 26/26 adversarial golden tests.
The leaked-reasoning finding stood (69% → 0 is not a checker artefact). The family-level scores, including the 75.3%, did not: I voided them, and none of the numbers in the headline above count as a result.
The ruler-fixer's fixes need the same adversarial goldens as the ruler.
pass@k: Where the Gradient Actually Is
An SFT round aimed at the champion's benchmark failures came back flat. What I wrote that day: this is not a data-curation problem, it's an ML-engineering gap we're missing from surface understanding.
The missing measurement was pass@k. I took 8 winnable multi-step "drive to a conclusion" chains at three depths (4 chains at depth 3, 2 each at depths 5 and 8) and sampled the 8B champion 16 times each (128 trajectories, about $4):
| Chain depth | Concluded | Grounded |
|---|---|---|
| 3 | 12/64 (19%) | 12/64 |
| 5 | 0/32 | 1/32 |
| 8 | 0/32 | 0/32 |


Outcome-only RL has a gradient only where pass@k is strictly between 0 and k. At depth 5 and 8 the model never succeeds in 16 tries (on only 2 chains each, so a small sample), so a binary outcome reward is zero for every sample and there is nothing to learn from. GRPO wasn't failing to transfer because of the algorithm. For the deep chains, the reward was simply absent.
So I designed a shaped reward and tested it offline:
| Outcome | Reward |
|---|---|
| Concluded correctly | 1.0 |
| Grounded but not concluded | 0.6 |
| Stalled partway | 0.2 + 0.1 × (hops grounded / (depth − 1)), capped below grounded |
| Fabricated | −0.5 |
| Looped | −0.3 |
| Refused a winnable task | −0.2 |
| Honest refusal on an unwinnable task | 1.0 |
With a curriculum weighted to depths 3 and 5, and depth 8 routed to the stronger model. It never ran, because the next measurement made it unnecessary.
The diagnostic I use now:
- pass@K ≈ 0 → it's a data or capability gap. RL can't help yet.
- pass@1 low, pass@K high → it's reliability. That's what RL is for.
- Both high → stop. There's nothing to train.
Measure Before You Train: the Stock 27B
At this point I had a rule I should have had in week one: no training without a pre-measured deficit larger than the minimum detectable effect.
So I measured a newer stock model, Qwen3.8-27B (a hybrid linear-attention architecture), with no fine-tuning at all. First on single calls under production conditions (long prompt, 30 tools, 16-turn history): 21/21. Then end to end on 54 in-system tasks (18 tasks × 3 repetitions) in the full agent loop, against a fixed, seeded test backend with a 240-second deadline.
| Model | Score (18 tasks × 3) |
|---|---|
| Fine-tuned 8B champion | 0.02 (1/54) |
| Stock 27B, no training | 0.67 (36/54) |
| Frontier reference model | ~0.68 (27 of 40 valid turns; 14 lost to an API limit) |
One checker was fixed after the first read and re-applied to all three arms; before the fix the 27B scored 0.59 (32/54).
The fine-tuned 8B that looked good on single calls fell apart in the real multi-step loop. The stock 27B tied the reference model.
Then pass@k on the 27B's failures, for $0.37: on 5 of the 7 failing tasks, pass@5 = 1. The other 2 stayed at 0/5 and I excluded them as not validly measurable (a judge blind spot and a rubric that asked for impossible evidence). Every failure that could be measured was a reliability miss, not a capability gap. Training would have meant fine-tuning into a ceiling the model didn't have.
What I'd Do Differently
- Validate the ruler as hard as the model. The scorer, the simulator, the checkers, the prompt the model actually sees. Every major wrong conclusion I almost drew came from the measuring stick, not the model.
- Measure before you train. Stock models first, under production conditions, with pass@k. If the deficit isn't bigger than the minimum detectable effect, don't train.
- Trust held-out numbers, never training loss. The flat loss hid two-thirds of run5's gain.
- SFT elicits; it doesn't install. Conventions copy from ~30 examples. Skills like argument precision didn't move with 54.
- Preference data must be on-policy, and even on-policy DPO didn't help at this scale. Check the init log-prob gap before training.
- RL reweights; it can't inject. Outcome-only rewards need pass@k strictly between 0 and k. Where the model never succeeds, shape the reward or change the curriculum.
- Run the cheap integrated test before a retrain. One prompt directive tested against the real retriever (15/15) cancelled a planned 695-trajectory retrain.
- Train in the regime the model will run in. Benchmarks are clean, short and single-turn. Production is a long prompt, dozens of tools, long history and loops. Use benchmarks only as a "did we break general ability" check.
- Change one thing per run. Every confounded run I ran had to be re-run or re-scored to mean anything.
The best fine-tune in this program took a 32B model from 18% to 42% on tasks it had never seen, with zero regressions. I'm proud of that number, and of the eval that makes it trustworthy. But the measurement that taught me the most was the last one: a stock model, measured properly under production conditions, already did the job. Knowing when more training is the wrong tool is part of post-training too.