Abstract
Editing model parameters directly in Transformers makes updating open-source transformer-based models possible without re-training. However, these editing methods have only been evaluated on statements about encyclopedic knowledge with a single correct answer. Commonsense knowledge with multiple correct answers, e.g., an apple can be green or red but not transparent, has not been studied but is as essential for enhancing transformers’ reliability and usefulness. In this paper, we investigate whether commonsense judgments are causally associated with localized, editable parameters in Transformers, and we provide an affirmative answer. We find that directly applying the MEMIT editing algorithm results in sub-par performance and improve it for the commonsense domain by varying edit tokens and improving the layer selection strategy, i.e., MEMIT${CSK}$. GPT-2 Large and XL models edited using MEMIT${CSK}$ outperform best-fine-tuned baselines by 10.97% and 10.73% F1 scores on PEP3k and 20Q datasets. In addition, we propose a novel evaluation dataset, PROBE SET, that contains unaffected and affected neighborhoods, affected paraphrases, and affected reasoning challenges. MEMIT$_{CSK}$ performs well across the metrics while fine-tuning baselines show significant trade-offs between unaffected and affected metrics. These results suggest a compelling future direction for incorporating feedback about common sense into Transformers through direct model editing.
Introduction
Large Language Models (LLMs) frequently struggle with "hallucinations" or errors in basic reasoning. While previous research has successfully demonstrated techniques like ROME or MEMIT to correct encyclopedic facts (e.g., changing a city's capital), "common sense" presents a more complex challenge. Unlike static facts, commonsense knowledge involves plausibility and variation—an apple might be red or green, but never transparent. This study investigates whether such nuanced knowledge is localized within specific, editable parameters and if these "neurons" can be surgically modified without degrading the model's overall performance.
Methodology: MEMIT$_{CSK}$
The researchers developed MEMIT$_{CSK}$, an adaptation of the Mass Editing Memory in a Transformer (MEMIT) algorithm specifically designed for commonsense knowledge. MEMIT treats MLP layers as associative memories, allowing for direct parameter updates.
Key innovations in MEMIT$_{CSK}$ include:
- Flexible Token Selection: Unlike factual editing that focuses on the subject, common sense often hinges on the verb or object. The authors found that editing the "last token" of these components is most effective.
- Robust Layer Selection: Instead of targeting a single layer, they utilized a max moving average of the Average Indirect Effect (AIE) to identify a stable "window" of layers for the edit.
- Causal Tracing: The team used causal tracing—corrupting inputs with noise and restoring hidden states—to pinpoint the exact layers responsible for specific commonsense judgments.
Causal Localization of Common Sense
A significant finding of this work is that commonsense knowledge is localized differently than encyclopedic facts. While factual knowledge typically resides in the middle layers of a Transformer, commonsense judgments are often found in earlier MLP layers.
As shown in the causal tracing heatmaps, the MLP layers exhibit strong indirect effects, particularly concentrated around the object tokens in the early-to-mid stages of the model. This suggests that common sense is a foundational feature processed early in the model's computation pipeline. Furthermore, the researchers noted that clear causal localization only emerges after "base-finetuning," implying the model must first possess a basic concept of the task before specific knowledge can be pinpointed and edited.
Evaluation and Datasets
The study utilized two primary benchmarks: PEP3k (Physical Event Plausibility) and 20Q (20 Questions). To rigorously test the edits, the authors introduced the PROBE SET, which evaluates:
- Semantic Generalization: Does fixing "Soil absorbs oil" also update the model's understanding of "Ground takes in oil"?
- Specificity: Does the edit avoid accidentally changing unrelated beliefs, such as "Rocks absorb oil"?
- Reasoning: Can the model maintain logical consistency in chains of reasoning related to the edited fact?
Results and Key Insights
MEMIT$_{CSK}$ demonstrated substantial improvements over traditional fine-tuning methods. GPT-2 XL models edited with this method outperformed the best fine-tuned baselines by 10.97% F1 on PEP3k and 10.73% F1 on 20Q.
Crucially, MEMIT$_{CSK}$ mitigated the "relapse" problem common in fine-tuning, where fixing one error inadvertently breaks previously correct knowledge. The editing method showed superior specificity and generalization on the PROBE SET. Causal verification after editing confirmed that the AIE at the targeted location increased, proving the "surgery" successfully reinforced the intended logic path.
Conclusion and Future Work
This research proves that common sense is causally associated with localized parameters in Transformers and can be effectively edited. While currently tested on GPT-2 Large and XL, future work will involve scaling these methods to larger models like Llama-2. Additionally, automating the selection of "edit sites" based on sentence structure remains a key challenge for scaling direct model editing to the vast domain of human common sense.
Summary updated