Papers › Locating and Editing Factual Associations in GPT

Locating and Editing Factual Associations in GPT

10 Feb 2022arXiv:2202.05262archive 2025-07-28

Kevin Meng, David Bau, Alex Andonian, Yonatan Belinkov

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/

PaperPDFCodeCode Syntology ran

In Syntology View this paper on Syntology: its repositories, every harvested function with whether it ran, its licence and the call to fetch it.

Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2202.05262")

Code

Syntology Ran 4 of 15 code samples harvested from 3 repositories linked to this paper; 11 have no recorded run. Of those that ran: 2 ran · fixture could not drive it; 2 ran with no contract checked.

By repository: official repository: 1 sample from 1 repository, 1 ran; community (archive-listed): 12 samples from 1 repository, 2 ran; found in paper text by Syntology: 2 samples from 1 repository, 1 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

kmeng01/rome officialpytorch report
hiyouga/fastedit mentioned on GitHubpytorch report
keltin13/concept-rot mentioned on GitHubpytorchNOASSERTION report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

15 samples harvested; 4 ran; 0 honoured the contract we drafted; 11 have no recorded run. Read from Syntology's graph 2026-09-25; that is when this build read the record, not when the samples ran.

2ran · fixture could not drive it
2ran
11unverified

Licence: 0 of the 15 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 3 repositories linked to this paper, official or community; each sample names its own and says which. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

upd_matrix_match_shape kmeng01/rome/rome/rome_main.py official repository ran · fixture could not drive it MIT (permissive) · 3a7359734df0b9a0 · report
ROMEHyperParams hiyouga/fastedit/fastedit/rome/rome_main.py community (archive-listed) ran · metamorphic tier: deterministic Apache-2.0 (permissive) · 337cf805ba7488b9 · report
find_fact_lookup_idx hiyouga/fastedit/fastedit/rome/rome_main.py community (archive-listed) ran · fixture could not drive it Apache-2.0 (permissive) · be38085054387516 · report
HyperParams hiyouga/fastedit/fastedit/rome/rome_main.py community (archive-listed) unverified Apache-2.0 (permissive) · b93905c630cab5f8 · report
apply_rome_to_model hiyouga/fastedit/fastedit/rome/rome_main.py community (archive-listed) unverified Apache-2.0 (permissive) · 38ac32a8532239ff · report
compute_u hiyouga/fastedit/fastedit/rome/rome_main.py community (archive-listed) unverified Apache-2.0 (permissive) · 2ab22a551cc021f7 · report
compute_v hiyouga/fastedit/fastedit/rome/rome_main.py community (archive-listed) unverified Apache-2.0 (permissive) · 39f6e26e03a21b1e · report
execute_rome hiyouga/fastedit/fastedit/rome/rome_main.py community (archive-listed) unverified Apache-2.0 (permissive) · 20e375abcab5cc8a · report
get_inv_cov hiyouga/fastedit/fastedit/rome/rome_main.py community (archive-listed) unverified Apache-2.0 (permissive) · 196e16a6fd176c0b · report
get_module_input_output_at_word hiyouga/fastedit/fastedit/rome/rome_main.py community (archive-listed) unverified Apache-2.0 (permissive) · 98f3e85c4a9f9bb3 · report
get_reprs_at_idxs hiyouga/fastedit/fastedit/rome/rome_main.py community (archive-listed) unverified Apache-2.0 (permissive) · 7c626c3970ff2baf · report
get_reprs_at_word_tokens hiyouga/fastedit/fastedit/rome/rome_main.py community (archive-listed) unverified Apache-2.0 (permissive) · 96bd9a8c0145d685 · report
get_words_idxs_in_templates hiyouga/fastedit/fastedit/rome/rome_main.py community (archive-listed) unverified Apache-2.0 (permissive) · 612d15cebbf71774 · report
Patch EleutherAI/knowledge-neurons/knowledge_neurons/patch.py found in paper text by Syntology ran fingerprinted MIT (permissive) · a79ceec9a50ca78f · report
patch_ff_layer EleutherAI/knowledge-neurons/knowledge_neurons/patch.py found in paper text by Syntology unverified MIT (permissive) · 9412d866514a01ef · report

Tasks

Model EditingRelation ExtractionSpecificity

1 archive task tag without a task page not shown.

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Introduced by this paper: ROME

ROME

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections