Explainable and Efficient Editing for Large Language Models

Tianyu Zhang, Junfeng Fang, Houcheng Jiang, Baolong Bi, Xiang Wang, Xiangnan He

TL;DR

Large Language Models (LLMs) often store outdated information, and while editing methods exist, they are inefficient and lack explainability. This paper introduces ECE, a novel method that uses LLM explainability to adaptively identify critical neurons for editing (Stage 1) and clusters knowledge for efficient batch optimization (Stage 2), achieving superior performance and a 3.27x speedup.

What Problem Does This Paper Address?

LLMs are powerful but can retain incorrect or outdated factual knowledge from their training data. Retraining these massive models is prohibitively expensive. Existing "locate-and-edit" methods offer a more efficient alternative by targeting specific knowledge updates. However, these methods typically follow a two-stage process: first, identifying which layers store the knowledge, and second, updating those layers' parameters. The paper highlights two key limitations in this paradigm:

  1. Inefficient Knowledge Identification (Stage 1): Current methods identify critical layers without considering the specific type of knowledge to be updated. This leads to suboptimal identification because different knowledge types might be stored in different patterns of neurons.
  2. High Computational Overhead (Stage 2): Updating parameters often involves computationally expensive, independent gradient descent for each piece of knowledge. This becomes a bottleneck, especially when dealing with thousands of updates or in scenarios requiring continuous learning.

The paper aims to address these issues by proposing a method that is both explainable (to better identify what to edit) and efficient (to speed up the editing process).

Methods

The proposed method, Explainable and effiCient sequential Editing (ECE), introduces improvements in both stages of the locate-and-edit paradigm:

  • Stage 1: Explainable Neuron Identification:
    • Instead of a generic layer identification, ECE leverages LLM explainability techniques to adaptively identify crucial neurons based on the input knowledge.
  • It employs three attribution methods: Activation Score (AS), Weight Importance (WI), and Residual Sensitivity (RS) to rank neurons by their relevance to specific knowledge.
  • This neuron-wise identification ensures that only the most relevant parameters are targeted, preserving the integrity of other knowledge within the model.
  • Stage 2: Efficient Parameter Update:
    • Knowledge Clustering: ECE clusters similar knowledge instances based on the identified neuron patterns. This is achieved using a k-means clustering algorithm based on Jaccard similarity.
  • Accelerated Two-Step Gradient Descent: For each cluster, ECE employs a two-step gradient descent:
  • Common Phase: A unified gradient descent is performed over the entire cluster for a majority of epochs (20 out of 25), optimizing parameters based on an "anchor sample" representative of the cluster. This captures common patterns and reduces redundant computations.
  • Instance-Specific Phase: The remaining epochs (5) are used for fine-tuning each instance within the cluster, allowing for unique adjustments.
  • This approach significantly reduces computational cost by batching optimizations for similar knowledge and avoiding repetitive calculations.

Datasets

The paper uses the following datasets for evaluation:

  • Counterfact [37]: A dataset designed to test model editing, distinguishing between factual and counterfactual statements.
  • ZsRE [33]: A question-answering dataset used for evaluating editing success, generalization, and specificity.

The paper also mentions using Wikitext for computing the AE matrix in the GPT2-XL implementation details.

Key Insights and Ideas

  • Explainability as a Driver for Efficiency: The core idea is that by understanding why a model stores certain knowledge (through explainability), we can more precisely and efficiently target edits. This moves beyond simply identifying "important layers" to identifying "important neurons" for specific knowledge.
  • Clustering for Batch Optimization: The insight that similar knowledge pieces exhibit similar neuron activation patterns allows for effective clustering. This enables batch processing of updates, a significant departure from the costly per-instance updates.
  • Two-Step Gradient Descent for Speed: The proposed two-step gradient descent (unified then instance-specific) is a clever way to balance computational efficiency with the need for precise, individual updates. It leverages shared knowledge within a cluster first, then refines for specifics.
  • Robustness to Sequential Edits: ECE demonstrates stable performance even with a large number of sequential edits, suggesting it mitigates issues like model forgetting and degradation that plague other methods.

Key Results

  • Superior Performance: ECE consistently outperforms baseline methods (FT-L, FT-W, MEND, ROME, MEMIT, SERAC) across multiple metrics (Efficacy, Generalization, Specificity, Fluency, Consistency) on Llama3, GPT2-XL, and GPT-J models.
  • Significant Speedup: ECE achieves an average speedup of 3.27x in editing efficiency compared to existing methods.
  • Stable Performance: ECE maintains stable performance across different numbers of edits and batch sizes, unlike ROME and MEMIT, which show performance degradation.
  • Preservation of General Abilities: ECE effectively preserves the LLM's general capabilities after extensive sequential edits, as demonstrated by its performance on GLUE benchmark tasks.

Limitations and Future Work

  • Limited Model Scope: The current evaluations are primarily focused on a few common LLMs (GPT2-XL, GPT-J, Llama3).
  • Dataset and Environment Specificity: Experiments are based on existing datasets and specific configurations.
  • Scalability to Larger Datasets: ECE has not yet been tested on larger and more complex datasets, which might present new computational challenges.
  • Future Directions: The authors aim to explore more diverse techniques to further enhance explainability and improve the overall efficiency and robustness of sequential editing, making it applicable to a broader range of real-world applications. They also emphasize the ethical responsibility associated with model editing and recommend rigorous validation and oversight.

Summary updated

BibTeX
@inproceedings{zhang2025explainable,
  author = {Tianyu Zhang and Junfeng Fang and Houcheng Jiang and Baolong Bi and Xiang Wang and Xiangnan He},
  title = {{Explainable and Efficient Editing for Large Language Models}},
  booktitle = {The Web Conference},
  year = {2025},
  doi = {10.1145/3696410.3714835},
}

Loading related content...

Figure