PMET: Precise Model Editing in a Transformer

Xiaopeng Li, Shasha Li, Shezheng Song, Jing Yang, Jun Ma, Jie Yu · DOI

Abstract

Large Language Models (LLMs) often suffer from hallucinations and outdated knowledge. While traditional fine-tuning can address these issues, it is computationally expensive and risks catastrophic forgetting. This paper introduces PMET (Precise Model Editing in a Transformer), a novel "locate-and-edit" approach that achieves state-of-the-art performance by decoupling factual knowledge in Feed-Forward Networks (FFNs) from extraction patterns in Multi-Head Self-Attention (MHSA). By optimizing both components but updating only FFN weights, PMET ensures surgical precision in model updates.

Introduction

The rapid evolution of information makes keeping LLMs up-to-date a significant challenge. Existing "Locate-and-Edit" methods, such as ROME and MEMIT, treat Transformer layers as key-value memories. However, these methods often fail to account for the heterogeneous nature of information within a Transformer's hidden state, which combines signals from MHSA, FFN, and residual connections. PMET addresses this by recognizing the functional specialization of these components.

Problem Statement: The "Hidden State Soup"

Current state-of-the-art editing methods optimize a layer's hidden state to represent a new fact and then update weights to memorize that state. The fundamental flaw identified by the authors is that the hidden state is a mixture of information. Forcing FFN weights to account for signals that belong to the attention mechanism leads to imprecise edits, lower success rates, and poor generalization.

Methodology

PMET introduces two primary innovations to refine the editing process:

1. Dual Optimization, Single Update

PMET calculates separate adjustment parameters for both MHSA and FFN hidden states during the optimization phase. This "Dual Optimization" provides more flexibility to find an accurate representation of new knowledge. Crucially, only the FFN weights are updated, preserving the general extraction patterns encoded in the MHSA.

Comparison between previous optimization-based methods and the proposed PMET method.

2. Square-Root Residual Propagation

For mass editing across multiple layers, PMET employs a square-root distribution ($1/\sqrt{L-l+1}$) to spread the edit "error." This approach conveys more precise information to critical layers compared to the even distribution used in previous methods like MEMIT.

Experimental Evaluation

The authors evaluated PMET on GPT-J (6B) and GPT-NeoX (20B) using two benchmarks:

  • zsRE (Zero-Shot Relation Extraction): Evaluates factual accuracy post-edit.
  • COUNTERFACT: Tests the model's ability to learn counterintuitive facts, preventing reliance on pre-existing knowledge.

Key Results

PMET established new benchmarks for reliability and generalization. On the 10K counterfactual edit task for GPT-J, PMET achieved a score of 86.2 and a generalization rate of 92.8%, significantly outperforming MEMIT.

Performance comparison of PMET against state-of-the-art editors on GPT-J (6B) and GPT-NeoX (20B).

The results demonstrate that PMET scales effectively to larger models like GPT-NeoX (20B), maintaining a performance lead over existing methods. Ablation studies confirmed that the Dual Optimization component is the primary driver of these improvements.

Discussion and Limitations

While PMET excels in reliability and generalization, it faces a slight "specificity tax." The more precise and aggressive weight updates can occasionally lead to "leakage," affecting unrelated facts. Furthermore, while the model learns new facts successfully, its ability to perform complex logical inference based on those edited facts remains a challenge for future research.

Conclusion

PMET represents a significant advancement in model editing by leveraging the functional specialization of Transformer components. By isolating factual storage from extraction logic, it provides a more precise and scalable way to update the knowledge of Large Language Models.

Summary updated

BibTeX
@inproceedings{li2024pmet,
  author = {Xiaopeng Li and Shasha Li and Shezheng Song and Jing Yang and Jun Ma and Jie Yu},
  title = {{PMET: Precise Model Editing in a Transformer}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  doi = {10.1609/aaai.v38i17.29818},
}
Figure