Block Sparse Flash Attention
Not on the map. Why?
Abstract (arXiv)
Modern large language models increasingly require long contexts for reasoning and multi-document tasks, but attention's quadratic complexity creates a severe computational bottleneck. We present Block Sparse Flash Attention (BSFA), a drop-in replacement that accelerates long-context inference while preserving model quality. Unlike methods that predict importance before computing scores, BSFA computes exact query-key similarities to select the top-k most important value blocks for each query. By comparing per-block maximum scores against calibrated thresholds, we skip approximately 50% of the computation and memory transfers for pruned blocks. Our training-free approach requires only a one-time threshold calibration on a small dataset to learn the per-layer and per-head attention score distributions. We provide a CUDA kernel implementation that can be used as a drop-in replacement for FlashAttention. On Llama-3.1-8B, BSFA achieves up to 1.13x end-to-end speedup on LongBench with only a 1.1% accuracy drop, and up to 1.24x on Needle-in-a-Haystack retrieval at a 1% accuracy drop. The attention kernel itself accelerates by up to 1.38x. We compare BSFA against five recent sparse attention baselines (SpargeAttention, MInference, FlexPrefill, XAttention, and BLASST), and verify the method on Qwen2.5-7B and on A6000 and H100 GPUs. The implementation is available at https://github.com/Danielohayon/Block-Sparse-Flash-Attention.
Key facts. Cited by 2 papers in the map (data through 14 Oct 2026). Builds on 33 of its 39 references that are in the map. First posted on arXiv 7 Dec 2025.
Builds on
33 of 39 references.
References · 33
- 2017Attention Is All You Needcited by 60,361
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,459
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,297
- 2022Large Language Models are Zero-Shot Reasonerscited by 4,374
- 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,673
- 2020Longformer: The Long-Document Transformercited by 3,413
- 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,598
- 2023Efficient Streaming Language Models with Attention Sinkscited by 2,186
- 2020Reformer: The Efficient Transformercited by 1,668
- 2020Rethinking Attention with Performerscited by 1,601
- 2019Generating Long Sequences with Sparse Transformerscited by 1,546
21 more
- 2023LongBench: A Bilingual, Multitask Benchmark for Long Context Understandingcited by 1,417
- 2024RULER: What's the Real Context Size of Your Long-Context Language Models?cited by 1,346
- 2021Improving language models by retrieving from trillions of tokenscited by 1,293
- 2023Large Language Modelscited by 780
- 2024Quest: Query-Aware Sparsity for Efficient Long-Context LLM Inferencecited by 501
- 2020Efficient Content-Based Sparse Attention with Routing Transformerscited by 471
- 2021Nystr"omformer: A Nystr"om-Based Algorithm for Approximating Self-Attentioncited by 471
- 2021Attention is Not All You Need: Pure Attention Loses Rank Doubly Exponentially with Depthcited by 419
- 2024MInference 1.0: Accelerating Pre-filling for Long-Context LLMs via Dynamic Sparse Attentioncited by 383
- 2024SageAttention: Accurate 8-Bit Attention for Plug-and-play Inference Accelerationcited by 160
- 2025XAttention: Block Sparse Attention with Antidiagonal Scoringcited by 137
- 2024SeerAttention: Learning Intrinsic Sparse Attention in Your LLMscited by 124
- 2025FlexPrefill: A Context-Aware Sparse Attention Mechanism for Efficient Long-Sequence Inferencecited by 123
- 2025SpargeAttention: Accurate and Training-free Sparse Attention Accelerating Any Model Inferencecited by 120
- 2023Fast Attention Requires Bounded Entriescited by 102
- 2025KVzip: Query-Agnostic KV Cache Compression with Context Reconstructioncited by 95
- 2021Memory-efficient Transformers via Top-k Attentioncited by 60
- 2024Sparser is Faster and Less is More: Efficient Sparse Attention for Long-Range Transformerscited by 52
- 2025The emergence of sparse attention: impact of data distribution and benefits of repetitioncited by 25
- 2024Fundamental Limitations on Subquadratic Alternatives to Transformerscited by 9
- 2025Delta Attention: Fast and Accurate Sparse Attention Inference by Delta Correctioncited by 7
Built on by
Citing papers per year: 2026: 2.
2 papers.