PMET: Precise Model Editing in a Transformer

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

Introduction

Large Language Models (LLMs) frequently store outdated, biased, or incorrect information. While fine-tuning can rectify these errors, it is computationally expensive and risks "catastrophic forgetting" of unrelated knowledge. Recent model editing techniques, such as ROME and MEMIT, treat Feed-Forward Network (FFN) layers as key-value memories to perform surgical updates. However, these methods typically use the entire hidden state of a Transformer layer to calculate updates. This approach is imprecise because a layer's hidden state is a mixture of signals from Multi-Head Self-Attention (MHSA), the FFN, and residual connections. PMET (Precise Model Editing in a Transformer) addresses this by isolating the specific information required for FFN updates, treating MHSA as a knowledge extractor rather than a storage unit.

Methodology

PMET refines the optimization process used in previous state-of-the-art methods through three key innovations:

  1. Dual Optimization (TC-State Optimization): Instead of optimizing the total Transformer Layer (TL) hidden state, PMET simultaneously optimizes the hidden states of the specific Transformer Components (TC)—both the MHSA and the FFN. This allows the model to find a more precise representation of the target knowledge.
  2. Precise FFN Updates: Although both components are optimized during the search for target values, PMET only uses the optimized FFN hidden state to update the FFN weights. By leaving MHSA weights untouched, the model preserves its general extraction patterns and avoids "polluting" the update with MHSA-specific noise.
  3. Square Root Spread: For mass editing across multiple layers, PMET introduces a "square root spread" ($R^l = \frac{V_1 - W_0K_1}{\sqrt{L-l+1}}$). This mathematical refinement conveys more precise information to critical layers, improving the success rate of simultaneous edits.
Comparison of previous optimization methods vs. PMET's dual-component approach.

Knowledge Extraction vs. Storage

A core insight of PMET is the functional distinction between Transformer components. Post-hoc analysis reveals that MHSA hidden states change unpredictably across layers, acting as a dynamic "extractor" of patterns. Conversely, FFN states stabilize in later layers, serving as the primary "carrier" of factual knowledge. By isolating the FFN's contribution, PMET avoids the "noise" inherent in updating weights based on the combined hidden state.

Experimental Results

The researchers evaluated PMET on the COUNTERFACT and zsRE (Zero-Shot Relation Extraction) benchmarks using GPT-J (6B) and GPT-NeoX (20B). PMET demonstrated superior performance across nearly all metrics:

  • Reliability and Generalization: On the COUNTERFACT dataset with GPT-J, PMET achieved a 99.5% efficacy and 92.8% generalization score, significantly outperforming MEMIT.
  • Mass Editing: In 10,000 simultaneous edits on GPT-NeoX (20B), PMET showed a 3.3% average reliability enhancement over previous state-of-the-art methods.
  • Consistency: PMET improved the model's ability to logically follow through on the implications of edited facts, achieving a consistency score of 40.6 compared to MEMIT's 40.1.
Performance comparison of PMET against state-of-the-art editors on GPT-J and GPT-NeoX.

Discussion and Limitations

While PMET sets a new standard for precision, it faces a slight trade-off in specificity (71.4% vs MEMIT's 73.7% on GPT-J), suggesting that the square root propagation may cause minor "collateral damage" to unrelated facts. Furthermore, while the model can recall edited facts, it still struggles with complex multi-hop reasoning based on those edits. Future work will likely focus on improving this "reasoning gap" and developing more sophisticated evaluation metrics for multi-step logic after model editing.

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