Lune

ICLR2025顶会

FlexPrefill: A Context-Aware Sparse Attention Mechanism for Efficient Long-Sequence Inference

Xunhao Lai, Jianqiao Lu, Yao Luo, Yiyuan Ma, Xun Zhou

摘要

Large language models (LLMs) encounter computational challenges during long-sequence inference, especially in the attention pre-filling phase, where the complexity grows quadratically with the prompt length. Previous efforts to mitigate these challenges have relied on fixed sparse attention patterns or identifying sparse attention patterns based on limited cases. However, these methods lacked the flexibility to efficiently adapt to varying input demands. In this paper, we introduce FlexPrefill, a Flexible sparse Pre-filling mechanism that dynamically adjusts sparse attention patterns and computational budget in real-time to meet the specific requirements of each input and attention head. The flexibility of our method is demonstrated through two key innovations: 1) Query-Aware Sparse Pattern Determination: By measuring Jensen-Shannon divergence, this component adaptively switches between query-specific diverse attention patterns and predefined attention patterns. 2) Cumulative-Attention Based Index Selection: This component dynamically selects query-key indexes to be computed based on different attention patterns, ensuring the sum of attention scores meets a predefined threshold.FlexPrefill adaptively optimizes the sparse pattern and sparse ratio of each attention head based on the prompt, enhancing efficiency in long-sequence inference tasks. Experimental results show significant improvements in both speed and accuracy over prior methods, providing a more flexible and efficient solution for LLM inference.

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 57 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

全文 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • Efficient Streaming Language Models with Attention Sinks 引用了 Big Bird: Transformers for Longer Sequences
  • Efficient Streaming Language Models with Attention Sinks 引用了 FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
  • Efficient Streaming Language Models with Attention Sinks 引用了 FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning
  • Block-Sparse Global Attention for Efficient Multi-View Geometry Transformers 引用了 FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
  • Block-Sparse Global Attention for Efficient Multi-View Geometry Transformers 引用了 FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning
  • Flow Caching for Autoregressive Video Generation 引用了 Sparse VideoGen2: Accelerate Video Generation with Sparse Attention via Semantic-Aware Permutation
  • FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness 引用了 Big Bird: Transformers for Longer Sequences
  • FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness 引用了 Efficiently Modeling Long Sequences with Structured State Spaces
  • FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning 引用了 Big Bird: Transformers for Longer Sequences
  • FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning 引用了 FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
  • InfLLM-V2: Dense-Sparse Switchable Attention for Seamless Short-to-Long Adaptation 引用了 Efficient Streaming Language Models with Attention Sinks
  • InfLLM-V2: Dense-Sparse Switchable Attention for Seamless Short-to-Long Adaptation 引用了 Big Bird: Transformers for Longer Sequences
  • InfLLM-V2: Dense-Sparse Switchable Attention for Seamless Short-to-Long Adaptation 引用了 FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning
  • Neural Attention Search 引用了 Efficient Streaming Language Models with Attention Sinks
  • Neural Attention Search 引用了 FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
  • Neural Attention Search 引用了 FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning
  • Sparse VideoGen2: Accelerate Video Generation with Sparse Attention via Semantic-Aware Permutation 引用了 Efficient Streaming Language Models with Attention Sinks
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper57

  1. Neural Attention SearchDifan Deng, Marius LindauerNeurIPS 2025 · 431 次引用
  2. Sparse VideoGen2: Accelerate Video Generation with Sparse Attention via Semantic-Aware PermutationShuo Yang, Haocheng Xi, Yilong Zhao, Muyang Li 等NeurIPS 2025 · 114 次引用
  3. InfLLM-V2: Dense-Sparse Switchable Attention for Seamless Short-to-Long AdaptationWeilin Zhao, Zihan Zhou, Zhou Su, Chaojun Xiao 等ICLR 2026 · 32 次引用
  4. Block-Sparse Global Attention for Efficient Multi-View Geometry TransformersChung-Shien Brian Wang, Christian Schmidt, Jens Piekenbrinck, Bastian LeibeCVPR 2026 · 22 次引用
  5. Flow Caching for Autoregressive Video GenerationYuexiao Ma, Xuzhe Zheng, Jing Xu, Xiwei Xu 等ICLR 2026 · 20 次引用

它引用的 Paper35

  1. FlashAttention: Fast and Memory-Efficient Exact Attention with IO-AwarenessTri Dao, Daniel Y. Fu, Stefano Ermon, Atri Rudra 等NeurIPS 2022 · 5,493 次引用
  2. Efficiently Modeling Long Sequences with Structured State SpacesAlbert Gu, Karan Goel, Christopher RéICLR 2022 · 3,482 次引用
  3. Big Bird: Transformers for Longer SequencesManzil Zaheer, Guru Guruganesh, Kumar Avinava Dubey, Joshua Ainslie 等NeurIPS 2020 · 3,159 次引用
  4. FlashAttention-2: Faster Attention with Better Parallelism and Work PartitioningTri DaoICLR 2024 · 2,600 次引用
  5. Efficient Streaming Language Models with Attention SinksGuangxuan Xiao, Yuandong Tian, Beidi Chen, Song Han 等ICLR 2024 · 1,714 次引用

相关 Paper

  1. Elastic Attention: Test-time Adaptive Sparsity Ratios for Efficient TransformersZecheng Tang, Quantong Qiu, Yi Yang, Zhiyi Hong 等ICML 2026 · 4 次引用
  2. MInference 1.0: Accelerating Pre-filling for Long-Context LLMs via Dynamic Sparse AttentionHuiqiang Jiang, Yucheng Li, Chengruidong Zhang, Qianhui Wu 等NeurIPS 2024 · 479 次引用
  3. ProxyAttn: Guided Sparse Attention via Representative HeadsYixuan Wang, Huang He, Siqi Bao, Hua Wu 等ICLR 2026 · 9 次引用
  4. AnchorAttention: Difference-Aware Sparse Attention with Stripe GranularityYu Zhang, Dong Guo, Fang Wu, Guoliang Zhu 等EMNLP 2025
  5. DAM: Dynamic Attention Mask for Long-Context Large Language Model Inference AccelerationHanzhi Zhang, Heng Fan, Kewei Sha, Yan Huang 等ACL Findings 2025 · 1 次引用
黄昏的海面,两侧是细线勾勒的悬崖