Edit one fact. What else changes?
Four studies on what happens when you change a fact inside a language model.
By Wanli Yang, Fei Sun & collaborators
Mara lives in
Which country does Mara live in?
The Butterfly Effect of Model Editing
We used an editing method called ROME to update GPT-J on who acquired Twitter. Asked to tell a story, the model now produced a string of brackets. On a separate test, its accuracy at predicting the last word of a passage fell from 61.36% to zero.
To find other failures, we measured how well each edited model predicted words in ordinary text. A sharp rise in perplexity signaled trouble. When we tested the 30 GPT-J edits with the highest perplexity, their average accuracy was close to chance on all three tasks above. Fig. 2
Which edits expose the damage?
Two copies of Llama 2 7B each received 107 edits using ROME. On the word-prediction task, accuracy stayed near its original level after randomly sampled edits. After edits drawn from known failure cases, it fell to zero.
| Task | Before editing | After random edits | After difficult edits |
|---|---|---|---|
| Predict the last wordLAMBADA | 68.14% | 67.26% | 0.00% |
| Choose a plausible continuationHellaSwag | 57.06% | 56.59% | 26.09% |
| Choose a workable physical solutionPIQA | 78.45% | 77.97% | 53.97% |
The Fall of ROME
ROME sometimes made a very large change to the model’s weights when updating a single fact. The cause was a mismatch between two representations of the same subject. Fixing that mismatch restored ordinary text prediction. Could the model also recall the new fact?
Why does it matter where “Paris” appears?
ROME edits a fact by changing how the model responds to its subject. The model represents the subject with a list of numbers called a key. The words before “Paris” can change its key.
The ROME code mixed that average with the key computed without a prefix. When the two differed sharply, the formula could divide by a number close to zero. A single edit could then change the model’s weights enough to disrupt ordinary text generation. C-ROME used the same averaged key throughout the calculation. Equation 3 and its implementation (§3.1)
Nearly every GPT-J and GPT-2-XL collapse case began with a single-token subject. In GPT-2-XL, moving the subject later in the prompt made its key resemble those from ordinary edits. Figure 3
Why Llama 2 differed remains open. Llama 2 inserts a special token before the subject. All 21 of its HardCF cases had names ending in a period, such as “Joe Garagiola Sr.” In four other models, the same edits barely changed perplexity. Collapse after a sequence of edits remains a separate open question. Table 3 · Limitations
The Mirage of Model Editing
How much of a correct answer did the model produce on its own? Some editing tests give it words from the reference answer as it goes. We built QAEdit from questions each model had previously missed, then used WILD to score what the edited model generated on its own.
How much does the test change the score?
- Synthetic test
- 96.8%The model gets the correct words so far. The test scores its next token (a word or part of one).
- WILD test
- 38.5%The model writes its own answer. A judge scores the complete response.
Who wrote “If I Were a Boy”?
The reference answer is BC Jean and Toby Gad. Both runs begin with “Beyoncé”.
What if the model keeps talking?
One answer started with the expected date, April 1st, then contradicted itself by saying April 2nd. In a separate test of FT-M on Llama-3-8b with 3,000 QAEdit questions, a judge accepted 75.1% of answers cut off at the reference length. When the model chose when to stop, the same judge accepted 52.8%. Tables 6–8
Fine-tuning Done Right in Model Editing
Fine-tuning a model on one fact at a time can undo earlier edits. LocFT-BF revisits facts in batches and changes only selected weights. In the largest experiment it handled 100,000 edits, though it answered the original questions much more reliably than paraphrases.
When to revisit a fact
We tested two training schedules on the same 1,000 ZsRE edits using FT-M on Llama-3-8B-Instruct. Finishing one fact at a time let earlier edits fade. The model scored 75.3% on the original questions. Revisiting every fact on each pass raised that score to 99.7%. Table 1 & Fig. 3
Depth-first
Repeat one fact before moving on.
Breadth-first
Visit every fact once per pass, then reshuffle.
How many facts per update?
With one fact per update, breadth-first training cut the model’s score on five general tasks from 57.26% to 39.3%. We tried batches of 1 to 64 examples. Larger batches preserved more of these skills, though scores on rephrased questions dipped slightly for FT-M and more for AdaLoRA. Fig. 4 · Unedited baseline
Which weights should change?
We tried five targets per layer on Llama-3-8B, from the entire layer down to one matrix in its feed-forward network. Across 160 trials on 1,000 edits, broader updates tended to handle rephrasing better. We chose targets that preserved more of the model’s ability to do math, translate, and answer questions across subjects. Fig. 5 & Table 2