Hardware-aligned Hierarchical Sparse Attention for Efficient Long-term Memory Access
Xiang Hu, Jiaqi Leng, Jun Zhao, Kewei Tu, Wei Wu
摘要
A key advantage of Recurrent Neural Networks (RNNs) over Transformers is their linear computational and space complexity enables faster training and inference for long sequences. However, RNNs are fundamentally unable to randomly access historical context, and simply integrating attention mechanisms may undermine their efficiency advantages. To overcome this limitation, we propose Hierarchical Sparse Attention (HSA), a novel attention mechanism that enhances RNNs with long-range random access flexibility while preserving their merits in efficiency and length generalization. HSA divides inputs into chunks, selects the top- chunks and hierarchically aggregates information. The core innovation lies in learning token-to-chunk relevance based on fine-grained token-level information inside each chunk. This approach enhances the precision of chunk selection across both in-domain and out-of-domain context lengths. To make HSA efficient, we further introduce a hardware-aligned kernel design. By combining HSA with Mamba, we introduce RAMba, which achieves perfect accuracy in passkey retrieval across 64 million contexts despite pre-training on only 4K-length contexts, and significant improvements on various downstream tasks, with nearly constant memory footprint. These results show RAMba's huge potential in long-context modeling.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 2 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention 引用了 Reformer: The Efficient Transformer
- LoRA: Low-Rank Adaptation of Large Language Models 引用了 Language Models are Few-Shot Learners
- Big Bird: Transformers for Longer Sequences 引用了 Reformer: The Efficient Transformer
- Understanding and Improving Length Generalization in Hierarchical Sparse Attention Models 引用了 Big Bird: Transformers for Longer Sequences
- Understanding and Improving Length Generalization in Hierarchical Sparse Attention Models 引用了 Reformer: The Efficient Transformer
- Understanding and Improving Length Generalization in Hierarchical Sparse Attention Models 引用了 Language Models are Few-Shot Learners
- Understanding and Improving Length Generalization in Hierarchical Sparse Attention Models 引用了 Every Token Counts: Generalizing 16M Ultra-Long Context in Large Language Models
- Every Token Counts: Generalizing 16M Ultra-Long Context in Large Language Models 引用了 Understanding and Improving Length Generalization in Hierarchical Sparse Attention Models
- Every Token Counts: Generalizing 16M Ultra-Long Context in Large Language Models 引用了 Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention
- Every Token Counts: Generalizing 16M Ultra-Long Context in Large Language Models 引用了 Language Models are Few-Shot Learners
引用它的顶会 Paper2
- Understanding and Improving Length Generalization in Hierarchical Sparse Attention ModelsJiaqi Leng, Xiang Hu, Junxiong Wang, Jianguo Li 等ICLR 2026 · 6 次引用
- Every Token Counts: Generalizing 16M Ultra-Long Context in Large Language ModelsXiang Hu, Zhanchao Zhou, Ruiqi Liang, Zehuan Li 等ACL 2026 · 2 次引用
它引用的 Paper29
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah 等NeurIPS 2020 · 64,255 次引用
- LoRA: Low-Rank Adaptation of Large Language ModelsEdward J. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu 等ICLR 2022 · 18,833 次引用
- Big Bird: Transformers for Longer SequencesManzil Zaheer, Guru Guruganesh, Kumar Avinava Dubey, Joshua Ainslie 等NeurIPS 2020 · 3,159 次引用
- Reformer: The Efficient TransformerNikita Kitaev, Lukasz Kaiser, Anselm LevskayaICLR 2020 · 2,878 次引用
- Transformers are RNNs: Fast Autoregressive Transformers with Linear AttentionAngelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, François FleuretICML 2020 · 2,665 次引用
相关 Paper
- Samba: Simple Hybrid State Space Models for Efficient Unlimited Context Language ModelingLiliang Ren, Yang Liu, Yadong Lu, Yelong Shen 等ICLR 2025
- Linear-Time and Constant-Memory Text Embeddings Based on Recurrent Language ModelsTobias Grantner, Emanuel Sallinger, Martin FlechlACL 2026
- Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse AttentionJingyang Yuan, Huazuo Gao, Damai Dai, Junyu Luo 等ACL 2025 · 334 次引用
- RAT: Bridging RNN Efficiency and Attention Accuracy via Chunk-based Sequence ModelingXiuying Wei, Anunay Yadav, Razvan Pascanu, Caglar GulcehreNeurIPS 2025 · 3 次引用
- Long-Context Modeling with Dynamic Hierarchical Sparse Attention for Memory-Constrained LLM InferenceSiheng Xiong, Joe Zou, Faramarz Fekri, Yae Jee ChoICML 2026
