磁悬浮:滑动循环记忆

·

研究论文 · 2026/08/15

我们提出了Maglev,一种具有固定大小记忆的循环Transformer架构,它推广了滑动窗口注意力,同时在训练期间保持可并行化。Maglev由两个耦合模型组成:预填充器Q,利用完全注意力(实践中,我们为Q交替使用完全注意力和滑动窗口注意力,因为这能带来更强的性能。基本要求是Q比P更具表达力,并能访问完整历史)来生成记忆目标m'_t;以及解码器P,仅使用滑动窗口注意力和循环K/V注入来生成用于下一词预测的解码器记忆m_t。我们使用记忆一致性损失进行训练,使m_t与m'_t对齐,从而允许推理时仅使用P。实验上,Maglev在验证损失和下游预训练基准上优于滑动窗口和潜在循环Transformer基线。此外,在P和Q之间共享参数可以减少参数记忆,同时保留大部分收益。

该论文提出了一种新颖的循环Transformer架构,在保持训练并行性的同时推广了滑动窗口注意力,并通过记忆一致性损失实现了高效的推理。实验证明了其有效性,且参数共享策略进一步提升了实用性,对高效序列建模有重要贡献。

We introduce , a recurrent Transformer architecture with fixed-size memory that generalizes sliding-window attention while remaining parallelizable during training. consists of two coupled models: a prefiller Q, which leverages full attentionIn practice, we use interleaved full and sliding-window attention for Q, as this yields stronger performance. The essential requirement is that Q be more expressive than P, with access to the full history. to produce memory targets m'_t, and a decoder P, which uses only sliding-window attention and recurrent K/V injection to produce decoder memories m_t for next-token prediction. We train with a memory consistency loss that aligns m_t with m'_t, allowing inference to use P alone. Empirically, improves validation loss and downstream pretraining benchmarks over sliding-window and latent recurrent transformer baselines. Moreover, sharing parameters between P and Q reduces parameter memory while preserving most of the gains.

阅读原文

参与讨论