Abstract
Updating Large Language Models (LLMs) involves the dual challenges of incorporating new information (editing) and removing unwanted data (unlearning). Traditional methods often suffer from task conflicts and storage dilemmas. We present LOKA, a framework that utilizes a modular knowledge codebook and conflict-aware training to resolve these issues. LOKA demonstrates superior performance in generalization and unlearning efficacy across multiple benchmarks.
1. Introduction
LLMs are dynamic systems requiring frequent updates to maintain relevance and safety. This process involves editing to add new facts and unlearning to remove outdated or harmful content. However, simultaneous optimization for both tasks is difficult due to gradient conflicts and the trade-off between precision and generalization in external memory storage.
2. The Problem of Task Conflict
A significant hurdle in LLM updating is the "tug-of-war" between editing and unlearning objectives. Theoretically and empirically, when editing and unlearning datasets are sufficiently similar, their optimization gradients conflict.
As illustrated in the histograms above, a large majority of training iterations exhibit negative gradient similarity, meaning the two tasks are actively working against each other. Simple joint fine-tuning fails to resolve this inherent tension, often leading to performance degradation in both objectives.
3. The LOKA Framework
LOKA (Conflict-free framework for LLM updating) introduces a Knowledge Codebook—a set of external parameter modules integrated into the model's feedforward layers while the base model remains frozen.
3.1 Similarity-Aware Mapping
To address the storage dilemma (where sparse storage leads to overfitting and dense storage leads to underfitting), LOKA employs clustering techniques like K-means or Locality-Sensitive Hashing (LSH) to group related knowledge. This ensures that the storage is dense enough to generalize across paraphrases but sparse enough to maintain factual precision.
3.2 Conflict-Aware Training
LOKA dynamically manages task conflicts by calculating a conflict score based on gradient cosine similarity. High-conflict scenarios trigger the use of task-specific memories, while low-conflict scenarios utilize multi-task memories optimized via the Multiple Gradient Descent Algorithm (MGDA) to achieve Pareto optimality.
3.3 Inference via Learning-Based Router
During inference, a BERT-based classifier acts as a gatekeeper. It determines if a prompt relates to the updated knowledge. If so, the appropriate codebook module is retrieved; otherwise, the original LLM is used, preserving the model's existing knowledge and "locality."
4. Experimental Results
LOKA was evaluated against state-of-the-art baselines like GRACE and WISE on benchmarks including TOFU (unlearning/editing) and ZsRE (factual editing).
As shown in the results, while sparse methods like GRACE perform well on direct editing, their performance collapses on Paraphrased Editing. LOKA maintains high ROUGE-L scores, effectively bridging the "paraphrase gap." Furthermore, on the TOFU unlearning benchmark, LOKA achieved a truth ratio of 0.8044, significantly outperforming existing unlearning methods. In safety tasks (PKU-SafeRLHF), LOKA reduced the toxic rate from 0.2060 to 0.0551.
5. Conclusion
LOKA effectively resolves the conflicts inherent in simultaneous LLM editing and unlearning. By leveraging a modular codebook and conflict-aware optimization, it provides a scalable and generalized approach to knowledge management, supporting sequential updates without retraining the entire system.
Summary updated