RecurFormer: Not All Transformer Heads Need Self-Attention
Not on the map. Why?
Abstract (arXiv)
Transformer-based large language models (LLMs) excel in modeling complex language patterns but face significant computational costs during inference, especially with long inputs due to the attention mechanism's memory overhead. We observe that certain attention heads exhibit a distribution where the attention weights concentrate on tokens near the query token, termed as recency aware, which focuses on local and short-range dependencies. Leveraging this insight, we propose RecurFormer, a novel architecture that replaces these attention heads with linear recurrent neural networks (RNNs), specifically the Mamba architecture. This replacement reduces the cache size without evicting tokens, thus maintaining generation quality. RecurFormer retains the ability to model long-range dependencies through the remaining attention heads and allows for reusing pre-trained Transformer-based LLMs weights with continual training. Experiments demonstrate that RecurFormer matches the original model's performance while significantly enhancing inference efficiency. Our approach provides a practical solution to the computational challenges of Transformer-based LLMs inference, making it highly attractive for tasks involving long inputs.
Key facts. Cited by 2 papers in the map (data through 7 Oct 2026). Builds on 24 of its 27 references that are in the map. First posted on arXiv 10 Oct 2024.
Builds on
24 of 27 references.
References · 24
- 2017Attention Is All You Needcited by 59,932
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2023GPT-4 Technical Reportcited by 18,132
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
- 2023Efficient Memory Management for Large Language Model Serving with PagedAttentioncited by 5,767
- 2023Mamba: Linear-Time Sequence Modeling with Selective State Spacescited by 4,616
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,581
- 2023Qwen Technical Reportcited by 3,273
- 2021Efficiently Modeling Long Sequences with Structured State Spacescited by 2,424
- 2020Big Bird: Transformers for Longer Sequencescited by 1,673
- 2023GQA: Training Generalized Multi-Query Transformer Models from Multi-Head Checkpointscited by 1,311
- 2023H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Modelscited by 805
12 more
- 2020HiPPO: Recurrent Memory with Optimal Polynomial Projectionscited by 600
- 2022Hungry Hungry Hippos: Towards Language Modeling with State Space Modelscited by 495
- 2023Scissorhands: Exploiting the Persistence of Importance Hypothesis for LLM KV Cache Compression at Test Timecited by 428
- 2024Repeat After Me: Transformers are Better than State Space Models at Copyingcited by 208
- 2024Simple linear attention language models balance the recall-throughput tradeoffcited by 197
- 2024PyramidInfer: Pyramid KV Cache Compression for High-throughput LLM Inferencecited by 148
- 2017Parallelizing Linear Recurrent Neural Nets Over Sequence Lengthcited by 126
- 2024Dynamic Memory Compression: Retrofitting LLMs for Accelerated Inferencecited by 115
- 2024A Simple and Effective L2 Norm-Based Strategy for KV Cache Compressioncited by 84
- 2024Attention Score is not All You Need for Token Importance Indicator in KV Cache Reduction: Value Also Matterscited by 73
- 2016Strongly-Typed Recurrent Neural Networkscited by 13
- 2024Unveiling and Controlling Anomalous Attention Distribution in Transformerscited by 2
Built on by
Citing papers per year: 2024: 1; 2025: 1.
2 papers.
Similar, not cited
Close in wording, no citation either way
- 2025Is Random Attention Sufficient for Sequence Modeling? Disentangling Trainable Components in the Transformer
- 2025Pimba: A Processing-in-Memory Acceleration for Post-Transformer Large Language Model Serving
- 2025Speed Always Wins: A Survey on Efficient Architectures for Large Language Models
- 2024Star Attention: Efficient LLM Inference over Long Sequences
- 2025Forgetting Transformer: Softmax Attention with a Forget Gate
- 2026Linear Predictability of Attention Heads in Large Language Models
- 2025Distil-xLSTM: Learning Attention Mechanisms through Recurrent Structures
- 2025Efficient Prompt Compression with Evaluator Heads for Long-Context Transformer Inference