LEMoE: Advanced Mixture of Experts Adaptor for Lifelong Model Editing of Large Language Models

Renzhi Wang, Piji Li

Abstract

Large language models (LLMs) require continual knowledge updates to stay abreast of the ever-changing world facts, prompting the formulation of lifelong model editing task. While recent years have witnessed the development of various techniques for single and batch editing, these methods either fail to apply or perform sub-optimally when faced with lifelong editing. In this paper, we introduce LEMoE, an advanced Mixture of Experts (MoE) adaptor for lifelong model editing. We first analyze the factors influencing the effectiveness of conventional MoE adaptor in lifelong editing, including catastrophic forgetting, inconsistent routing and order sensitivity. Based on these insights, we propose a tailored module insertion method to achieve lifelong editing, incorporating a novel KV anchor routing to enhance routing consistency between training and inference stage, along with a concise yet effective clustering-based editing order planning. Experimental results demonstrate the effectiveness of our method in lifelong editing, surpassing previous model editing techniques while maintaining outstanding performance in batch editing task. Our code will be available.

Introduction

Large Language Models (LLMs) are essentially static snapshots of knowledge at their time of training. As global facts evolve, these models inevitably become outdated. While traditional model editing techniques can inject new facts or correct errors in one-off or batch updates, they often fail in "lifelong editing" scenarios where updates occur continuously over time.

Existing Mixture of Experts (MoE) based editors face three primary challenges in lifelong settings:

  1. Catastrophic Forgetting: New edits often overwrite parameters used for previous ones, causing the model to lose recently acquired knowledge.
  2. Inconsistent Routing: The routing logic—deciding which expert handles an input—changes as the model is updated, leading to inference-time failures where prompts are sent to incorrect experts.
  3. Order Sensitivity: The sequence of updates significantly impacts performance; shuffling the same 1,000 edits can result in a performance swing of over 20 points.

Methodology: The LEMoE Framework

To address these challenges, we propose LEMoE, which introduces three key architectural innovations:

1. Module Insertion and Freezing

Instead of updating existing parameters, LEMoE adds a new Feed-Forward Network (FFN) expert for every new batch of data. Crucially, all previous experts are frozen. This physical separation prevents new knowledge from corrupting previously learned facts, effectively eliminating catastrophic forgetting.

2. KV Anchor Routing

Standard MLP-based routers are prone to inconsistency during lifelong updates. LEMoE replaces these with KV Anchor Routing. Each expert is assigned a fixed "key" vector, while the input embedding acts as the "value." By aligning the routing process during both training and inference using these key-value pairs, we ensure that specific knowledge is consistently handled by the expert that learned it.

Overview of the LEMoE architecture showing the lifelong editing timeline and the KV Anchor Routing mechanism.

3. Clustering-based Order Planning

To mitigate order sensitivity, we employ K-means clustering to group semantically similar edits. Organizing the sequence of edits to maximize intra-batch similarity and minimize inter-batch similarity aligns the data with the model's natural learning biases.

Experimental Evaluation

We evaluated LEMoE using LLaMA-7B and Mistral-7B as base models on two primary benchmarks:

  • ZsRE (Zero-Shot Relation Extraction): A standard dataset for factual QA editing.
  • SelfCheckGPT: Used to evaluate mitigation of hallucinations in long-form text generation.

Results and Analysis

LEMoE demonstrated superior performance across multiple metrics compared to state-of-the-art methods like MEMIT and GRACE.

Reliability and Consistency

On the ZsRE dataset with 1,000 sequential edits, LEMoE achieved an average reliability score of 0.80, significantly higher than MEMIT (0.65) and GRACE (0.68). Furthermore, LEMoE maintained a near-perfect 1.00 locality score, ensuring that edits did not adversely affect unrelated knowledge.

Analysis of catastrophic forgetting and routing consistency, showing how LEMoE maintains high reliability and consistent expert selection.

Hallucination Mitigation

On SelfCheckGPT, LEMoE achieved the lowest perplexity (PPL) scores (e.g., 2.01 for LLaMA-7B), indicating high effectiveness in correcting hallucinations while preserving language fluency.

Conclusion and Future Work

LEMoE effectively addresses the core issues of lifelong model editing through frozen experts and consistent routing. While successful, the current approach leads to parameter growth over time. Future work will explore methods for pruning or merging experts to improve scalability. Additionally, extending this framework to handle complex reasoning tasks and encoder-decoder architectures remains an open area for research.

Summary updated

BibTeX
@inproceedings{wang2024lemoe,
  author = {Renzhi Wang and Piji Li},
  title = {{LEMoE: Advanced Mixture of Experts Adaptor for Lifelong Model Editing of Large Language Models}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.emnlp-main.149},
}
Figure