← voidwest    research notes

patching a quantized model: the sites that matter survive

2026-10-02 · 72 runs · Llama-3.2-1B and Qwen2.5-1.5B, F16 to Q4_K_M

Most people who patch activations on a laptop patch the quantized GGUF they can run. The question is whether that is the same experiment as patching the model it was quantized from.

I patched every candidate site on four builds of two models and compared each quantized build with its F16 source. The sites that carry the answer agree closely on every build. The ordering of the sites that barely matter does not, and that disagreement broke the rule I had written down in advance.

claim boundary

Two small instruction models, one fact-recall template, six prompt pairs. This says nothing about larger models, other circuits, or quantizers other than llama.cpp's. F16 is the reference here, not ground truth: it is itself a rounding of the BF16 training weights.

the setup

The prompt is The capital of {country} is the city of. The clean prompt names one country and the corrupted prompt another, for six pairs such as France and Italy. The metric is the logit of the clean capital minus the logit of the corrupted one at the final position.

Each model has four rungs: the F16 source file, then Q8_0, Q6_K and Q4_K_M made from that same file by the pinned llama.cpp quantizer. Quantization is the only difference between rungs.

A candidate is one site (the residual stream entering a block, the attention output, or the MLP output) at one layer and one position. Positions run from the country token to the end; earlier positions are identical in both prompts. That is 240 candidates per Llama run and 420 per Qwen run.

Every candidate was patched for real: the corrupted prompt runs with the clean activation written in at that one site. The measured effect is the change in the metric, and the recovered fraction divides it by the clean-corrupted gap. Ember's cheaper direct-path estimate was recorded but is not what is compared here.

All 72 runs answer correctly: every clean prompt prefers the right capital and every corrupted prompt prefers the other one. Every bundle verifies, and its hashes are in the published provenance file.

the rule I wrote first failed everywhere

Before any run I committed a decision rule. A rung would count as giving the same conclusions as F16 if, on every pair, the measured effects correlated with Spearman of at least 0.9 over all candidates, the single most effective site matched, and the sites recovering at least 20% of the gap overlapped with Jaccard of at least 0.8.

No rung of either model passed. Llama's Q8_0 build, the closest to F16, reached a median Spearman of 0.90 and matched the top site on one pair of six. Qwen's Q4_K_M build reached a median of 0.62.

The third condition held almost everywhere: the material sites overlapped with Jaccard of at least 0.85 on every rung. The first two conditions were the ones that failed, so I looked at what they were measuring.

why it failed

Most candidates do almost nothing. In F16, 75% of Llama's candidates and 87% of Qwen's recover less than 2% of the gap. Quantization noise reshuffles the ranks of those near-zero effects freely, and a rank correlation over all candidates is mostly a measure of that shuffle.

The top of the list is a near-tie. Patching the residual stream at the country token in any early layer restores almost the whole gap, so the best and second-best F16 sites differ by at most 0.4 percentage points. Which one comes first is close to a coin flip. On every rung, the quantized build's top site recovers within 1.5 points of F16's best.

So the rule tested two things that do not matter for interpretation: the order of negligible sites and the order inside a tie.

what does agree

Restricted to the sites that recover at least 5% of the gap in F16, the effects agree closely. Each rung's profile across layers sits on top of F16's.

Recovered fraction by layer at the final position, France versus Italy, for F16, Q8_0, Q6_K and Q4_K_M. For both models the quantized curves lie on the F16 curve at every site. Recovered fraction by layer at the final position, France versus Italy, for F16, Q8_0, Q6_K and Q4_K_M. For both models the quantized curves lie on the F16 curve at every site.
France versus Italy, final position. On the other pairs these final-position curves differ from F16 by at most 8.5 points on any rung. Full data: comparison.csv in the study directory.
modelrungSpearman, all candidates (median)Spearman, sites ≥5% (worst pair)largest recovered-fraction errorhandoff layer matches F16
Llama-3.2-1BQ8_00.900.9971.6 pts6 of 6
Llama-3.2-1BQ6_K0.820.9956.5 pts5 of 6
Llama-3.2-1BQ4_K_M0.800.9728.5 pts5 of 6
Qwen2.5-1.5BQ8_00.850.9343.8 pts6 of 6
Qwen2.5-1.5BQ6_K0.680.8834.6 pts6 of 6
Qwen2.5-1.5BQ4_K_M0.620.8678.5 pts6 of 6

The handoff layer is the first layer where the final position's residual stream recovers half the gap: where the answer has arrived at the last token. It matches F16 in 34 of 36 comparisons, and the other two are one layer early. The most effective attention or MLP output matches F16 in all 36.

The gap itself moves by about 5% at most. Quantization did not change what these models know about capitals, or where they move that knowledge.

Spearman of measured patch effects against F16, per pair. Hollow markers over all candidates fall from about 0.9 at Q8_0 to about 0.6 at Q4_K_M for Qwen. Filled markers over sites recovering at least 5% stay at or above 0.97 for Llama and 0.87 for Qwen. Spearman of measured patch effects against F16, per pair. Hollow markers over all candidates fall from about 0.9 at Q8_0 to about 0.6 at Q4_K_M for Qwen. Filled markers over sites recovering at least 5% stay at or above 0.97 for Llama and 0.87 for Qwen.
Hollow: the pre-registered metric over every candidate. Filled: the same metric over sites that matter in F16. One dot per prompt pair.

Qwen degrades more than Llama. At Q4_K_M its worst pair falls to 0.87 on the sites that matter, against Llama's 0.97, and the curves are still read the same way. With six pairs per model I would not read more into the difference than that.

what to take from it

On these models and this task, a Q4_K_M build finds the same sites, effect sizes within a few points, and the same handoff layer as F16. Locating where a fact is carried survives quantization.

Two habits do not survive. Reading the rank order among small effects is reading noise. A rank correlation over every candidate is dominated by those small effects, so it understates agreement on what matters and is the wrong headline number for a patching comparison. Report effect sizes above a stated threshold instead.

The rule I wrote in advance made exactly that mistake. It stays in the study directory as written, next to the diagnostics added after the first run, which are labelled as exploratory.

limits

reproduce it

The design, script, results, figures and per-bundle hashes are in research/quant-attribution. The design was committed before the first run.

python research/quant-attribution/run_study.py run --ember target/release/ember --out runs/quant-attribution
python research/quant-attribution/run_study.py analyze --out runs/quant-attribution --results results --figures

related work on this site