[Paper Review] Locating and Editing Factual Associations in GPT
The paper shows that factual associations in GPT are stored in mid-layer MLP modules and demonstrates a Rank-One Model Editing (ROME) method to insert new facts by updating a single row of a middle-layer MLP, achieving competitive editing performance with good generalization and specificity.
We analyze the storage and recall of factual associations in autoregressive transformer language models, finding evidence that these associations correspond to localized, directly-editable computations. We first develop a causal intervention for identifying neuron activations that are decisive in a model's factual predictions. This reveals a distinct set of steps in middle-layer feed-forward modules that mediate factual predictions while processing subject tokens. To test our hypothesis that these computations correspond to factual association recall, we modify feed-forward weights to update specific factual associations using Rank-One Model Editing (ROME). We find that ROME is effective on a standard zero-shot relation extraction (zsRE) model-editing task, comparable to existing methods. To perform a more sensitive evaluation, we also evaluate ROME on a new dataset of counterfactual assertions, on which it simultaneously maintains both specificity and generalization, whereas other methods sacrifice one or another. Our results confirm an important role for mid-layer feed-forward modules in storing factual associations and suggest that direct manipulation of computational mechanisms may be a feasible approach for model editing. The code, dataset, visualizations, and an interactive demo notebook are available at https://rome.baulab.info/
Motivation & Objective
- Identify where factual associations are stored in GPT-like autoregressive transformers.
- Develop causal tracing to identify decisive activations involved in factual recall.
- Propose Rank-One Model Editing (ROME) to insert or modify factual associations by updating MLP weights.
- Evaluate ROME on standard and counterfactual editing benchmarks to assess generalization and specificity.
- Compare ROME to existing fine-tuning and hypernetwork editing approaches and analyze robustness.
Proposed method
- Construct a causal mediation framework to quantify the indirect effects of hidden states on factual predictions.
- Identify decisive mid-layer MLP activations that mediate recall at the last subject token.
- Model MLPs as linear associative memories and formulate Rank-One Model Editing (ROME) to insert a new key–value pair by a rank-one update to the MLP projection matrix.
- Compute k* as an averaged MLP activation-based key for the subject at the last token.
- Compute v* by optimizing a vector that maximizes the probability of the desired object while minimizing essence drift via KL constraints.
- Apply the rank-one update to Wproj^(l) as Wproj_hat = Wproj + Lambda (C^{-1} k*)^T, with C = KK^T.
Experimental results
Research questions
- RQ1Can mid-layer feed-forward modules in GPT be identified as the causal locus of factual recall?
- RQ2How can we directly modify a model’s stored facts by editing internal computations rather than weights end-to-end?
- RQ3Does Rank-One Model Editing (ROME) provide effective, generalizable, and specific edits for factual associations compared with existing methods?
- RQ4Can a counterfact dataset reveal the balance between generalization and specificity after edits?
- RQ5Do causal tracing results align with successful ROME edits across layers and tokens?
Key findings
- Causal tracing reveals strong indirect effects at late layers and particularly in mid-layer MLPs at the last subject token.
- MLP contributions dominate at the early site, while attention dominates at the last token of the prompt.
- ROME can insert a new factual association via a single rank-one update with competitive efficacy on zsRE relative to fine-tuning and hypernetwork baselines.
- ROME achieves strong generalization and specificity on CounterFact, outperforming several baselines like FT, FT+L, KE, MEND in balancing these properties.
- Edits are most effective when targeting middle-layer MLPs at the final subject token, with generalization peaking around layer 18 in GPT-2-XL.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.