MInference 1.0: Accelerating Pre-filling for Long-Context LLMs via Dynamic Sparse Attention
Huiqiang Jiang, Yucheng Li, Chengruidong Zhang, Qianhui Wu, Xufang Luo, Surin Ahn, Zhenhua Han, Amir H. Abdi, Dongsheng Li, Chin-Yew Lin, Yuqing Yang, Lili Qiu
摘要
The computational challenges of Large Language Model (LLM) inference remain a significant barrier to their widespread deployment, especially as prompt lengths continue to increase. Due to the quadratic complexity of the attention computation, it takes 30 minutes for an 8B LLM to process a prompt of 1M tokens (i.e., the pre-filling stage) on a single A100 GPU. Existing methods for speeding up prefilling often fail to maintain acceptable accuracy or efficiency when applied to long-context LLMs. To address this gap, we introduce MInference (Milliontokens Inference), a sparse calculation method designed to accelerate pre-filling of long-sequence processing. Specifically, we identify three unique patterns in long-context attention matrices-the A-shape, Vertical-Slash, and Block-Sparsethat can be leveraged for efficient sparse computation on GPUs. We determine the optimal pattern for each attention head offline and dynamically build sparse indices based on the assigned pattern during inference. With the pattern and sparse indices, we perform efficient sparse attention calculations via our optimized GPU kernels to significantly reduce the latency in the pre-filling stage of long-context LLMs. Our proposed technique can be directly applied to existing LLMs without any modifications to the pre-training setup or additional fine-tuning. By evaluating on a wide range of downstream tasks, including InfiniteBench, RULER, PG-19, and Needle In A Haystack, and models including LLaMA-3-1M, GLM4-1M, Yi-200K, Phi-3-128K, and Qwen2-128K, we demonstrate that MInference effectively reduces inference latency by up to 10x for pre-filling on an A100, while maintaining accuracy. Our code is available at https://aka.ms/MInference.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 169 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention 引用了 Reformer: The Efficient Transformer
- Big Bird: Transformers for Longer Sequences 引用了 Reformer: The Efficient Transformer
- MoBA: Mixture of Block Attention for Long-Context LLMs 引用了 Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention
- MoBA: Mixture of Block Attention for Long-Context LLMs 引用了 Big Bird: Transformers for Longer Sequences
- MoBA: Mixture of Block Attention for Long-Context LLMs 引用了 Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse Attention
- MoBA: Mixture of Block Attention for Long-Context LLMs 引用了 Reformer: The Efficient Transformer
- MoBA: Mixture of Block Attention for Long-Context LLMs 引用了 RetrievalAttention: Accelerating Long-Context LLM Inference via Vector Retrieval
- Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse Attention 引用了 Big Bird: Transformers for Longer Sequences
- Efficiently Modeling Long Sequences with Structured State Spaces 引用了 Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention
- Neural Attention Search 引用了 MoBA: Mixture of Block Attention for Long-Context LLMs
- Neural Attention Search 引用了 Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse Attention
- Neural Attention Search 引用了 Ada-KV: Optimizing KV Cache Eviction by Adaptive Budget Allocation for Efficient LLM Inference
- RetrievalAttention: Accelerating Long-Context LLM Inference via Vector Retrieval 引用了 Big Bird: Transformers for Longer Sequences
- RetrievalAttention: Accelerating Long-Context LLM Inference via Vector Retrieval 引用了 Reformer: The Efficient Transformer
- Ada-KV: Optimizing KV Cache Eviction by Adaptive Budget Allocation for Efficient LLM Inference 引用了 RetrievalAttention: Accelerating Long-Context LLM Inference via Vector Retrieval
引用它的顶会 Paper169
- Neural Attention SearchDifan Deng, Marius LindauerNeurIPS 2025 · 431 次引用
- Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse AttentionJingyang Yuan, Huazuo Gao, Damai Dai, Junyu Luo 等ACL 2025 · 334 次引用
- Ada-KV: Optimizing KV Cache Eviction by Adaptive Budget Allocation for Efficient LLM InferenceYuan Feng, Junlin Lv, Yukun Cao, Xike Xie 等NeurIPS 2025 · 256 次引用
- MoBA: Mixture of Block Attention for Long-Context LLMsEnzhe Lu, Zhejun Jiang, Jingyuan Liu, Yulun Du 等NeurIPS 2025 · 219 次引用
- RetrievalAttention: Accelerating Long-Context LLM Inference via Vector RetrievalDi Liu, Meng Chen, Baotong Lu, Huiqiang Jiang 等NeurIPS 2025 · 148 次引用
它引用的 Paper47
- Visual Instruction TuningHaotian Liu, Chunyuan Li, Qingyang Wu, Yong Jae LeeNeurIPS 2023 · 11,349 次引用
- Efficiently Modeling Long Sequences with Structured State SpacesAlbert Gu, Karan Goel, Christopher RéICLR 2022 · 3,482 次引用
- 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
- MMInference: Accelerating Pre-filling for Long-Context Visual Language Models via Modality-Aware Permutation Sparse AttentionYucheng Li, Huiqiang Jiang, Chengruidong Zhang, Qianhui Wu 等ICML 2025
- SALE : Low-bit Estimation for Efficient Sparse Attention in Long-context LLM PrefillingXiaodong Ji, Hailin Zhang, Fangcheng Fu, Bin CuiICML 2026 · 3 次引用
- FlexPrefill: A Context-Aware Sparse Attention Mechanism for Efficient Long-Sequence InferenceXunhao Lai, Jianqiao Lu, Yao Luo, Yiyuan Ma 等ICLR 2025
- A Unified Sparse Attention via Multi-Granularity CompressionSiran Liu, Zheng Cao, Yongchao HeICML 2026
- Sparser Block-Sparse Attention via Token PermutationXinghao Wang, Pengyu Wang, Dong Zhang, Chenkun Tan 等ICML 2026 · 2 次引用
