论文

State Space Attention:让模型自己学会该记住什么

State Space Attention: Learning Context-Dependent Memory Retention

精选理由

搞长上下文、KV cache 优化的工程师可以看看这篇。SSA 用可学习打分器决定保留哪些记忆,推理内存恒定,检索任务上能打平 4 倍预算的普通 Transformer,还能和现有 KV 驱逐方法叠加。

论文提出 State Space Attention(SSA),针对标准注意力 KV cache 随上下文长度线性增长的问题,让序列模型学习保留一个有界的过去表示集合。SSA 用一个可学习的打分器,根据新到来的上下文和已有记忆对每个 chunk 重新打分,再以标准注意力读取这些记忆;固定上下文的 Transformer 等价于只保留最近 token 的特例。

正文

训练上,作者联合训练打分器与读取器,路径有两条:从可微的软权重逐渐过渡到硬保留,或从一开始就用硬保留;为给打分器提供训练信号,他们引入一种叫 recovery 的技术,在训练中生成有监督样本。在检索、变量追踪、多跳推理和语言建模任务上,SSA 与循环模型、有界记忆注意力方法和全注意力 Transformer 做了对比。

结果显示,SSA 在多数任务上接近全注意力,在所有长上下文检索任务上大幅超过同等可读预算的 Transformer,甚至能与约 4 倍预算的模型持平,而推理内存为常数。小模型规模下与全注意力最大的差距出现在 RULER 上。由于读取采用标准注意力,SSA 可以与 KV cache 驱逐方法叠加使用,作者还预训练和后训练了 400M 参数模型来测量训练与推理成本随上下文长度和模型规模的扩展情况。

原文 · arXiv cs.LG

State Space Attention: Learning Context-Dependent Memory Retention

Standard attention's key-value cache grows linearly with context length. Bounding it raises the question of what a sequence model should retain for long-context reasoning. We argue this choice should be learned, and introduce State Space Attention (SSA), which learns to keep a bounded set of past representations and reads them with standard attention. A learned scorer rescores every chunk against newly arriving context and the rest of memory. A fixed-context Transformer is then the special case that always keeps the most recent tokens. We train the scorer and reader jointly, either moving gradually from a differentiable soft weighting of memories to hard retention, or with hard retention from the start. To produce signal for the scorer, we generate supervised samples during training, a technique we call recovery. We compare SSA with recurrent models, bounded-memory attention methods, and full-attention Transformers across retrieval, variable tracking, multi-hop reasoning, and language modeling. On our retrieval and reasoning benchmarks, SSA matches or comes within a few points of full attention on most tasks, far outperforms a Transformer with the same readable budget on every long-context retrieval task we evaluate, and matches or outperforms one with about 4 times that budget, while using constant inference memory. The largest remaining gap to full attention at small language model scale is on RULER. SSA makes a fixed number of tokens useful over a longer context, and since it reads memory with standard attention, we propose that it can be stacked with KV cache eviction methods. We also pretrain and post-train 400M-parameter models and measure how SSA's training and inference costs scale with context length and model size. Together, these experiments examine the capabilities and limitations of learned memory retention for long-context sequence modeling.

产业坐标与信源核验

本条情报归属 AITOP「论文」核心追踪栏目。在跨区域产业观察坐标中,该动态直接关联「AI 开发者工具链、Coding Agent 与工程化实践」研究主线,反映出当前技术演进与商业落地的最新风向。涉及核心实体与技术议题包括:State Space Attention、KV cache、长上下文、RULER,读者可通过下方标签进入对应专题页查阅历史脉络与关联对比。

信源核验说明:本文原始线索采编自「arXiv cs.LG」(@Ege Çakar, Cengiz Pehlevan),经 AITOP 多维评分管线结构化提炼。