历史重演:释放线性注意力中的长上下文能力

·

研究论文 · 2026/10/16

线性注意力有望实现长上下文语言建模所需的效率,但其固定大小的循环状态必须同时支持持续计算并保存不断增长的历史信息。这种耦合强化了一种普遍观点,即状态的记忆容量决定了模型的长上下文能力。我们挑战这一假定上限:循环计算不必承担全部长期存储负担。我们提出 NoteBank,一种稀疏情景记忆,在未来查询未知之前归档选定的文本,使用主干网络的原生特征进行写入和寻址,并通过重放以其原生前向计算读取检索到的证据。这种免训练、即插即用的接口不需要外部嵌入模型、单独训练的检索器或单独的神经阅读器。在百万 token 规模下,它将 Gated DeltaNet 在六个 RULER 检索任务上的平均准确率从 1.7% 提升至 70.3%,且在 4K 到 1M token 范围内未观察到显著的检索退化。这一恢复仅增加不超过 0.025% 的分析 FLOPs,持久上下文存储约为匹配宽度、深度和精度下 Transformer 完整 MHA KV 缓存的 1/2,600。实验从三个 1.3B 循环主干扩展到 Mamba-2-8B 和训练后 Qwen3.5-9B,在 LongBench v1/v2 和 MemoryAgentBench 上展示了增益。这些结果表明,稀疏证据存储和原生重放可以大幅扩展预训练线性注意力模型的长上下文能力,同时保持循环计算的效率。

该工作挑战了线性注意力长上下文能力受限于固定状态记忆容量的传统观点,提出了一种免训练、即插即用的稀疏记忆机制,在极低计算和存储开销下大幅提升长上下文检索性能,并在多种模型上验证了有效性,对长上下文语言建模具有重要参考价值。

Linear attention promises the efficiency needed for long-context language modelling, yet its fixed-size recurrent state must simultaneously support ongoing computation and preserve information from an ever-growing history. This coupling has reinforced a prevailing view that the state's memory capacity defines the model's long-context capability. We challenge this presumed ceiling: recurrent computation need not bear the full burden of long-term storage. We introduce NoteBank, a sparse episodic memory that archives selected text before future queries are known, uses the backbone's native features for writing and addressing, and reads retrieved evidence through its native forward computation via replay. This training-free, plug-and-play interface requires no external embedding model, separately trained retriever, or separate neural reader. At one million tokens, it raises Gated DeltaNet's mean accuracy across six RULER retrieval tasks from 1.7% to 70.3%, with no observed significant retrieval degradation from 4K to 1M tokens. This recovery adds leqslant0.025% to analytical FLOPs, with persistent context storage approximately 1/2,600 that of a Transformer's full MHA KV cache at matched width, depth, and precision. Experiments extend from three 1.3B recurrent backbones to Mamba-2-8B and post-trained Qwen3.5-9B, demonstrating gains on LongBench v1/v2 and MemoryAgentBench. Together, these results show that sparse evidence storage and native replay can substantially expand the long-context capability of pretrained linear attention models while retaining the efficiency of recurrent computation.

阅读原文

参与讨论