arXiv:2605.16893cs.AI2026-05

无需训练的内存模块,让大模型快速调用知识

NGM: A Plug-and-Play Training-Free Memory Module for LLMs

论文配图:NGM: A Plug-and-Play Training-Free Memory Module for LLMs
图 1 · 摘自论文原文
  • 用预训练词嵌入构造n元语法表示,不需额外训练
  • 在8个基准上提升0.5~1.2分,代码和知识任务增益超3分
  • 即插即用,适合想增强推理能力的大模型用户

近期研究提出条件记忆模块,将知识存储与神经计算解耦,实现更直接的知识访问。相比依赖动态计算路径的MoE,显式查找机制更高效。但现有方法仍依赖学习过的记忆嵌入,需额外训练且灵活性受限。为此,我们提出无训练、即插即用的N-gram Memory(NGM),由因果n元语法编码器与余弦门控记忆注入器组成。前者直接平均骨干模型的预训练词嵌入构建n元语法表示,避免从头训练n元语法嵌入;该设计无需额外记忆表或检索流程。后者使用非参数余弦门控结合ReLU,调节检索嵌入并融入上下文表示。我们在Qwen3系列(0.6B至14B)上评估NGM,覆盖8个基准。结果显示,平均性能提升0.5~1.2点,尤其在代码生成与知识密集型任务中表现显著(如Qwen3-14B在LiveCodeBench上+3.0,GPQA上+3.03)。此外,多模态基准也获提升(如Qwen3-VL-2B在MMStar上+1.53)。

原文摘要 · Abstract (English)

Recent studies introduce conditional memory modules that decouple knowledge storage from neural computation, enabling more direct knowledge access. Compared to MoE, which relies on dynamic computation paths, explicit lookup provides a more efficient knowledge retrieval mechanism. However, these approaches still depend on learned memory embeddings, requiring additional training and limiting flexibility. To address this, we propose N-gram Memory (NGM), a training-free, plug-and-play module composed of a Causal N-Gram Encoder and a Cosine-Gated Memory Injector. The Causal N-Gram Encoder directly averages the pretrained token embeddings of the backbone model to construct N-gram representations, thereby eliminating the need to train separate N-gram embeddings from scratch. This design requires neither an additional memory table nor a retrieval pipeline. The Cosine-Gated Memory Injector then uses a non-parametric cosine gate with ReLU to modulate the retrieved embeddings into the contextual representations. We evaluate NGM on the Qwen3 series from 0.6B to 14B across eight benchmarks. NGM improves average performance by 0.5 to 1.2 points, with particularly clear gains on code generation and knowledge-intensive tasks (e.g., +3.0 on LiveCodeBench and +3.03 on GPQA for Qwen3-14B). Moreover, NGM also improves performance in multimodal benchmarks (e.g., MMStar +1.53 on Qwen3-VL-2B).

大模型记忆模块零训练推理增强

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。