mlsanityData to 14 Oct 2026

Efficiently Dispatching Flash Attention For Partially Filled Attention Masks

arXiv 2409.15097 ↗First posted 23 Sep 2024cs.LG cs.AI cs.CLcited by 2

Not on the map. Why?

Abstract (arXiv)

Transformers are widely used across various applications, many of which yield sparse or partially filled attention matrices. Examples include attention masks designed to reduce the quadratic complexity of attention, sequence packing techniques, and recent innovations like tree masking for fast validation in MEDUSA. Despite the inherent sparsity in these matrices, the state-of-the-art algorithm Flash Attention still processes them with quadratic complexity as though they were dense. In this paper, we introduce Binary Block Masking, a highly efficient modification that enhances Flash Attention by making it mask-aware. We further propose two optimizations: one tailored for masks with contiguous non-zero patterns and another for extremely sparse masks. Our experiments on attention masks derived from real-world scenarios demonstrate up to a 9x runtime improvement. The implementation will be publicly released to foster further research and application.

Key facts. Cited by 2 papers in the map (data through 14 Oct 2026). Builds on 19 of its 29 references that are in the map. First posted on arXiv 23 Sep 2024.

Builds on

19 of 29 references.

References · 19

  1. 2017Attention Is All You Needcited by 60,361
  2. 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,599
  3. 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,673
  4. 2020Longformer: The Long-Document Transformercited by 3,413
  5. 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,598
  6. 2020Big Bird: Transformers for Longer Sequencescited by 1,684
  7. 2020Reformer: The Efficient Transformercited by 1,668
  8. 2022Fast Inference from Transformers via Speculative Decodingcited by 1,653
  9. 2019Generating Long Sequences with Sparse Transformerscited by 1,546
  10. 2020Linformer: Self-Attention with Linear Complexitycited by 1,474
  11. 2023Accelerating Large Language Model Decoding with Speculative Samplingcited by 1,006
  12. 2024Medusa: Simple LLM Inference Acceleration Framework with Multiple Decoding Headscited by 843
7 more
  1. 2020Efficient Transformers: A Surveycited by 790
  2. 2024FlashAttention-3: Fast and Accurate Attention with Asynchrony and Low-precisioncited by 519
  3. 2021A Survey of Transformerscited by 401
  4. 2023SpecInfer: Accelerating Generative Large Language Model Serving with Tree-based Speculative Inference and Verificationcited by 365
  5. 2023Accelerating LLM Inference with Staged Speculative Decodingcited by 151
  6. 2019Learning Fast Algorithms for Linear Transforms Using Butterfly Factorizationscited by 76
  7. 2023Sparsifiner: Learning Sparse Instance-Dependent Attention for Efficient Vision Transformerscited by 16

Built on by

Cited by year

Citing papers per year: 2025: 2.

2 papers.