Model Editing with Canonical Examples

John Hewitt, Sarah Li Chen, Lanruo Lora Xie, Edward Adams, Percy Liang, Christopher D. ManningarXiv 2024 · DOI

Introduction

Large Language Models (LLMs) frequently exhibit undesirable behaviors, such as factual hallucinations or ingrained social biases. Correcting these specific issues without retraining the entire model is a significant challenge in AI safety and reliability. This paper introduces a rigorous framework for model editing with canonical examples, enabling targeted fixes using single, simple statements.

The Model Editing Trilemma

Current model editing techniques struggle to balance three competing requirements:

  1. Data Scarcity: Fixing a behavior using only a single "canonical example" (e.g., "The capital of Nauru is Yaren").
  2. Distribution Shift: Ensuring the model generalizes from a simple statement to complex, natural language contexts.
  3. Catastrophic Forgetting: Maintaining the model's overall knowledge without degrading performance on unrelated tasks.
Overview of model editing with canonical examples and out-of-distribution evaluation.

To address this, the authors propose "degradation balls"—a strict constraint where the model's overall loss cannot increase by more than a tiny fraction (e.g., 0.01%), ensuring edits are truly surgical.

Sense Finetuning via the Backpack Architecture

The core innovation lies in the use of the Backpack architecture. Unlike standard Transformers, a Backpack decomposes word meanings into discrete "sense vectors." When predicting the next word, the model weights and sums these vectors.

For a given edit, the researchers identify the most relevant sense vectors (e.g., geographical vectors for a country name) and finetune only those. This additive approach is mathematically cleaner than shifting weights in a dense network. Furthermore, the knowledge from a small Backpack (170M parameters) can be extracted and added to much larger models like GPT-J-6B via logit ensembling, effectively patching them without direct retraining.

Experimental Results

The framework was tested across six diverse datasets: Country-Capital, Company-CEO, Stereoset, Gender Bias, Temporal Entities, and Hard Syntax. Each task included "hard negatives" to test for over-generalization.

Performance comparison across six diverse evaluation datasets showing task success rates relative to model size.

In strict settings, sense finetuning significantly outperformed standard methods. For instance, it achieved a success rate improvement of 4.8%, compared to just 0.3% for the next best method. When patching GPT-J-6B, the logit ensembling method yielded a 4.1% improvement, far exceeding the 1.0% achieved by editing the larger model directly.

Conclusion

Model editing with canonical examples provides a path toward more controllable and reliable LLMs. By leveraging the modularity of the Backpack architecture, researchers can perform surgical interventions that generalize to natural text while preserving the model's core capabilities. This "patching" approach suggests that small, specialized models can play a vital role in correcting the behaviors of massive language models.

Summary updated

BibTeX
@misc{hewitt2024model,
  author = {John Hewitt and Sarah Li Chen and Lanruo Lora Xie and Edward Adams and Percy Liang and Christopher D. Manning},
  title = {{Model Editing with Canonical Examples}},
  year = {2024},
  eprint = {2402.06155},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.06155},
}
Figure