← hub

Model Editing (ROME / MEMIT)

A closed-form least-squares solve overwrites the MLP weight matrix that causal tracing locates for one fact, skipping gradient descent entirely.
lane: weight loop · arXiv:2202.05262 (ROME) — NeurIPS 2022 — Meng, Bau, Andonian, Belinkov (MIT/Technion/Northeastern); arXiv:2210.07229 (MEMIT) — ICLR 2023 — Meng, Sharma, Andonian, Belinkov, Bau; arXiv:2401.07453 (catastrophic forgetting) — ACL 2024 Findings — Gupta, Rao, Anumanchipalli (UC Berkeley); arXiv:2307.12976 (RippleEdits) — TACL 2024 — Cohen, Biran, Yoran, Globerson, Geva

What's peculiar

Component: Closed-form fact overwrite
slot: Fitter · combine with: nothing; use retrieval past the limit

Gives. One linear solve writes a fact into a located MLP matrix; thousands of facts in one pass, no training.
Needs. Causal tracing to find the layer; fewer than about 1,000 edits on GPT-J.
Breaks. GLUE collapses to zero between about 100 and 1,500 edits; no readable diff.

Orthogonal component

Every other approach on this hub fits parameters by gradient descent, least squares against a residual, or an evaluator score fed back into a discrete search. ROME and MEMIT fit nothing. They solve a closed-form linear system once and write the answer directly into the weight matrix. The method treats a transformer's mid-layer MLP as an associative key-value memory, where the key is the subject representation and the value is the object representation. It inverts a covariance-regularized normal equation to insert one new key-value pair without disturbing old ones on average. There is no training loop at all. "Learning" a new fact is one matrix-algebra step. The entire contribution of the two papers is finding which single matrix, at which layer, this works on (ar5iv.labs.arxiv.org/html/2202.05262 Sec. 2.2, 3.1).

Mechanism

1. Locate (ROME, Sec. 2.2, Fig. 2): causal tracing corrupts the subject tokens' embeddings, then restores individual hidden states one at a time to measure each one's indirect effect on the correct prediction. For GPT-2 XL this isolates a peak average indirect effect (8.7%) at the last subject token in a middle layer (layer 15). MLP modules dominate that site. 2. Fit, single fact (ROME, Eq. 2-4, App. A): ROME updates the targeted MLP's output-projection matrix W as Ŵ = W + Λ(C⁻¹k*)ᵗ. Here k* is the averaged post-nonlinearity subject activation, and C = KKᵗ is a covariance statistic pre-computed from Wikipedia text. ROME chooses Λ so the new value vector v*, optimized with a KL term that preserves the subject's other properties, replaces the old value while minimally perturbing other keys. 3. Fit, many facts (MEMIT, Sec. 4.1-4.3, Eq. 9-20, Alg. 1): MEMIT generalizes ROME's rank-one solve to a batch normal equation, Δ = R Kᵗ(C₀ + K₁K₁ᵗ)⁻¹, and spreads the edit across a range of MLP layers instead of one — ℛ = {3,...,8} for GPT-J, {6,...,10} for GPT-NeoX. It optimizes one target vector at the deepest layer in ℛ, then splits the residual evenly across the shallower layers. MEMIT reprocesses activations after each layer update, because earlier edits change what later layers see. 4. Judge or keep: there is no evaluator in the usual sense. The team checks correctness post hoc on held-out efficacy, paraphrase, specificity, and fluency metrics from CounterFact and zsRE, not during the solve. Nothing persists across edits except the mutated weight matrix itself. Each new edit solves its normal equation against the already-edited weights, so edits compound.

Where the gradient stops

Nothing here is a gradient step. The entire operation is a closed-form linear-algebra solve, a matrix inversion treated as exact. The fitting is least-squares in closed form, not iterative optimization. The only step resembling search is the one-time causal-tracing sweep that locates which layer or layers to target, a discrete choice made once per model family, not per edit. Every edit after that is a direct, non-iterative overwrite of specific weight entries. That is why no mechanism re-checks an edit's compatibility with the rest of the network before committing it.

Data regime and scaling trade-off

The method needs no training data beyond a single subject-relation-object triple per edit, plus a pre-computed covariance statistic over ordinary text. A gradient-trained model needs thousands of examples per behavior change; ROME and MEMIT insert one fact in milliseconds without a fine-tuning run. The trade-off: the technique has no notion of how many edits a given layer's weight matrix can absorb. MEMIT's own scaling figure (Fig. 5) only goes to 10,000 edits as a design target. Gupta et al. (2024) show that beyond some edit count, ranging 100 to 4,000 depending on model and method, the compounding solves destroy the layer entirely (ar5iv.labs.arxiv.org/html/2401.07453 Sec. 3.4, Fig. 2d/3d).

Validated usefulness

On CounterFact with GPT-2 XL, ROME scores efficacy 100.0, paraphrase 96.4, neighborhood-specificity 75.4, and aggregate 89.2, versus fine-tuning's 65.1 and MEND's 57.9 (arXiv:2202.05262 Table 4). On CounterFact with GPT-J at 10,000 edits, MEMIT scores efficacy 98.9, generalization 88.6, specificity 73.7, fluency 619.9, and aggregate 85.8, against an unedited-model specificity baseline of 83.5 (arXiv:2210.07229 Table 2). MEMIT holds most of its specificity even after 10,000 edits. MEMIT's demonstration task raised star-constellation fact accuracy from 53% to 86% over 289 facts (App. E).

Where it failed or broke

1. Catastrophic forgetting (Gupta et al. 2024): sequential editing on CounterFact shows a two-stage failure, a gradual decline in downstream GLUE F1 on SST-2, MRPC, NLI, and CoLA, then a sudden collapse to zero. ROME's catastrophic point lands anywhere from about 100 edits, in one sample, to about 1,000 edits, in another sample, on GPT-J. MEMIT survives longer: collapse begins around 1,400 to 1,500 edits on GPT-J and about 4,000 on GPT2-XL, but it still collapses (Sec. 3, 4, Fig. 1d, 3b, App. A.4.2). The authors attribute this to the edited layer's weight norm, measured as normalized L2 distance, drifting until it becomes incompatible with the rest of the network (Sec. 3.4, 6). A single disabling edit at the start of a sequence produces a distance roughly 3 orders of magnitude larger than a normal edit's (Table 2). The authors call this a fundamental limitation of ROME's single-layer design, not an artifact of accumulation. 2. Ripple effects not captured (Cohen et al. 2023): across GPT-2, GPT-J, GPT-Neo, and LLaMA, ROME and MEMIT's ripple-test accuracy on RippleEdits averages only 50 to 63%, versus in-context editing's 75-84% on the same models. The single worst cell, GPT-J ROME on Logical Generalization, Popular subset, is 5.5% (Table 5, Sec. 5.2). The edit updates the fact asked for but not the implied facts that logically follow from it. Editing a person's country of citizenship, for example, does not propagate to the continent they live on. 3. Degraded fluency and specificity under scale (MEMIT ablations): late-layer-only or single-layer variants score worse than the multi-layer default (App. F.1, Fig. 11). Attention-module edits score considerably worse than MLP edits (F.2, Fig. 12). Fine-tuning baselines, FT-W, reach high efficacy at 99.4, but generation entropy collapses to 293.9, which the authors call "significant model damage" (Sec. 5.2.2, Table 2). 4. No handling of symmetric, spatial, or temporal knowledge: both ROME's and MEMIT's own limitations sections state the method only edits directional subject-relation-object triples (ROME Sec. 3.7/5; MEMIT Sec. 6). Reversing an edited fact needs a second, separate edit, and non-relational knowledge types are out of scope entirely.

Lineage

ROME is the foundational single-fact, single-layer method. MEMIT is explicitly ROME's follow-up, cited in ROME's own limitations section, and it generalizes ROME's rank-one update to a batch of edits spread across several layers. RippleEdits and the catastrophic-forgetting paper are both stress tests built specifically against ROME and MEMIT's claims, using the same CounterFact benchmark the original papers introduced. GRACE and later locate-then-edit variants continue the "find the layer, write the weight" lineage, though this session did not independently verify that claim. The forgetting result is cited across later continual-learning-for-LLMs surveys as the canonical example of why direct weight edits are unauditable and fragile compared to a readable program diff. The sources are arXiv:2404.16789, 2405.18653, and 2506.13045, found via /home/node/tmp/diffprog-scout.md; this session did not independently re-verify them.

Sources

Verified: WebFetch on https://ar5iv.labs.arxiv.org/html/2202.05262 (Sec. 2-3, 5, Table 4, Eq. 2-4), https://ar5iv.labs.arxiv.org/html/2210.07229 (Sec. 4-6, Table 1-2, Fig. 5-7, App. B.4/F), https://ar5iv.labs.arxiv.org/html/2401.07453 (Sec. 2-4, 6-7, Fig. 1-3, Table 2, App. A), https://ar5iv.labs.arxiv.org/html/2307.12976 (Sec. 1, 3, 4.2, 5.2, Table 1-6); WebSearch to locate all four. · code: https://rome.baulab.info (ROME), https://memit.baulab.info (MEMIT), https://github.com/edenbiran/RippleEdits