跳到正文
arXiv cs.AI· Yuwen Qu, Wenhui Dong, Camil Hamami, Ming Zhao, Chenyang Si, Caifeng Shan·· 14 小时前AI 评分38

NGM:一种面向 LLM 的免训练即插即用记忆模块

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

AI 导读

研究者提出 N-gram Memory(NGM),一种免训练、即插即用的记忆模块,直接复用主干模型预训练的 token 嵌入空间作为记忆,由 Causal N-Gram Encoder 和 Cosine-Gated Memory Injector 两部分组成,无需额外嵌入训练或独立记忆库与外部检索设施。

正文 · 原文

View PDF HTML (experimental)

Abstract:Recent studies have introduced memory-augmented architectures that decouple knowledge storage from neural computation, enabling more direct access to stored representations. However, existing approaches often rely on learned memory embeddings or explicit memory and retrieval components, requiring additional training or increasing architectural complexity. To address these limitations, we propose N-gram Memory (NGM), a training-free, plug-and-play module that repurposes a backbone model's pretrained token embedding space as memory. NGM consists of a Causal N-Gram Encoder and a Cosine-Gated Memory Injector. The former constructs N-gram representations by directly aggregating pretrained token embeddings, while the latter uses cosine similarity with ReLU gating to adaptively control the amount of retrieved memory injected into contextual representations. Unlike conventional memory-augmented architectures, NGM requires neither additional embedding training nor a separately learned memory bank or external retrieval infrastructure. We evaluate NGM on ten benchmarks across six language-model backbones spanning two model families and multiple scales, including four Qwen3 models (0.6B, 1.7B, 4B, and 8B) and two Llama-3.2-Instruct models (1B and 3B). NGM consistently improves the ten-task average across all six backbones. Notably, it improves HumanEval by 4.26, HumanEval+ by 2.41, and GPQA-Diamond by 6.56 percentage points. Furthermore, NGM extends beyond text-only language models to vision-language models, with Qwen3-VL-2B achieving improvements across all five VLM benchmarks. Project page: this https URL
Comments: 17 pages, 4 figures. Revised manuscript with expanded experiments and analysis and updated author information. Project page: this https URL
Subjects: Artificial Intelligence (cs.AI)
Cite as: arXiv:2605.16893 [cs.AI]
  (or arXiv:2605.16893v2 [cs.AI] for this version)
  https://doi.org/10.48550/arXiv.2605.16893

arXiv-issued DOI via DataCite

Submission history

From: Yuwen Qu [view email]
[v1] Sat, 16 May 2026 09:12:52 UTC (140 KB)
[v2] Mon, 26 Oct 2026 14:26:14 UTC (239 KB)

来源:arXiv cs.AI · arxiv.org