Table of Contents
Fetching ...

Model Editing with Canonical Examples

John Hewitt, Sarah Chen, Lanruo Lora Xie, Edward Adams, Percy Liang, Christopher D. Manning

TL;DR

This work defines model editing with canonical examples, a framework that learns from a single example per desired behavior, generalizes to out-of-distribution contexts, and restricts deviation from the original model. It systematically evaluates three finetuning strategies (Full, LoRA, MEMIT) on six datasets spanning knowledge, bias, and syntax, finding LoRA generally most effective under strict degradation. The paper then introduces Sense Finetuning for the Backpack architecture, showing superior performance across tasks and enabling inference-time ensembles that can surpass direct edits to much larger models like GPT-J. Together, these results demonstrate that carefully constrained, architecture-aware editing can yield robust, targeted improvements with practical implications for debiasing, knowledge updating, and syntactic edge-case handling. The findings advocate for designing models with editability in mind to enable precise, low-cost improvements post-deployment.

Abstract

We introduce model editing with canonical examples, a setting in which (1) a single learning example is provided per desired behavior, (2) evaluation is performed exclusively out-of-distribution, and (3) deviation from an initial model is strictly limited. A canonical example is a simple instance of good behavior, e.g., The capital of Mauritius is Port Louis) or bad behavior, e.g., An aspect of researchers is coldhearted). The evaluation set contains more complex examples of each behavior (like a paragraph in which the capital of Mauritius is called for.) We create three datasets and modify three more for model editing with canonical examples, covering knowledge-intensive improvements, social bias mitigation, and syntactic edge cases. In our experiments on Pythia language models, we find that LoRA outperforms full finetuning and MEMIT. We then turn to the Backpack language model architecture because it is intended to enable targeted improvement. The Backpack defines a large bank of sense vectors--a decomposition of the different uses of each word--which are weighted and summed to form the output logits of the model. We propose sense finetuning, which selects and finetunes a few ($\approx$ 10) sense vectors for each canonical example, and find that it outperforms other finetuning methods, e.g., 4.8% improvement vs 0.3%. Finally, we improve GPT-J-6B by an inference-time ensemble with just the changes from sense finetuning of a 35x smaller Backpack, in one setting outperforming editing GPT-J itself (4.1% vs 1.0%).

Model Editing with Canonical Examples

TL;DR

This work defines model editing with canonical examples, a framework that learns from a single example per desired behavior, generalizes to out-of-distribution contexts, and restricts deviation from the original model. It systematically evaluates three finetuning strategies (Full, LoRA, MEMIT) on six datasets spanning knowledge, bias, and syntax, finding LoRA generally most effective under strict degradation. The paper then introduces Sense Finetuning for the Backpack architecture, showing superior performance across tasks and enabling inference-time ensembles that can surpass direct edits to much larger models like GPT-J. Together, these results demonstrate that carefully constrained, architecture-aware editing can yield robust, targeted improvements with practical implications for debiasing, knowledge updating, and syntactic edge-case handling. The findings advocate for designing models with editability in mind to enable precise, low-cost improvements post-deployment.

Abstract

We introduce model editing with canonical examples, a setting in which (1) a single learning example is provided per desired behavior, (2) evaluation is performed exclusively out-of-distribution, and (3) deviation from an initial model is strictly limited. A canonical example is a simple instance of good behavior, e.g., The capital of Mauritius is Port Louis) or bad behavior, e.g., An aspect of researchers is coldhearted). The evaluation set contains more complex examples of each behavior (like a paragraph in which the capital of Mauritius is called for.) We create three datasets and modify three more for model editing with canonical examples, covering knowledge-intensive improvements, social bias mitigation, and syntactic edge cases. In our experiments on Pythia language models, we find that LoRA outperforms full finetuning and MEMIT. We then turn to the Backpack language model architecture because it is intended to enable targeted improvement. The Backpack defines a large bank of sense vectors--a decomposition of the different uses of each word--which are weighted and summed to form the output logits of the model. We propose sense finetuning, which selects and finetunes a few ( 10) sense vectors for each canonical example, and find that it outperforms other finetuning methods, e.g., 4.8% improvement vs 0.3%. Finally, we improve GPT-J-6B by an inference-time ensemble with just the changes from sense finetuning of a 35x smaller Backpack, in one setting outperforming editing GPT-J itself (4.1% vs 1.0%).
Paper Structure (55 sections, 16 equations, 5 figures, 12 tables)

This paper contains 55 sections, 16 equations, 5 figures, 12 tables.

Figures (5)

  • Figure 1: The model editing with canonical examples setting provides simple examples of good or bad behavior, a goal, and a language model, and evaluates more complex examples of that behavior. Updated models cannot increase in loss on a general corpus more than an $\epsilon\approx10^{-4}$ factor of the base model's loss.
  • Figure 2: Results for model editing with canonical examples with Pythia models for the $B_{0.0001}$ degradation ball. Some tasks (e.g., hard syntax) show substantial improvement; others (e.g., temporal) do not.
  • Figure 3: On average, LoRA outperforms other methods for model editing with canonical examples.
  • Figure 4: In sense finetuning, a handful of sense vectors are selected based on an estimate of their importance to the canonical example relative to general text. In one example, a subword aur of the name of the country Nauru has some of its sense vectors finetuned. Finetuning updates the sense vector to, in this case, store knowledge about the capital of the country.
  • Figure 5: Hard Negatives Results for Pythia in ball 0.001. Lower is better. Note that MEMIT improves performance slightly on hard negatives (but, as shown in Figure \ref{['figure_pythia_results']}, was less effective at generalization.)