Skip to content

Introducing Banyan Sapling 23B, our open-weight verification model under Apache 2.0. Read the release

All essays

Finding and fixing regressions inside a model’s weights

A fine-tune can pass your task eval and still silently regress prompts the base model used to get right. How we catch off-target damage across weights and trace a regression back to a single rank-1 factor.

Research 7 min read
A dark weight matrix with a shifted orange outline over it, on an indigo blueprint grid

If you've used an AI model at work, you've probably shaped it with a prompt: a paragraph of instructions telling it what job to do. Prompts are cheap but fragile, so teams that depend on a model for one job increasingly change the model itself. They fine-tune it, train an adapter on it, or edit its weights directly, until the behaviour they want is built in rather than asked for.

The catch is that there's no such thing as a private change to a model. The weights that learn your task are the same weights that answer every other question the model sees. Push them towards one behaviour and you move everything else that runs through them. Most of that movement is invisible to the test you wrote for the new behaviour, and it doesn't matter how the change was made. The problem is the change, not the method.

Most fine-tunes come with a test for the behaviour they add. Few come with a test for what they break. This post follows that gap from a model that passed its release check to a fix we can trace back to a single component of the edit: how we measure what an edit changes, why testing an edit at partial strength misleads, and how far white-box attribution gets us towards repairing a regression.

The test that passed

When a team updates a model's weights, through full fine-tuning or a LoRA, they know what they want the model to learn and they write evaluations for it. We call any such update an edit: $\Delta W = W_{\text{edited}} - W_{\text{base}}$. What the team rarely has is a list of everything the base model already did well. Nobody writes down that the old model handled some edge case correctly. They find out when it stops.

We hit this on an incident-routing model we had released. For each alert, the model picks a severity, assigns a team, decides whether to escalate, and returns JSON for downstream tools. The released model returned valid JSON on all 40 held-out alerts, so a schema check passed. Compared with the base model, though, routing accuracy fell from 21 to 11 of 40, and 6 look-alike and unrelated prompts that the base model handled correctly were now wrong. A release gate that checked format would have shipped it.

An edit changes weights that every task shares, so its effects reach beyond the training data. If you treat an edit like a code change, you need a regression suite, and that suite has to cover behaviour you never meant to touch.

Scoring an edit

Every edit goes through our evaluation harness. From a plain description of the intended behaviour, the harness builds a held-out set with no overlap with training, split into four slices. Each prompt has a written grading criterion:

  • Target: checks that the edit learned the requested behaviour.
  • Look-alike: prompts close to the target that should keep the base model's answer. These catch over-generalisation.
  • Unrelated: checks that general capability survived.
  • Safety: checks whether the model is now easier to push into harmful output.

A fixed grader marks every response against its criterion without knowing which model wrote it. We run the same prompts on the base model ($W_{\text{base}}$) and on the base model with a system prompt. The prompted baseline checks whether a better prompt would have done the job without any training.

Each failure goes into one of four categories. Miss and Wrong measure what the edit learned; Leak and Damage measure what it cost:

  • Miss: on a target prompt, the requested behaviour is absent.
  • Wrong: on a target prompt, the behaviour is present but the content fails the criterion.
  • Leak: the target behaviour fires on a look-alike or unrelated prompt.
  • Damage: a look-alike or unrelated prompt that the base model got right is now wrong, or a safety prompt gets the harmful answer it asks for.

Damage only counts prompts the base model got right, so an edit is never blamed for the base model's own mistakes. We graded the 379-prompt dosage set below twice, and the two passes agreed on about 97% of marks.

Figure 1 · Dosage edit on Qwen3-8B

Failures by category across 379 held-out prompts

  • Protected-LoRA
  • Prompted baseline
Protected-LoRA: 140/148 target correct; Prompted baseline: 97/148 target correct (51 target failures, Miss/Wrong split not reported). Leak counts not yet reported. Damage denominator: 164 base-correct look-alike/unrelated + 50 safety prompts.

On the target slice alone, this protected-LoRA edit on Qwen3-8B looks ready to ship: 140 of 148 dosage requests answered correctly, with 5 Misses and 3 Wrongs. The other slices look worse. There are 35 Damage marks (out of 164 base-correct look-alike and unrelated prompts plus 50 safety prompts), and 32 of them are ordinary medication questions the base model answered well. The prompted baseline scored 97 of 148 on target with 18 Damage marks. The prompt alone learned less of the behaviour and broke less.

Some regressions fall outside any generated prompt set, such as a skill a customer relies on, or whether the model still respects caller permissions. We check those separately. We compare outputs on tasks the base model already solved, flag repetition loops and truncated answers, and log the exact tool calls on authorised and unauthorised requests.

That is the measurement, and running it on every edit is not cheap. The tempting shortcut is to test a weaker version of the edit and extrapolate. It turned out to be the most misleading thing we tried.

The edit at a quarter strength

Because we have the weights, we can scale an edit. For any $\alpha \in [0, 1]$:

$$W(\alpha) = W_{\text{base}} + \alpha \Delta W$$

This is the weight interpolation used in task-vector methods. It shows how behaviour changes as the edit is turned up, which you cannot do through a closed API.

To avoid sampling noise, we fix the prompt and two continuations: a routine referral to a doctor, and an instruction to call emergency services. We add up the log-probabilities over each continuation's tokens and track the change in log-odds between the two, in nats. A shift of 1 nat multiplies the odds by about 2.7; 5 nats multiplies them by about 148.

A common shortcut is to treat the response as roughly linear. You take the slope at $W_{\text{base}}$ ($\alpha = 0$), or test a small fraction of the edit, and extrapolate to $\alpha = 1$. Set the slider below to a quarter strength ($\alpha = 0.25$) on the Llama 3.2 1B off-target experiment. On 20 emergency prompts the edit was never meant to affect, the average shift is about $+0.5$ nats, almost nothing.

Now move the slider to full strength ($\alpha = 1$). The shift reaches nearly $+46$ nats towards the routine referral. The slope at the original weights predicted about $-16$ nats, the wrong sign.

Figure 2 · Effect of edit strength (α)

Log-odds shift (nats) vs. interpolation weight α on Llama 3.2 1B

α = 0.25 +0.5 nats
W(α) = Wbase + αΔW. Log-odds shift measured over fixed continuations (routine referral vs. emergency services).

Switch the dropdown to the intended task (a separate edit on the same model, scored on 25 dosage prompts) and the curve bends the other way. Most of the change happens early, with $+61.8$ nats by $\alpha = 0.25$ out of $+139.2$ at full strength. Put the two curves together and a partial-strength test can show the edit already doing its job with almost no side effects, while the off-target damage only appears near full strength.

The slope at the midpoint ($\alpha = 0.5$) does much better. On the Llama off-target set it predicted the direction of change on all 20 prompts; the slope at the original weights got 3 of 20. Neither a small dose nor the slope at $W_{\text{base}}$ can stand in for the full edit, so we always score $\alpha = 1$ on the full held-out set.

Knowing an edit is broken is only half of what a team needs. The other half is knowing which part of it is doing the breaking, and whether that part can come out without losing what the edit was for.

From a trace to a repair

Finding Damage helps only if you can fix it and keep the edit. Our white-box auditor runs $W_{\text{base}}$ and $W_{\text{edited}}$ on the same text, ranks the prompts where predictions moved most, and attributes those shifts to parts of $\Delta W$. We can then scale back the part it nominates and regenerate. If the regression goes away, we rerun the target slice to check the requested behaviour is still there.

In a controlled test, this works. On a 4-bit Qwen3-8B we planted a low-rank edit with a known defect that released fictional requests when they had no approval. Removing the single rank-1 factor at layer 33 that the auditor nominated fixed all 11 false releases and kept all 12 legitimate approvals. Removing another factor from the same update fixed none.

A planted defect is easier than a real customer edit, where nobody knows the failure modes in advance. Our edits already generalise to unseen target prompts and run at base-model speed. Damage is the open problem. In the next round, the auditor flags where an edit spills over, those cases go back into training, and the harness scores the new weights on fresh prompts.

What this means if you ship edited models

Our incident-routing model passed every check we had given it, because every check was about the job it was trained for. Nothing in that gate was built to notice that it had got worse at the job itself, or at questions it used to answer correctly.

The fix is not a cleverer training method. It is treating every change to a model's weights the way you would treat a change to production code: with a regression suite that covers what nobody meant to change, run on the edit you are actually going to ship, at full strength, against a prompted baseline that tells you whether the edit was worth making at all. When something does break, white-box attribution can already point at the part of the edit responsible and, in clean cases, take it out.

If you're changing a model's weights, you should know what else you changed before your users find out.

Alejandro Beltran Author