Locating and Editing Factual Associations in GPT

Kevin Meng, David Bau, Alex Andonian, Yonatan Belinkov
2/10/2022
cs.CLcs.LG

Official code: kmeng01/rome (785 stars, MIT, PyTorch, last commit 2024-04-20).

Abstract

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/

View on arXivView PDF

Code Implementations(1)

kmeng01/romeOfficial100%
PyTorchMIT

Locating and editing factual associations in GPT (NeurIPS 2022)

785167Shell, PythonFeb 11, 20222 years agoMIT
gptinterpretabilitypytorchtransformers

Similar Papers

Cite this paper

@article{meng2022locating,
  title  = {Locating and Editing Factual Associations in GPT},
  author = {Kevin Meng and David Bau and Alex Andonian and Yonatan Belinkov},
  year   = {2022},
  eprint = {2202.05262},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2202.05262}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2202.05262.svg)](https://codeofpaper.com/paper/2202.05262)

Discussion