NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Editing Commonsense Knowledge in GPT

Anshita Gupta, Debanjan Mondal, Akshay Krishna Sheshadri, Wenlong Zhao, Xiang Lorraine Li, Sarah Wiegreffe, Niket Tandon · OpenReview

Abstract

Memory editing methods for updating encyclopedic knowledge in transformers have received increasing attention for their efficacy, specificity, and generalization advantages. However, it remains unclear if such methods can be adapted for the more nuanced domain of commonsense knowledge. We propose $MEMIT_{CSK}$, an adaptation of MEMIT to edit commonsense mistakes in GPT-2 Large and XL. We extend editing to various token locations and employ a robust layer selection strategy. Models edited by $MEMIT_{CSK}$ outperforms the fine-tuning baselines by 10.97% and 10.73% F1 scores on subsets of PEP3k and 20Q. We further propose a novel evaluation dataset, MEMIT-CSK-PROBE, that contains unaffected neighborhood, affected neighborhood, affected paraphrase, and affected reasoning challenges. $MEMIT_{CSK}$ demonstrates favorable semantic generalization, outperforming fine-tuning baselines by 13.72% and 5.57% overall scores on MEMIT-CSK-PROBE. These results suggest a compelling future direction of incorporating context-specific user feedback concerning commonsense in GPT by direct model editing, rectifying and customizing model behaviors via human-in-the-loop systems.

Introduction

Large Language Models (LLMs) are notorious for "hallucinating" or making basic commonsense blunders. While previous research has developed methods to edit encyclopedic facts (e.g., changing "The Eiffel Tower is in Paris" to "Rome"), commonsense is a different beast. Factual knowledge usually has a single, static answer, whereas commonsense is often "fuzzy" and multi-faceted. This paper addresses whether commonsense knowledge is localized in specific "neurons" within a Transformer and if we can repair mistakes directly in the model's weights more effectively than traditional fine-tuning.

Methodology: $MEMIT_{CSK}$

The paper introduces $MEMIT_{CSK}$ (Mass Editing Memory in a Transformer for Commonsense Knowledge), featuring two critical innovations:

  1. Flexible Token Targeting: While factual editing usually targets the "subject," commonsense judgments often hinge on the verb or the object. $MEMIT_{CSK}$ identifies the optimal token (Subject, Verb, or Object) based on its causal impact.
  2. Robust Layer Selection: Instead of picking a single layer, the authors use a moving average of Indirect Effect (AIE) to select a window of layers, making the edit more stable.
Overview of the $MEMIT_{CSK}$ editing framework and the semantic generalization evaluation probe.

To find these edit locations, they use Causal Tracing, which involves "corrupting" an input with noise and then selectively "restoring" hidden states to see which ones bring the model back to the correct prediction.

Causal tracing heatmaps showing the average indirect effect across layers and tokens for the base model.

Evaluation Framework

The study utilizes two primary commonsense benchmarks: PEP3k (Physical Event Plausibility) and 20Q (20 Questions). Additionally, a novel evaluation benchmark, MEMIT-CSK-PROBE, was introduced to test if an edit actually "stuck" meaningfully:

  • Affected Paraphrases: Does the fix work if the question is rephrased?
  • Affected Reasoning: Does the model understand the logical implications of the edit?
  • Unaffected Neighborhoods: Does editing one fact accidentally corrupt unrelated facts?

Key Insights and Results

  • Localization is Real: Commonsense is localized, but unlike facts which live in the middle layers, commonsense signals often peak in the earlier MLP layers.
  • Performance Prerequisites: Causal tracing reveals clearer patterns in models that have been "base-finetuned" to a certain level of competence.
  • Superior Accuracy and Generalization: GPT-2 XL models edited with $MEMIT_{CSK}$ outperformed fine-tuned baselines by over 10% F1. On the PROBE SET, $MEMIT_{CSK}$ showed significantly higher scores on "Affected Reasoning," suggesting the model integrated the new logic into its internal "world model."
  • Surgical Precision: The "Relapse" rate for $MEMIT_{CSK}$ was consistently lower than fine-tuning, meaning the edits were more specific and less destructive.

Conclusion

$MEMIT_{CSK}$ provides a promising path for incorporating context-specific user feedback to rectify commonsense errors in LLMs via direct model editing. While current results are strong on GPT-2 models, future work will focus on scaling these methods to larger frontier models and refining token targeting strategies.

Summary updated

BibTeX
@inproceedings{gupta2023editing,
  author = {Anshita Gupta and Debanjan Mondal and Akshay Krishna Sheshadri and Wenlong Zhao and Xiang Lorraine Li and Sarah Wiegreffe and Niket Tandon},
  title = {{Editing Commonsense Knowledge in GPT}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  url = {https://openreview.net/forum?id=DGp7TWOohe},
}
Figure