2025-06-06 · 专家 · 机器学习

Diagonal Batching Unlocks Parallelism in Recurrent Memory Transformers for Long Contexts

本文提出了一种名为“对角批处理”的调度方案,该方案能够在保持精确递归的同时,解锁循环记忆转换器(RMT)中的跨段并行性,显著提高了长上下文推理的速度。

更新于 2025-06-06。作者:Danil Sivtsov、Ivan Rodkin、Gleb Kuzmin、Yuri Kuratov、Ivan Oseledets。

中文摘要

Transformer模型由于时间和内存复杂度为二次方和线性,在处理长上下文推理时存在困难。循环记忆Transformer(RMTs)通过将渐近成本降低到线性时间和常数内存使用,提供了一个解决方案。然而,它们的内存更新机制导致了顺序执行,从而成为性能瓶颈。我们引入了对角批量处理,这是一种调度方案,它能够在保持精确递归的同时,在RMTs的各个段之间解锁并行性。这种方法消除了顺序约束,使得即使对于单个长上下文输入,也能实现高效的GPU推理,而无需复杂的批处理和流水线技术。因为这项技术纯粹是运行时计算重排序,所以现有的RMT模型无需重新训练即可采用。应用于LLaMA-1B ARMT模型,对角批量处理在131,072个token的序列上,比标准的全注意力LLaMA-1B快3.3倍,比顺序RMT实现快1.8倍。通过对角批量处理移除顺序瓶颈,减少了推理成本和延迟,从而增强了RMTs作为现实世界长上下文应用的实际解决方案的地位。

英文摘要

Transformer models struggle with long-context inference due to their quadratic time and linear memory complexity. Recurrent Memory Transformers (RMTs) offer a solution by reducing the asymptotic cost to linear time and constant memory usage. However, their memory update mechanism leads to sequential execution, causing a performance bottleneck. We introduce Diagonal Batching, a scheduling scheme that unlocks parallelism across segments in RMTs while preserving exact recurrence. This approach eliminates the sequential constraint, enabling efficient GPU inference even for single long-context inputs without complex batching and pipelining techniques. Because the technique is purely a run-time computation reordering, existing RMT models adopt it with no retraining. Applied to a LLaMA-1B ARMT model, Diagonal Batching yields a 3.3x speedup over standard full-attention LLaMA-1B and a 1.8x speedup over the sequential RMT implementation on 131,072-token sequences. By removing sequential bottleneck, Diagonal Batching reduces inference cost and latency, thereby strengthening RMTs as a practical solution for real-world, long-context applications.

解读

一句话总结

本文提出了一种名为“对角批处理”的调度方案,该方案能够在保持精确递归的同时,解锁循环记忆转换器(RMT)中的跨段并行性,显著提高了长上下文推理的速度。

问题1:这篇论文想要解决什么具体问题?

问题2:论文的核心创新点是什么?

问题3:实验结果如何验证了方法的有效性?

问题4:这个研究的实际应用价值是什么?

来源