Diagonal Batching Unlocks Parallelism in Recurrent Memory Transformers for Long Contexts
Not on the map. Why?
Abstract (arXiv)
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.
Key facts. Cited by 2 papers in the map (data through 14 Oct 2026). Builds on 30 of its 35 references that are in the map. First posted on arXiv 5 Jun 2025.
Builds on
30 of 35 references.
References · 30
- 2017Attention Is All You Needcited by 60,361
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2024The Llama 3 Herd of Modelscited by 14,715
- 2023Mamba: Linear-Time Sequence Modeling with Selective State Spacescited by 4,718
- 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,673
- 2024Gemini 1.5: Unlocking multimodal understanding across millions of tokens of contextcited by 3,224
- 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,598
- 2021Efficiently Modeling Long Sequences with Structured State Spacescited by 2,465
- 2019Transformer-XL: Attentive Language Models Beyond a Fixed-Length Contextcited by 1,850
- 2023GQA: Training Generalized Multi-Query Transformer Models from Multi-Head Checkpointscited by 1,346
- 2024Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Dualitycited by 1,336
- 2023AWQ: Activation-aware Weight Quantization for LLM Compression and Accelerationcited by 1,298
18 more
- 2024DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts Language Modelcited by 1,135
- 2023RWKV: Reinventing RNNs for the Transformer Eracited by 827
- 2019Compressive Transformers for Long-Range Sequence Modellingcited by 726
- 2019Fast Transformer Decoding: One Write-Head is All You Needcited by 717
- 2023Retentive Network: A Successor to Transformer for Large Language Modelscited by 613
- 2021Linear Transformers Are Secretly Fast Weight Programmerscited by 502
- 2023Ring Attention with Blockwise Transformers for Near-Infinite Contextcited by 457
- 2024Parallelizing Linear Transformers with the Delta Rule over Sequence Lengthcited by 396
- 2014Memory Networkscited by 363
- 2023DeepSpeed Ulysses: System Optimizations for Enabling Training of Extreme Long Sequence Transformer Modelscited by 245
- 2024Repeat After Me: Transformers are Better than State Space Models at Copyingcited by 216
- 2024BABILong: Testing the Limits of LLMs with Long Context Reasoning-in-a-Haystackcited by 215
- 2022Recurrent Memory Transformercited by 203
- 2024The Illusion of State in State-Space Modelscited by 187
- 2022Speculative Decoding: Exploiting Speculative Execution for Accelerating Seq2seq Generationcited by 171
- 2023What Formal Languages Can Transformers Express? A Surveycited by 124
- 2022Block-Recurrent Transformerscited by 110
- 2024Associative Recurrent Memory Transformercited by 15
Built on by
Citing papers per year: 2026: 2.
2 papers.
- 2026Extending LLM Context via Associative Recurrent Memorycited by 0
- 2026BCMT: Blockwise Causal Memory Transformercited by 0
- 2026Extending LLM Context via Associative Recurrent Memory13 Jul 2026
- 2026BCMT: Blockwise Causal Memory Transformer6 Jul 2026