geofreynjoroge.com
← all posts
Mech Interp·Oct 31, 2026·10 min read

The RLHF Tax: L9·H23 Is Invariant to Alignment Training

A systematic base-vs-instruct comparison using activation patching on Llama-3.2-1B. L9·H23 is the dominant factual recall head in both variants — 10/10 experiments agree. RLHF reshapes the output distribution but does not rewire the knowledge circuit.

mechanistic-interpretabilityrlhfalignmentllamacircuitlensactivation-patchingattentionfactual-recall

Session 7 of CircuitLens started with a question left open in Session 6: does RLHF move the factual recall circuit?

The instruct model hedges, formats, refuses. It produces a different kind of output than the base model. But different output could mean different mechanism — the alignment training rewired the circuit — or it could mean the same mechanism with a different steering layer on top. That distinction matters if you want to edit factual knowledge in aligned models.

The answer, across 10 activation patching experiments: the circuit doesn't move. L9·H23 is the dominant factual recall head in both Llama-3.2-1B and Llama-3.2-1B-Instruct. 100% agreement. RLHF is a behavioral overlay, not a structural rewiring.

The Question

The RLHF pipeline transforms a base model into an instruction-following assistant through three stages: supervised fine-tuning (SFT) on demonstration data, reward model training from human preference pairs, and PPO optimization that updates the policy to maximize that reward. This process changes model behavior dramatically — refusals, formatting, structured answers — but what actually changes inside the network?

Two hypotheses:

Structural rewiring: RLHF builds new factual circuits or relocates existing ones. The instruct model retrieves facts using different attention heads than the base model.

Behavioral overlay: RLHF adds a steering layer on top of an unchanged knowledge substrate. The same head stores the same facts; what changes is how the model decides to use and express them.

No prior study had tested this at single-head resolution. ROME (Meng et al., 2022) established that factual associations live in specific MLP layers in base models — GPT-J and GPT-2-XL — but didn't compare base vs. instruct. Hase et al. (2023) questioned whether localization results generalize to editing, but again on base models only.

This session fills that gap.

Setup: Same Model, Two States

Both variants share identical architecture: 16 transformer layers, 32 attention heads, d_model=2048. The only difference is post-pretraining alignment.

VariantHuggingFace IDTraining
Basemeta-llama/Llama-3.2-1BPretraining only
Instructmeta-llama/Llama-3.2-1B-Instruct+ SFT + RLHF (PPO)

Five capital-city facts, spanning four continents, matched across both models:

FactClean PromptCorrupted PromptTarget
France → Paris"The capital of France is""The capital of Germany is"" Paris"
Japan → Tokyo"The capital of Japan is""The capital of China is"" Tokyo"
Italy → Rome"The capital of Italy is""The capital of Spain is"" Rome"
Brazil → Brasília"The capital of Brazil is""The capital of Argentina is"" Bras"
Egypt → Cairo"The capital of Egypt is""The capital of Libya is"" Cairo"

The patching protocol is the same used in the France→Paris experiment: replace one head's activations from the corrupted run with clean-run activations, measure Δ probability on the target token. The key head is the argmax across all 16×32 cells.

One detail worth flagging explicitly: target tokens use a leading space — " Paris" not "Paris" — because Llama's BPE tokenizer encodes the space-prefixed form as a single token. Using the bare word gives near-zero clean probability and meaningless patching results. This trips up replication attempts more often than the experiment logic does.

Results: 10/10 → L9·H23

Base model — Llama-3.2-1B:

FactClean ProbCorrupt ProbKey HeadMax Δ Prob
France → Paris39.1%0.3%L9·H23+55.1%
Japan → Tokyo15.6%0.1%L9·H23+19.9%
Italy → Rome24.3%0.2%L9·H23+19.7%
Brazil → Brasília12.8%0.0%L9·H23+16.6%
Egypt → Cairo17.2%0.1%L9·H23+13.5%

Instruct model — Llama-3.2-1B-Instruct:

FactClean ProbCorrupt ProbKey HeadMax Δ Prob
France → Paris26.3%0.1%L9·H23+24.5%
Japan → Tokyo51.2%0.0%L9·H23+53.9%
Italy → Rome58.7%0.1%L9·H23+60.9%
Brazil → Brasília57.8%0.0%L9·H23+59.3%
Egypt → Cairo6.1%0.0%L9·H23+5.3%
              BASE                  INSTRUCT
Fact          Key Head   Δ Prob     Key Head   Δ Prob     Same?
─────────────────────────────────────────────────────────────────
France→Paris  L9·H23    +55.1%     L9·H23    +24.5%      ✓
Japan→Tokyo   L9·H23    +19.9%     L9·H23    +53.9%      ✓
Italy→Rome    L9·H23    +19.7%     L9·H23    +60.9%      ✓
Brazil→Bras   L9·H23    +16.6%     L9·H23    +59.3%      ✓
Egypt→Cairo   L9·H23    +13.5%     L9·H23    +5.3%       ✓
─────────────────────────────────────────────────────────────────
Match rate:   10/10 experiments → L9·H23               100%

Perfect agreement. 5 facts, 2 models, same head every time.

The Δ magnitudes differ — RLHF shifts how decisive the head's contribution appears in absolute terms. France is stronger in the base model; Japan, Italy, and Brazil are stronger in the instruct. The instruct model allocates output probability differently (confident, structured responses vs. raw next-token prediction), so the absolute patching signal shifts. But the identity of the argmax head doesn't. The head is doing the same job in both models.

The Layer 15 Signal

After fixing a layer cap bug in CircuitLens (more on this below), layers 12–15 became visible. A secondary signal appeared: L15·H5, present in both base and instruct, weaker than L9·H23 but consistent across facts.

Layer 15 is the final transformer layer — the output boundary. L15·H5's role appears to be output refinement: it activates after L9·H23 has already written the correct association into the residual stream, and acts as a confidence amplifier at the last layer before the unembedding.

This two-head structure mirrors the IOI circuit from Session 6, where the primary name mover (L11·H31) was supported by secondary heads at deeper layers. Layered circuits — primary retrieval in the middle layers, refinement at the output boundary — may be a general pattern in how Llama organizes complex associations.

The partial circuit map of Llama-3.2-1B now covers three distinct heads:

Layer 9,  Head 23 — Factual knowledge retrieval (capital cities)
Layer 11, Head 31 — Name mover (indirect object identification)
Layer 15, Head 5  — Output refinement / confidence amplifier

These three heads are anatomically separate. L9·H23 never appears in IOI experiments; L11·H31 never appears in factual recall experiments. The model has dedicated circuits for different inference types.

What RLHF Changes and Doesn't

The Δ magnitude asymmetry is real and worth examining:

  • France: Base +55.1% vs. Instruct +24.5% — base is stronger
  • Japan: Base +19.9% vs. Instruct +53.9% — instruct is stronger
  • Italy: Base +19.7% vs. Instruct +60.9% — instruct is stronger

For some facts the instruct model's patching signal is larger; for others the base wins. This doesn't mean the head is working harder in one model — it means the output layer behaves differently. The instruct model has been trained to produce confident, direct answers (SFT on demonstration data where the capital is stated cleanly), so probability mass concentrates more on single tokens for some facts, giving a larger absolute recovery when the right head is restored. For France, the base model's higher starting clean probability (39.1% vs. 26.3%) gives a larger patching ceiling.

What RLHF changed: how the model uses the factual circuit's output — formatting, confidence, output probability distribution.

What RLHF did not change: which head stores the fact, where it lives in the network, or how patching its activations affects retrieval.

This supports the behavioral overlay hypothesis. Alignment training adds a steering layer that shapes outputs without touching the knowledge substrate. The factual backbone is preserved.

The Bug That Hid a Head

The original main.py patching loop contained:

for l in range(min(N_LAYERS, 12)):

This silently capped all models at 12 layers. For Llama-3.2-1B (16 layers), the entire upper quarter of the network — layers 12–15 — was invisible. The patching grids looked complete; they were 25% truncated.

After fixing to range(N_LAYERS), the L15·H5 signal emerged.

The cap was presumably added as a performance safeguard for larger models. The side effect was that all 16-layer models appeared to be 12 layers deep, with no error and no warning. The experiment ran, produced results, and displayed a full-looking heatmap — nothing indicated truncation. It was only noticeable because Llama has more layers than the cap value.

Any hardcoded limit on a dimension you're iterating over is a potential silent data truncation. Loop bounds deserve the same scrutiny as data preprocessing.

Implications for Circuit Editing

If RLHF doesn't relocate the factual circuit, then knowledge editing that targets L9·H23 in the base model should transfer to the instruct variant. ROME-style edits — which identify the causal head and modify its weights to change a factual association — could in principle be developed and validated on the base model and then applied to the aligned version, since the target head is the same.

This is an explicit prediction that needs experimental validation: apply an edit (e.g., reroute France → Berlin instead of France → Paris) to the base model targeting L9·H23, then apply the same edit to the instruct model and check whether retrieval changes as expected. That's the next planned experiment.

The caveat: RLHF may have changed the downstream components that read L9·H23's output. Even if the head is the same, the output formatting and confidence layers could interact differently with an edited head in the instruct model. "Same head" is necessary but may not be sufficient for edit transfer.

Limitations

Single architecture. Llama-3.2-1B only. Qwen 2.5 1.5B was attempted but blocked by a rope_theta incompatibility between transformers 5.13.1 and TransformerLens; Gemma 2 2B exceeded T4 VRAM with TransformerLens overhead. The claim needs verification on other model families before it generalizes.

Capital cities only. All five test facts are the same category: geographic capitals. Other fact types — scientific, historical, biographical — may use different circuits or distribute across heads rather than concentrating in one.

Attention-only patching. We patched hook_z (attention head output). MLP patching, residual stream patching, or path patching could reveal circuit components not visible through this method. ROME's original finding was in MLP layers; this analysis is complementary, not exhaustive.

Magnitude comparability. Δ probabilities are not directly comparable between base and instruct because the output distributions differ. The valid comparison is argmax identity, not magnitude.


The headline result is clean: same architecture, one round of RLHF, same head. L9·H23 is the factual recall head before and after alignment. The knowledge is in the pretraining, and the pretraining's circuit persists through the alignment process.

RLHF changes what the model says. It doesn't change where the model knows it.


Experiments run on Llama-3.2-1B and Llama-3.2-1B-Instruct using TransformerLens on Colab T4, with CircuitLens CLI for batch patching. Code: Jeff9497/Circuit6. Prior work: Meng et al., "Locating and Editing Factual Associations" (ROME, 2022); Hase et al., "Does Localization Inform Editing?" (2023).