The Fall of ROME: Understanding the Collapse of LLMs in Model Editing

Wanli Yang, Fei Sun, Jiajun Tan, Xinyu Ma, Du Su, Dawei Yin, Huawei Shen

Abstract

Despite significant progress in model editing methods, their application in real-world scenarios remains challenging as they often cause large language models (LLMs) to collapse. Among them, ROME is particularly concerning, as it could disrupt LLMs with only a single edit. In this paper, we study the root causes of such collapse. Through extensive analysis, we identify two primary factors that contribute to the collapse: i) inconsistent handling of prefixed and unprefixed keys in the parameter update equation may result in very small denominators, causing excessively large parameter updates; ii) the subject of collapse cases is usually the first token, whose unprefixed key distribution significantly differs from the prefixed key distribution in autoregressive transformers, causing the aforementioned issue to materialize. To validate our findings, we propose a simple yet effective approach: uniformly using prefixed keys during editing phase and adding prefixes during testing phase to ensure the consistency between training and testing. The experimental results show that the proposed solution can prevent model collapse while maintaining the effectiveness of the edits.

Introduction

Model editing offers a "surgical" alternative to retraining, allowing developers to update specific facts within a pre-trained Large Language Model (LLM). One of the most prominent techniques is Rank-One Model Editing (ROME), which treats the MLP layers of a transformer as a linear associative memory. However, ROME suffers from a catastrophic failure mode: occasionally, a single edit causes the model to "collapse," resulting in skyrocketing perplexity and the generation of gibberish. This study investigates the mathematical and architectural reasons behind this instability.

The ROME Framework and the Mechanics of Collapse

ROME performs updates by calculating a weight update matrix $\Delta$ to insert a new fact into the model's MLP layers. The process involves identifying a "key" vector representing the subject and a "value" vector for the new relation.

The ROME editing process and the parameter update equation used to modify MLP weights.

As shown in Figure 1, the researchers performed a forensic analysis of the ROME update equation. They discovered that in collapse cases, the denominator of the update term becomes anomalously small—often two orders of magnitude smaller than in successful edits. This leads to an "exploding" parameter update that shatters the model's weights. The root of this numerical instability lies in an inconsistency: the standard ROME implementation uses a "prefixed key" (averaged over various contexts) and an "unprefixed key" (the raw subject) within the same equation.

The First Token Curse

The study identifies that collapse cases are predominantly triggered when the subject of the edit is the first token of a prompt. In autoregressive models like GPT, the first token cannot attend to any prior context, causing its internal representation to be "concentrated" and fundamentally different from tokens appearing later in a sequence.

t-SNE visualization of key distributions, showing the divergence of unprefixed keys in collapse cases.

As shown in the t-SNE visualization (Figure 2), the unprefixed keys ($k^u$) for collapse cases diverge wildly from the normal distribution. This spatial divergence, combined with the mathematical inconsistency in the update equation, creates the "denominator trap" that triggers model failure. Interestingly, modern models like Llama 2 and Mistral often avoid this by accident because their tokenizers automatically prepend a "Start of Sentence" (<s>) token, shielding the actual subject from the first-token anomaly.

Proposed Solution: Consistent ROME (C-ROME)

To address these issues, the authors propose Consistent-ROME (C-ROME). This method ensures that the same prefixed key is used throughout the update mathematics, eliminating the denominator instability. To maintain this consistency during inference, they also suggest adding random text prefixes to prompts, ensuring the subject never occupies the problematic first-token position.

Key Results

The researchers evaluated C-ROME across several benchmarks, including COUNTERFACT and HardCF (a subset prone to collapse), using models such as GPT-2-XL, GPT-J, Llama2-7b, and Mistral-7b.

  • Collapse Prevention: C-ROME successfully reduced maximum perplexity in collapse cases for GPT-2-XL from ~26,000 to ~70, effectively preventing model failure.
  • Restoring Efficacy: By combining consistent key usage with random prefixing during testing, the authors achieved 100% editing efficacy on previously problematic cases in GPT-2-XL and GPT-J.
  • Generality: The findings were consistent across multiple architectures, proving that the "first token" issue is a general property of autoregressive LLMs.

Conclusion and Future Work

The "Fall of ROME" is not a failure of the associative memory concept, but rather a consequence of architectural quirks in autoregressive transformers. While C-ROME provides a robust fix for single-edit collapses, future work is needed to address "death by a thousand cuts"—the cumulative collapse that can occur after many sequential edits. Additionally, the exact mechanism causing the first token's representation to shrink in middle layers remains an open question for further research.

Summary updated

BibTeX
@inproceedings{yang2024fall,
  author = {Wanli Yang and Fei Sun and Jiajun Tan and Xinyu Ma and Du Su and Dawei Yin and Huawei Shen},
  title = {{The Fall of ROME: Understanding the Collapse of LLMs in Model Editing}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  url = {https://openreview.net/forum?id=k1dnx7dyCE},
}
Figure