让冻结大模型准确使用外部知识,解决信息冲突问题。
TokenMem: Faithful Knowledge Injection for Frozen LLMs

- 用专用交叉注意力通道注入知识,避开模型内部竞争。
- 在反事实测试中知识遵循率高达69-70%,远超传统方法。
- 适合需要精准引用外部知识的场景,如医疗、法律问答。
检索增强生成(RAG)能为大语言模型注入外部知识,但当检索信息与模型参数记忆冲突时,共享的自注意力路径会导致输出不可预测。我们提出TokenMem,一种轻量级记忆系统,通过专用交叉注意力通道将知识注入冻结的LLM,避免与参数记忆在残差流中的竞争。TokenMem仅训练一个极薄的门控适配器(约3-7M参数),采用两阶段课程:先学习通用知识利用,再强化在反事实知识下的忠实遵循。在五个模型(Qwen3-4B/8B/14B、LLaMA-3.1-8B、OLMo-3-7B)上测试,TokenMem在反事实基准上实现69-70%的知识遵循率(KC),而原始RAG仅为20-52%,差距最高达49个百分点。消融实验表明,第二阶段课程至关重要:移除后知识遵循率几乎归零。机制分析显示,门控适配器在无显式监督下学会了冲突感知、分层注入策略。
原文摘要 · Abstract (English)
Retrieval-augmented generation (RAG) enhances large language models (LLMs) with external knowledge, but suffers from knowledge conflicts: when retrieved information contradicts parametric memory, the shared self-attention pathway produces unpredictable outputs. We present TokenMem, a lightweight memory system that injects knowledge into frozen LLMs through a dedicated cross-attention channel, bypassing competition with parametric memory in the residual stream. TokenMem trains only a thin gating adapter ($\sim$3-7M parameters) via a two-phase curriculum: first learning general knowledge utilization, then strengthening faithful compliance under counterfactual knowledge. In controlled experiments on five models spanning three families (Qwen3-4B/8B/14B, LLaMA-3.1-8B, OLMo-3-7B), TokenMem achieves 69-70% Knowledge Compliance (KC) on counterfactual benchmarks, compared to 20-52% for vanilla RAG, a gap of up to 49 percentage points. Ablation studies show that the two-phase curriculum is critical: removing Phase 2 collapses KC to near-zero. Mechanistic analysis reveals that the gate adapter learns a conflict-aware, layer-specific injection strategy without explicit supervision.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。