A Survey on Knowledge Editing of Neural Networks

Vittorio Mazzia, Alessandro Pedrani, Andrea Caciolai, Kay Rottmann, Davide BernardiarXiv 2023

TL;DR

This survey formalizes the emerging field of Knowledge Editing, which aims to surgically update specific facts or behaviors in pre-trained neural networks without the massive cost of retraining. By categorizing methods into four distinct families—regularization, meta-learning, direct editing, and architectural strategies—the authors provide a roadmap for making large-scale models more reliable, up-to-date, and efficient.

What Problem Does This Paper Address?

Deep neural networks (DNNs) are powerful but brittle. They often memorize incorrect facts or become outdated as the world changes. Traditionally, fixing these errors required either full model retraining (prohibitively expensive for large models) or fine-tuning on new data. However, fine-tuning often leads to catastrophic forgetting, where the model loses previously learned information while trying to incorporate the new edit.

Knowledge editing seeks a "middle way": a set of techniques to make precise, data-efficient, and fast changes to a target model. The goal is to satisfy four key properties:

  1. Reliability: The edit actually works on the target input.
  2. Generality: The edit works on similar inputs (e.g., paraphrases).
  3. Locality: The edit doesn't break unrelated model behaviors.
  4. Efficiency: The process is fast and requires minimal compute.

Methods

The authors formalize the problem as a function that takes a starting model and an edit pair (input/output) to produce an edited model. They categorize the solutions into four families:

  • Regularization Techniques: These use standard fine-tuning but add penalty terms (like L2 or KL divergence) to ensure the new weights don't stray too far from the originals, helping maintain locality.
  • Meta-learning: These methods train an auxiliary "hypernetwork" (like MEND or KnowledgeEditor) that learns how to predict the necessary weight updates for a given edit.
  • Direct Model Editing: This family performs "surgery" on the model. Methods like ROME and MEMIT identify specific layers (often MLPs in Transformers) that act as key-value memories and apply rank-one updates to "write" new information directly into the weights.
  • Architectural Strategies: Instead of changing existing weights, these methods modify the model's structure. For example, SERAC uses an external memory to store edits and a classifier to decide when to override the base model's prediction.

The field has evolved from handling single, isolated edits to managing batches and sequences of edits, as illustrated in the figure below:

Figure 1: The knowledge editing problem has been firstly proposed as the task of modifying a model based on a set of individual pairs of edits, in a non-sequential manner (a), Sinitsin et al. (2020). Successive works extended the problem to batch of edits (b), sequential individual edits (c), and sequential batch of edits (d). Evaluation metrics are similar to all cases, as described in Section 2.5.

Datasets

The survey highlights that while most recent work focuses on Large Language Models (LLMs), the field spans multiple domains:

  • Computer Vision: Standard benchmarks like MNIST and CIFAR are used for "toy" experiments, while ImageNet and CelebA provide more realistic challenges for classification and inpainting tasks. Common Computer Vision datasets for knowledge editing.
Common Computer Vision datasets for knowledge editing.
  • Natural Language Processing: This is the most active area, using datasets for fact-checking (FEVER), question answering (zsRE, CounterFact), and document classification (SCOTUS). Common NLP datasets for knowledge editing.
Common NLP datasets for knowledge editing.
  • Specialized Domains: The paper also notes applications in safety-critical systems (like aircraft collision avoidance) and Graph Neural Networks (GNNs).

Key Insights and Ideas

  • Knowledge is Localized: One of the most striking findings is that factual knowledge in Transformers is often stored in specific MLP layers. This "locality" is what makes direct editing methods like ROME so effective.
  • The Scaling Wall: While meta-learning methods like MEND work well for a few dozen edits, they often collapse when faced with thousands. In contrast, direct editing methods like MEMIT show much better scalability.
  • Editing vs. Learning: Knowledge editing is distinct from continual learning. While both fight catastrophic forgetting, editing is about surgical fixes to the existing task distribution, whereas continual learning is about expanding to new tasks.
  • The "Retain" Challenge: In sequential editing, it's not enough to succeed at the current edit; you must also ensure that the 100th edit doesn't accidentally undo the 1st edit.

Key Results

The survey compares several notable methodologies across standard benchmarks like zsRE and CounterFact.

  • Direct Editing Superiority: Methods like ROME and MEMIT achieve near-perfect Success Rates (SR) and Generalization Rates (GR) on LLMs like GPT-J (6B).
  • Zero Drawdown: A major win for direct editing and architectural strategies is achieving near-zero Drawdown (DD), meaning the model's performance on unrelated data remains virtually untouched, unlike standard fine-tuning which often degrades the base model.
  • Efficiency: Architectural methods like SERAC are highly reliable but can add latency during inference, whereas weight-editing methods like MEMIT maintain the original model's speed.

Limitations and Future Work

The authors identify several critical gaps:

  • Scalability: We still need methods that can handle millions of edits in models with hundreds of billions of parameters.
  • Multi-modal Editing: Most current research is siloed into text-only or image-only edits. Real-world applications will require editing knowledge across modalities.
  • Security Risks: Knowledge editing is a double-edged sword. While it can fix biases, it could also be used by malicious actors to inject backdoors or harmful tendencies into models.
  • Interpretability: Our understanding of how knowledge is distributed is still incomplete. Better "knowledge tracing" tools are needed to make edits even more precise.

Summary updated

BibTeX
@misc{mazzia2023survey,
  author = {Vittorio Mazzia and Alessandro Pedrani and Andrea Caciolai and Kay Rottmann and Davide Bernardi},
  title = {{A Survey on Knowledge Editing of Neural Networks}},
  year = {2023},
  eprint = {2310.19704},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2310.19704},
}
Figure