GO TO A SECTION

↑ ↓ to navigate · Enter to openExplore all sections →
FDEInterviews logo
NeurIPS 2022

Locating and Editing Factual Associations in GPT

Causal tracing finds facts recalled in middle-layer MLPs at a subject's last token. ROME edits one fact there with a rank-one update, but each related subject it disturbs is a new error.

Breakdown by FDE Interviews · 12 min read · Updated

About the original · 2022
AUTHORS
Meng, Bau, Andonian, Belinkov
FROM
MIT CSAIL, Northeastern University, Technion
PUBLISHED
Feb 2022 · NeurIPS 2022
CITED BY
3,739Semantic Scholar · Nov 2026
IN THIS BREAKDOWN · 10 SECTIONS

You can read 24% of this breakdown.

01

The paper in one minute

The paper asks where a GPT model keeps a fact like "The Space Needle is located in Seattle", and tests the answer by changing the fact.

The first tool is causal tracing. Run the model three times on a factual prompt. In the clean run it predicts the right object. In the corrupted run, noise is added to the embeddings of the subject's tokens so the model loses track of the subject. In the restored run, the subject stays corrupted, but one internal state is put back to its clean value. If restoring that state brings back the right answer, the state carries information the prediction needs. Averaged over 1,000 facts in GPT-2 XL, two sites stand out: MLP layers in the middle of the network at the subject's last token (the "early site"), and attention at the last token of the prompt (the "late site").

From this the authors propose that middle-layer MLPs act as key-value memories: the subject's representation is the key and the MLP's output adds properties of the subject.

The second tool tests that idea by editing. ROME (Rank-One Model Editing) picks one middle-layer MLP and computes a key for the subject and a value that makes the model predict a new object. It then updates the MLP's output matrix with a closed-form rank-one change that maps the new key to the new value while disturbing the stored keys as little as possible.

On a standard question-answering edit benchmark ROME matches methods trained for editing. On COUNTERFACT, a new set of 21,919 counterfactual edits ("Pierre Curie's area of work is medicine"), ROME is the only method that changes the fact, generalizes it to paraphrases and leaves nearby subjects mostly untouched. The authors present ROME as a tool for understanding, not for large-scale model updates.

THE IDEA, VISUALLY
WHERE THE FACT IS RECALLED (SCHEMATIC, SEC. 2) The Space Need le is in downtown layers 0 -> 47 Early site: MLPs in middle layers at the subject's last token ('le'). Strongest single state: layer 15, 8.7% of an 18.6% total effect; MLP up to 6.6%, attention there only 1.6%. Late site: attention at the last token copies the recalled property to the prediction ('Seattle'). arXiv 2202.05262, MIT, Northeastern, Technion EDITING 7,500 COUNTERFACTUAL FACTS, GPT-2 XL (TABLE 4) unedited 22 25 78 S 30.5 fine-tune 100 88 40 S 65.1 FT+L 99 49 70 S 66.9 MEND 99 65 38 S 57.9 ROME 100 96 75 S 89.2 efficacy paraphrase neighbors kept under 50 S = harmonic mean of the three. Fine-tuning edits the fact and breaks most neighbors; ROME keeps all three high.
Left: where causal tracing locates fact recall in GPT-2 XL, averaged over 1,000 facts (Section 2.2): an early site in middle-layer MLPs at the subject's last token and a late site in attention at the prompt's last token. Right: editing scores on 7,500 COUNTERFACT records (Table 4): efficacy, paraphrase and neighborhood scores for four editors and the unedited model. Only ROME keeps all three high; fine-tuning edits the fact and breaks most neighbors.
Research notes: the problem, approach and results
89.2

ROME's score on COUNTERFACT for GPT-2 XL, the harmonic mean of efficacy, paraphrase and neighborhood scores; fine-tuning scores 65.1 (Table 4)

8.7%

average indirect effect of the single strongest hidden state, at layer 15 of 48, out of an 18.6% total effect (Section 2.2)

78.1 -> 75.4

neighborhood score before and after ROME edits: 3.5% of the neighbors the model got right are disturbed (our calculation)

THE PROBLEM

Language models store facts such as where the Space Needle is, but it is unclear where those facts live inside the network. If facts are localized, they could be read, audited and corrected directly instead of retraining the model.

THE IDEA

Causal tracing: corrupt the subject's tokens, then restore one hidden state at a time and see which states bring back the right answer. Then test the finding by editing: treat a middle-layer MLP as a key-value memory and insert a new fact with a closed-form rank-one update (ROME).

THE RESULT

In GPT-2 XL, middle-layer MLP states at the last subject token carry much of the fact. ROME edits a fact with near-100% efficacy, 96% paraphrase generalization and 75% neighborhood specificity on 7,500 counterfactual records, the only method tested that keeps all three high.

02

Why it matters to an FDE

When a customer asks "can you just fix that fact in the model?" This paper is the clearest evidence that you can, for one fact, with a small targeted change. It also shows what the fix costs: nearby subjects can be dragged along, and the edit only works in one direction ("the Space Needle is in Paris" does not make the model say "Paris's landmark is the Space Needle").

Prefer retrieval for facts that change. Prices, policies, people in roles and product details change on a schedule. Retrieval updates them by updating a document. Editing weights is better reserved for persistent wrong beliefs that keep leaking past retrieval, and even then a test suite has to come with it.

Test the neighborhood, not just the edit. The edit's own prompt always works; that is what the optimization targets. The question is what else moved. ROME's paper measures neighbors (similar subjects that should keep the old fact), and fine-tuning one fact broke most of them. Any edit or targeted fine-tune needs a check on related entities, paraphrases and unrelated facts.

Know what an evaluation's specificity score is sampling. On the older zsRE benchmark, "specificity" barely moved for any method, because its unrelated facts are drawn from everywhere; damage concentrates on neighbors. A good test for a customer edit samples near the edited entity.

Interpretability has practical uses. Causal tracing is a technique you can explain to a customer: corrupt the input, restore one state, and see whether the answer comes back. It is a reasonable way to show where a model's behavior comes from before deciding how to change it.

THE FULL BREAKDOWN

Understand the mechanism. Try it on a real problem.

Unlock this breakdown and 290 more papers.

Premium opens every paper in full, plus every answer, concept, course and guide on the site. One payment for six months of access.

6 months · One payment · No auto-renewal

Get Premium · ₹2,000 / $25
  • ◇1 architecture diagram
  • </>1 runnable code experiment
  • ▦2 results tables
  • ?5 interview questions with answers
  1. 03Key takeaways

    Tracing results, the key-value view, ROME's update, scores on two benchmarks, two misreadings

    Free account
  2. 04How it works

    The three tracing runs, the key-value view of an MLP, choosing k* and v*, and the evaluations

    Premium
  3. 05The numbers that matter

    Tracing effects, zsRE, COUNTERFACT scores by editor, GPT-J, layer sweep and human ratings

    Premium
  4. 06Try it yourself

    Run ROME's closed form on a small linear memory, rebuild Score S, read the specificity baselines

    Premium
  5. 07Where it breaks

    One fact, one direction, neighbor damage, fluency loss, and a localization claim later qualified

    Premium
  6. 08Using it on a deployment

    When to edit weights, when to retrieve, and the regression suite any edit needs

    Premium
  7. 09Interview angles

    Five questions this paper prepares you for, with answer hints

    Premium
Back to the paper library →