Abstract
Large language models (LLMs) encode vast world knowledge but struggle to stay up-to-date, often leading to errors and hallucinations. Knowledge editing offers an efficient alternative to retraining, enabling targeted modifications by updating specific model parameters. However, existing methods primarily focus on individual models, posing challenges in efficiently updating multiple models and adapting to new models. To address this, we propose OnceEdit, a novel ensemble-based approach that employs a plug-in model as the editing module, enabling stable knowledge updates across multiple models. Building on the model ensemble, OnceEdit introduces two key mechanisms to enhance its effectiveness. First, we introduce a dynamic weight mechanism through a weight token for distinguishing between edit-related and non-edit-related instances, ensuring the appropriate utilization of knowledge from integrated models. Second, we incorporate an ensemble enhancement mechanism to mitigate the excessive reliance on the central model inherent in the model ensemble technique, making it more suitable for knowledge editing. Extensive experiments on diverse LLMs demonstrate that OnceEdit consistently outperforms existing methods while achieving superior editing efficiency. Further analysis confirms its adaptability and stability in multi-model editing scenarios.
Introduction
Large language models encode vast amounts of world knowledge, but this knowledge inevitably becomes outdated, leading to hallucinations. Knowledge Editing (KE) offers a targeted way to update specific facts without the massive cost of retraining the entire model. However, current KE methods (like ROME or MEMIT) are highly model-specific. If an organization maintains a fleet of different LLMs (e.g., a mix of Llama, Mistral, and GPT architectures), they must compute and apply edits to each model individually. This is highly inefficient and requires tedious hyperparameter tuning for each specific architecture. OnceEdit addresses this gap by enabling a single edit to propagate across a heterogeneous fleet of LLMs.
Methodology: The OnceEdit Framework
OnceEdit shifts the editing burden from massive base LLMs to a small, shared plug-in model (e.g., TinyLlama). At inference time, the plug-in is ensembled with the target LLM. Because the models have different vocabularies, OnceEdit builds on heterogeneous ensembling techniques to align vocabularies using shared "anchor tokens."
To make this work for knowledge editing, OnceEdit introduces two novel mechanisms:
- Dynamic Weighting via a
[WEIGHT]Token: Standard ensembling uses fixed weights. OnceEdit trains a special[WEIGHT]token in the plug-in model using a binary cross-entropy loss. For a given prompt, this token predicts whether the input relates to an edited fact. If it does, the ensemble heavily weights the plug-in model; if not, it defers to the base LLM, preserving unrelated knowledge. - Ensemble Enhancement: In standard ensembling, a massive 7B parameter model can overpower the logits of a smaller plug-in model. To prevent the base LLM's outdated knowledge from dominating, OnceEdit alters the decoding search. It uses Search-space Zero Initialization (starting the search from a zero vector) and Target Augmentation (converting the fused distribution into a one-hot vector). This forces the ensemble to respect the new knowledge injected by the plug-in.
Experimental Evaluation
The framework was evaluated using two standard benchmarks: ZsRE, a context-free question-answering dataset, and Counterfact, a dataset of counterfactual entity-relation triples designed to test how well a model adopts injected edits while ignoring pre-trained priors.
Key Results
- Superior Performance: OnceEdit achieved the highest overall scores across Reliability, Generality, and Locality, outperforming second-best methods by 14% on ZsRE and 6% on Counterfact.
- Robustness in Generation: Unlike methods like MEMIT, which can degrade in realistic validation generation settings, OnceEdit remained highly stable and accurate in free generation.
- Efficiency and Scalability: When updating three models simultaneously (Llama2-7B, Mistral-7B, GPT-J-6B), OnceEdit takes less than half the time of traditional methods. It also generalized to larger models like Llama3-70B without hyperparameter tweaks.
Discussion and Future Work
OnceEdit successfully decouples knowledge from architecture, bypassing the quirks of individual LLMs. However, it introduces inference overhead due to the dual-model ensemble, though parallel decoding may mitigate this. Future work could explore sequential lifelong editing or applying more advanced KE techniques directly to the plug-in model to further enhance stability. By isolating edited facts into a universal plug-in, OnceEdit provides a scalable path for maintaining up-to-date knowledge across diverse AI systems.
Summary updated