深度融合记忆:面向大语言模型的块级参数化记忆
研究论文 · 2026/10/23
大型语言模型需要有效获取和使用预训练之外的外部知识。持续预训练存在灾难性遗忘风险,推理时检索会增加大量开销。外部参数化记忆避免了在线检索,但构建其训练数据需要大量离线搜索,且输出级插值仅提供浅层融合。我们提出深度融合记忆(DFM),一种参数化记忆架构,减少了构建工作量,并将学习到的记忆融入中间隐藏状态。因果记忆预测器学习从先前上下文生成记忆,使用从语料库检索的块嵌入作为监督。预测的记忆在每个块内的标记间共享,并通过门控交叉注意力融合到它们的隐藏状态中。记忆预测和融合在骨干网络冻结的情况下端到端训练,推理不需要显式检索。与通常构建标记级记忆目标的现有参数化记忆方法相比,DFM构建训练数据所需的检索查询少32倍,检索项少2048倍。在六个问答任务上,DFM在Mistral-7B-v0.3上比最强基线高12.71%,在Qwen3-8B-Base上高11.19%。在问答之外,领域适应在Qwen3-4B-Base和Qwen3-8B-Base上分别平均提升6.51和4.38分。
DFM通过块级参数化记忆和深度融合,在避免灾难性遗忘和检索开销的同时,大幅降低训练数据构建成本,并在多个任务上取得显著性能提升,为语言模型的外部知识整合提供了高效新途径。
Large language models need effective ways to acquire and use external knowledge beyond what they retain from pretraining. Continued pretraining risks catastrophic forgetting, while retrieval at inference time can add substantial overhead. External parametric memory avoids online retrieval, but constructing its training data requires extensive offline search, and output-level interpolation provides only shallow fusion. We introduce Deep Fusion Memory (DFM), a parametric memory architecture that reduces this construction workload and incorporates learned memory into intermediate hidden states. A causal memory predictor learns to generate memory from the preceding context, using retrieved chunk embeddings from the corpus as supervision. The predicted memory is shared across tokens within each chunk and fused into their hidden states through gated cross-attention. Memory prediction and fusion are trained end to end with the backbone frozen, and inference requires no explicit retrieval. Compared with existing parametric memory approaches, which often construct token-level memory targets, DFM requires 32times fewer retrieval queries and 2048times fewer retrieved items to construct its training data. Across six QA tasks, DFM performs better over the strongest baseline by 12.71% on Mistral-7B-v0.3 and 11.19% on Qwen3-8B-Base. Beyond QA, domain adaptation yields average gains of 6.51 and 4.38 points over Qwen3-4B-Base and Qwen3-8B-Base, respectively.