Introduction
Large Language Models (LLMs) often struggle with factual grounding, frequently acting as "stochastic parrots" that lack a reliable internal database. Updating their knowledge base is a significant challenge, typically plagued by catastrophic forgetting—where new updates break existing knowledge—and cross-lingual inconsistency, where a fact updated in one language (e.g., English) remains incorrect in another (e.g., Catalan). While existing state-of-the-art methods like MEMIT focus on modifying Multi-Layer Perceptron (MLP) blocks, they often result in low confidence scores and poor cross-lingual transfer. This paper introduces MEMAT (Mass-Editing Memory with Attention in Transformers), a novel framework that supplements MLP editing with surgical adjustments to specific "truth-seeking" attention heads.
The MEMAT Framework
MEMAT builds upon the MEMIT architecture by adding a secondary intervention layer focused on the transformer's attention mechanism. The process follows three primary steps:
- MLP Editing: Standard mass-editing of MLP weights to incorporate new factual triplets.
- Locating Truthful Heads: Researchers identified specific attention heads that are highly sensitive to the truthfulness of statements. By training simple classifiers, they found that certain heads consistently achieve ~80% accuracy in distinguishing true facts from false ones.
- Attention Head Correction: MEMAT introduces optimized corrections to the top $K$ performing heads. This optimization balances maximizing the probability of the new target fact while minimizing changes to original values and preserving general language capabilities via KL divergence.
Attention as a Truth-Filter
A key insight of this work is that while MLPs may store factual data, attention heads act as a retrieval mechanism or "truth-filter." As shown in the heatmaps above, these heads are remarkably consistent across languages. This suggests that these heads encode a general "truth-telling" behavior rather than language-specific data, making the corrections highly portable across different sets of facts.
Cross-Lingual Performance and the Tokenization Bottleneck
To test cross-lingual robustness, the authors developed Catalan CounterFact, a translated version of the standard benchmark. Experiments on the Aguila-7B model revealed that cross-lingual success is heavily dependent on subject tokenization. When a subject (e.g., "Google") is tokenized identically across languages, knowledge transfer is seamless. However, when tokenization differs significantly (Jaccard index $\leq$ 0.5), performance drops.
Key Results
- Magnitude and Confidence: MEMAT achieved a 10% increase in magnitude metrics (the probability gap between correct and incorrect answers) over the MEMIT baseline.
- Generalization: The model showed superior performance in paraphrase tests, indicating it learned underlying concepts rather than just memorizing strings.
- Efficiency: The attention head correction phase is highly efficient, requiring only 25 GPU minutes to supplement a 3-hour mass-edit of 1,000 facts.
- Robustness: MEMAT improved performance even in languages not used during the specific head-correction training phase.
Limitations and Future Work
While effective, MEMAT's performance begins to degrade as the number of edited associations approaches 10,000. Furthermore, the study focused on English and Catalan; results may vary for language pairs with different scripts (e.g., English and Chinese). Future research will explore the role of other architectural components, such as LayerNorm, and address the ongoing challenge of "bidirectionality" in knowledge editing (e.g., ensuring the model understands that if A is B's father, B is A's child).
Summary updated