TL;DR
Fine-tuning Large Language Models (LLMs) for specific tasks often overwrites their core pretrained knowledge—a phenomenon known as catastrophic forgetting. LoKI (Low-damage Knowledge Implanting) solves this by identifying low-contribution weights within the model's Feed-Forward Networks (FFNs) and safely repurposing them for new tasks. This approach achieves state-of-the-art task adaptation while keeping the model's foundational capabilities almost entirely intact.
What Problem Does This Paper Address?
When you fine-tune a pretrained LLM on a downstream task (like function-calling or specialized retrieval), the optimization process indiscriminately updates weights across the entire architecture. Unfortunately, this often disrupts the delicate internal "memory traces" the model acquired during pretraining. The model gains a new skill but loses its general-purpose reasoning, world knowledge, or instruction-following capabilities.
While parameter-efficient fine-tuning (PEFT) methods like LoRA or DoRA reduce the number of trainable parameters, they still update weights blindly without considering where or how knowledge is structurally organized inside the transformer. The authors of LoKI bridge this gap by leveraging insights from mechanistic interpretability to fine-tune models with surgical precision.
Methods
LoKI introduces a staged fine-tuning framework that treats Feed-Forward Networks (FFNs) as key-value memories, focusing specifically on the down-projection matrices ($W_{down}$) where conceptual "values" reside.
The framework operates in three distinct phases:
- Analysing (Knowledge Vector Attribution - KVA): The authors develop KVA, a gradient-based attribution technique rooted in Integrated Gradients. By running the model through a diverse dataset, KVA quantifies exactly how much each individual neuron (knowledge vector) contributes to general-purpose capabilities.
- Selecting (Layer-Balanced Strategy): Instead of simply picking the lowest-contributing neurons globally, LoKI enforces a strict, equal quota of trainable parameters across every single layer. This ensures that the hierarchical structure of the transformer isn't warped or overridden during training.
- Implanting: The down-projection matrix is split into active and frozen subsets based on the selection. Only the low-contribution, active weights are updated during fine-tuning. Crucially, this method can also be combined with LoRA (termed LoKI*) to compress the parameter footprint even further.
Datasets
- General Knowledge Evaluation (KVA Phase): The MMLU (Massive Multitask Language Understanding) benchmark, spanning 57 subjects, was used to score the general-purpose importance of knowledge vectors.
- Downstream Fine-Tuning Tasks:
- ToolACE Function-Calling Dataset: 26,507 distinct APIs used to train Llama3.1-8B-Instruct.
- LB Reranker Dataset: 2.28 million multilingual query-text pairs used to train Qwen2.5-0.5B-Instruct.
- Catastrophic Forgetting Benchmarks: Models were evaluated across six foundational benchmarks: TriviaQA (world knowledge), GSM8K (math), HellaSwag and WinoGrande (commonsense), HumanEval (coding), and IFEval (instruction following).
Key Insights and Ideas
- The Co-location Phenomenon: Using KVA, the authors discovered a striking structural bias: neurons with globally high contributions and those with globally low contributions tend to cluster densely within the exact same layers. Knowledge distribution inside LLMs is highly concentrated, not randomly scattered.
- Layer Balance is Non-Negotiable: Naive selection strategies that only update a few specific layers heavily degrade performance. Because transformer layers progressively refine knowledge from surface-level patterns to deep semantics, modifying weights in an unbalanced way can completely block or "override" downstream information flow.
Key Results
LoKI achieves an unprecedented balance between learning new tasks and remembering old ones.
- Mitigating Forgetting: On the ToolACE dataset, standard LoRA fine-tuning caused an average performance degradation of 16.11% across the six general benchmarks. DoRA dropped by 4.92%. LoKI (at $q=10$), by contrast, limited general capability degradation to a mere 0.34%.
- Task Performance: On the Berkeley Function Calling Leaderboard (BFCL) V3, LoKI ($q=30$) achieved the highest overall accuracy (58.93%), outperforming both standard LoRA and DoRA.
- LoRA Synergy: When combining LoRA with LoKI (LoKI), the number of trainable parameters plummeted by 97.16% compared to standard LoKI, yet it still fiercely resisted catastrophic forgetting (only 1.26%* degradation).
Limitations and Future Work
Despite its strong performance, LoKI relies on a hyperparameter $q$ to determine the percentage of trainable nodes to select. The authors note that the optimal value for $q$ varies depending on the model and task, indicating a need for a more robust, adaptive quota allocation mechanism. Additionally, while the KVA analysis is a one-time cost per model, optimizing its computational overhead and exploring how LoKI interacts with different LoRA rank settings remain open avenues for future research.
Summary updated