Where does an autoregressive transformer store a fact like “The Space Needle is in downtown Seattle”? In 2022, Kevin Meng, David Bau, Alex Andonian, and Yonatan Belinkov showed that factual recall inside GPT follows a localized two-stage circuit: middle-layer feed-forward MLPs act as key-value memories when processing the last token of the subject name, and upper-layer attention heads copy that recalled information to the final token to pick the output word.

To prove that localization was causal rather than correlational, they introduced Rank-One Model Editing (ROME), a closed-form algebraic update to a single MLP projection matrix. Causal tracing and ROME gave mechanistic interpretability both a sharper surgical probe and a concrete test of whether editing a proposed component generalizes without breaking neighboring facts.

  • Two localized sites in GPT-2 XL: Across 1,000 factual prompts, corrupting subject embeddings drops average object probability from 27.0% to 8.47% (Average Total Effect 18.6%); restoring states reveals an early site peaking at layer 15 (8.7% AIE) at the last subject token, plus a late attention site around layer 32 at the final token.
  • MLPs dominate the early lookup: Across 10-layer restoration windows at the last subject token, MLP modules peak at layer 17 (6.6% AIE, restoring probability to 15.0%) versus 1.6% AIE for attention; severing MLP paths erases early recovery.
  • Closed-form edit in 2 seconds: ROME inserts one key-value pair into a mid-layer MLP weight matrix (layer 18 in GPT-2 XL) via a rank-one update in ~2 seconds on an A6000 GPU, with no hypernetwork pretraining.
  • Generalization and specificity together: On the 21,919-record COUNTERFACT benchmark, ROME reaches harmonic score 89.2 on GPT-2 XL (1.5B) and 91.5 on GPT-J (6B), where fine-tuning and hypernetworks either fail paraphrases or corrupt nearby subjects.
Causal tracing separates factual lookup from final-token routing
1. Paired intervention
Run clean, add 3-sigma Gaussian noise to subject tokens, then restore one state at a time.
Indirect Effect (IE = P_restored - P_*)
Measures how much restoring a single clean activation recovers the true answer while the subject stays noisy (27.0% clean vs. 8.47% corrupted baseline).
2. Early site (recall)
Last token of the subject name across middle transformer layers.
Mid-layer MLPs map subject to attributes
Single hidden state peaks at layer 15 (8.7% AIE); 10-layer MLP window peaks at layer 17 (6.6% AIE vs. 1.6% for attention). Freezing MLPs breaks early recovery.
3. Late site (copying)
Final prompt token across upper transformer layers right before decoding.
Upper-layer attention reads out the word
Attention 10-layer window peaks at layer 32 (restoring average probability to 16.5%), copying recalled attributes forward to predict the object token.

Measurements on GPT-2 XL (48 layers, 1.5B parameters) over 1,000 facts from Meng et al. (2022), Section 2 and Appendix B.

Causal tracing isolates factual recall from word prediction

Representing a fact as (s, r, o) (subject, relation, object) and prompting GPT with "The Space Needle is in downtown" exposes a core puzzle in transformer residual stream circuits. Information flows forward via attention and vertically via MLPs and attention, so any late hidden state at the final token trivially decides the next word without revealing where the fact is stored.

Earlier tools failed to isolate that storage site cleanly:

  • Linear probes show where a property can be decoded, not whether downstream layers use it.
  • Integrated Gradients (IG) (50-step Gauss-Legendre quadrature) yields scattered saliency maps that miss both the last-subject-token spike and the MLP split.
  • Direct causal effects (unmediated paths) proved too noisy to interpret.

Causal tracing adapts Pearl’s causal mediation analysis into a three-run activation-patching protocol. A clean run records hidden vectors h_i^(l) on the factual prompt, where GPT-2 XL assigns an average 27.0% probability to the true object across 1,000 sampled prompts. A corrupted run adds spherical Gaussian noise (3x empirical embedding standard deviation) to subject embeddings, dropping true-object probability to 8.47%. A corrupted-with-restoration run patches one clean activation back at token i and layer l and lets the rest of the network run normally.

Across 1,000 statements, two hot spots appear. Restoring late states at the final token recovers the output as expected. The discovery is an early peak in middle layers at the last token of the subject name, where restoring layer 15 lifts probability to 15.0% on average (8.7% AIE; 19.5% at each prompt’s peak layer). To verify MLPs compute this information rather than forwarding it, the authors froze MLP outputs at corrupted values while restoring h_i^(l) (an early form of path patching). Severing MLPs wipes out early-layer recovery while upper-layer states retain theirs, proving mid-layer MLPs inject recalled attributes before upper-layer attention copies them to the output.

This split holds across GPT-2 Medium (345M), GPT-2 Large (774M), GPT-2 XL (1.5B), GPT-J (6B, 28 layers), and GPT-NeoX (20B, 44 layers), as well as multivariate Gaussian noise, uniform noise, and corrupting an extra post-subject token. Later work on activation patching metrics and corruptions highlighted how noise choices alter localization, making these cross-corruption checks essential.

How ROME turns an MLP layer into a closed-form key-value write

To test whether a mid-layer MLP weight matrix truly operates as a key-value store, Rank-One Model Editing (ROME) models the output projection W_proj^(l) as a linear associative memory (W K ≈ V).

In each MLP block, W_proj^(l) * sigma(W_fc^(l) * gamma(a_i^(l) + h_i^(l-1))) maps post-nonlinearity key vectors k to residual value vectors v. Inserting (k_*, v_*) while minimizing squared distortion ||W_hat K - V||_F^2 over existing keys yields a closed-form Lagrangian update:

W_hat = W + Lambda * (C^(-1) * k_*)^T, where Lambda = (v_* - W k_*) / ((C^(-1) * k_*)^T * k_*).

Here C = K K^T is the uncentered covariance of MLP keys pre-cached from 100,000 Wikipedia token activations in float32. Each edit runs in three steps (~2 seconds on an A6000 GPU for GPT-2 XL):

  1. Select k_*: Pass 20 short random prefix contexts (xj + s, ten length-5 and ten length-10) ending with the subject and average the post-nonlinearity vector at layer l_* (layer 18 in GPT-2 XL) on the last subject token. Dropping random prefixes lowers COUNTERFACT score from 89.2 to 86.1.
  2. Optimize v_*: Run up to 20 Adam steps (lr 0.5) to find residual vector z maximizing log P[o_* | xj + p] across random prefixes while minimizing KL divergence (weight 100) on "{subject} is a" to curb essence drift.
  3. Insert (k_*, v_*): Update W_proj^(l*) directly via the closed-form rank-one formula without gradient descent on model weights.

To distinguish deep factual updates from prompt memorization, the authors introduced COUNTERFACT: 21,919 counterfactual records spanning 20,391 subjects, 749 objects, and 645 relations from ParaRel and Wikidata. Unlike zsRE, which checks specificity on random unrelated facts, COUNTERFACT tests 2 paraphrase prompts, 10 neighborhood prompts sharing the same relation and original object (checking if moving the Eiffel Tower moves the Louvre), and 3 generation prompts scored against Wikipedia references for semantic consistency (RS) and n-gram fluency (GE).

Why competing model editors break on COUNTERFACT (GPT-2 XL and GPT-J)
Fine-tuning (FT / FT+L)

Unconstrained FT hits 100% efficacy but wrecks neighbors (NS 10.3% on GPT-J, S = 25.5). Adding an L-inf clamp (FT+L) saves neighbors (NS 78.6%) at the cost of paraphrase generalization (PS 48.7% XL, 30.4% GPT-J).

Hypernetworks & neurons (MEND / KE / KN)

Out-of-the-box MEND and KE score S = 57.9 and 52.2 on XL; retraining on COUNTERFACT raises paraphrase score to 97% but destroys neighborhood specificity (NS 5.5% and 6.9%). KN stalls at S = 35.6.

Rank-one MLP edit (ROME)

Reaches harmonic S = 89.2 on GPT-2 XL (ES 100%, PS 96.4%, NS 75.4%) and S = 91.5 on GPT-J (ES 99.9%, PS 99.1%, NS 78.9%), with top semantic consistency (RS 41.9 / 43.0).

Data from Meng et al. (2022), Table 4 (7,500 records on GPT-2 XL; 2,000 records on GPT-J).

Tracing five edits and edge cases inside GPT

High efficacy numbers alone can hide superficial regurgitation. When the authors intervened on layer-33 attention weights (AttnEdit, Appendix I) instead of layer-18 MLP weights, the edited model completed "The Eiffel Tower is located in Rome" cleanly, yet reverted to "Paris in 1871" the moment the prompt was rephrased. Sweeping ROME across every layer-and-token pair confirms the causal trace prediction: both generalization and specificity peak sharply at middle MLP layers (layer 18) and at the last token of the subject. Switch through the five cases below to see how ROME behaves across generalization, composition, failure modes, and causal-tracing exceptions.

Five behaviors revealed by ROME edits and causal traces

Select a case (or use Left and Right arrow keys) to compare what ROME changes, how competing baselines fail, and where the mechanism breaks.

Pierre Curie: physics rewritten to medicine

Section 3.5 (Fig. 6)

Changing 'Pierre Curie's area of work is medicine' on GPT-2 XL separates true association updates from fragile memorization.

Why baselines break
FT generalizes to Louis Pasteur but leaks into Robert Millikan ('biological aspects'); FT+L and MEND waver back to physics on paraphrases; KE loops 'medicine medicine medicine'.
ROME's behavior
Links Pierre Curie to Joseph Lister and vaccines across indirect prompts while leaving Robert Millikan untouched in astronomy and astrophysics.
Quantitative link
Matches Table 4 on GPT-2 XL: ROME holds 96.4% paraphrase score and 75.4% neighborhood specificity (harmonic S = 89.2).
Why it matters
Proves the edit lives inside the subject's mid-layer representation rather than memorizing one surface token sequence.

Source: Meng et al. (2022), Sections 3.5, Appendices B.4, G, and I.

If you prefer the summary without clicking through the tabs, here are the five behaviors that define ROME’s scope:

  • Generalization without bleedover: On "Pierre Curie -> medicine", ROME transfers across paraphrases (Joseph Lister, vaccines) while leaving Robert Millikan in physics/astronomy, unlike FT, KE, and MEND.
  • Compositional recall: Rewriting "Liberty Island -> Scotland" surfaces unprompted Scottish entities (Loch Lomond, Edinburgh) on indirect generation prompts.
  • Essence drift on smaller models: Without strong capacity or KL regularization, edits can morph a video game (Sonic Drift 2) into "a standard for Microsoft Office", and human raters scored ROME 1.3x less fluent than FT+L even while rating it 1.8x more consistent.
  • Mid-layer MLPs vs. late attention: Editing late attention (AttnEdit) regurgitates on the exact edit sentence and reverts to Paris on paraphrases, confirming late attention reads rather than stores facts.
  • Not every entity peaks on its final token: Multi-word subjects like "Mitsubishi Electric" or "Windows Media Player" fire their decisive lookup on the informative head noun rather than the final token.

Caveats and what came after ROME

Meng et al. are explicit that ROME is a mechanistic probe, not a production knowledge-maintenance pipeline, and four caveats bound what their experiments prove.

First, ROME edits one fact at a time. Sequential edits accumulate interference across the covariance estimate and projection weights; scaling rank-one updates to thousands of simultaneous facts required follow-up work such as MEMIT (also by Meng et al., 2022), which spreads updates across a range of critical MLP layers rather than writing all of them into layer 18.

Second, stored associations are directional. Rewriting "The iconic landmark in Seattle is the Space Needle" does not automatically invert "The Space Needle is the iconic landmark in Seattle", because the lookup key depends on which entity sits in the subject slot. Updating a fact bidirectionally requires separate edits.

Third, edited models still hallucinate confidently. Even when ROME cleanly switches Marián Hossa from hockey to baseball or moves Garth Knox’s birthplace to Frankfurt, the model freely fabricates plausible-sounding falsehoods around the edit (inventing a son named "Basti" or calling Hossa a starting pitcher). On zsRE, custom-trained hypernetworks (MEND-zsRE at 99.3% paraphrase accuracy vs. 88.1% for ROME) still win when given in-distribution training data and evaluated with random-fact specificity rather than targeted neighbors.

Fourth, localization for editing is not uniqueness. The authors conjectured that any middle MLP layer could host a fact equivalently, and later interpretability work using causal scrubbing and transcoders showed that localized rank-one edits can override or bypass a model’s computation without pinning down a single canonical storage slot.

For engineers today, ROME’s lasting contribution is methodological. Correlational probes and gradient saliency maps cannot separate where an intermediate variable sits from what causes the output; paired corruption-and-restoration interventions paired with targeted weight edits remain the cleanest way to verify whether a hypothesized circuit actually implements the behavior you think it does.