mlsanityData to 14 Oct 2026

FlashMask: Efficient and Rich Mask Extension of FlashAttention

arXiv 2410.01359 ↗First posted 2 Oct 2024cs.LGcited by 20

Not on the map. Why?

Abstract (arXiv)

The computational and memory demands of vanilla attention scale quadratically with the sequence length N, posing significant challenges for processing long sequences in Transformer models. FlashAttention alleviates these challenges by eliminating the O(N2) memory dependency and reducing attention latency through IO-aware memory optimizations. However, its native support for certain attention mask types is limited, and it does not inherently accommodate more complex masking requirements. Previous approaches resort to using dense masks with O(N2) memory complexity, leading to inefficiencies. In this paper, we propose FlashMask, an extension of FlashAttention that introduces a column-wise sparse representation of attention masks. This approach efficiently represents a wide range of mask types and facilitates the development of optimized kernel implementations. By adopting this novel representation, FlashMask achieves linear memory complexity O(N), suitable for modeling long-context sequences. Moreover, this representation enables kernel optimizations that eliminate unnecessary computations by leveraging sparsity in the attention mask, without sacrificing computational accuracy, resulting in higher computational efficiency. We evaluate FlashMask's performance in fine-tuning and alignment training of LLMs such as SFT, LoRA, DPO, and RM. FlashMask achieves significant throughput improvements, with end-to-end speedups ranging from 1.65x to 3.22x compared to existing FlashAttention dense method. Additionally, our kernel-level comparisons demonstrate that FlashMask surpasses the latest counterpart, FlexAttention, by 12.1% to 60.7% in terms of kernel TFLOPs/s, achieving 37.8% to 62.3% of the theoretical maximum FLOPs/s on the A100 GPU. The code is open-sourced on PaddlePaddle and integrated into PaddleNLP, supporting models with over 100 billion parameters for contexts up to 128K tokens.

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

Builds on

28 of 38 references.

References · 28

  1. 2017Attention Is All You Needcited by 60,361
  2. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
  3. 2023GPT-4 Technical Reportcited by 18,396
  4. 2022Training language models to follow instructions with human feedbackcited by 15,971
  5. 2017Proximal Policy Optimization Algorithmscited by 15,215
  6. 2024The Llama 3 Herd of Modelscited by 14,715
  7. 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,599
  8. 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,380
  9. 2024DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Modelscited by 9,379
  10. 2023Direct Preference Optimization: Your Language Model is Secretly a Reward Modelcited by 8,065
  11. 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,673
  12. 2020Longformer: The Long-Document Transformercited by 3,413
16 more
  1. 2024Gemini 1.5: Unlocking multimodal understanding across millions of tokens of contextcited by 3,224
  2. 2022Scaling Instruction-Finetuned Language Modelscited by 3,024
  3. 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,598
  4. 2020Reformer: The Efficient Transformercited by 1,668
  5. 2024DoRA: Weight-Decomposed Low-Rank Adaptationcited by 758
  6. 2023RAFT: Reward rAnked FineTuning for Generative Foundation Model Alignmentcited by 686
  7. 2023Statistical Rejection Sampling Improves Preference Optimizationcited by 323
  8. 2023LongLoRA: Efficient Fine-tuning of Long-Context Large Language Modelscited by 244
  9. 2022OPT-IML: Scaling Language Model Instruction Meta Learning through the Lens of Generalizationcited by 236
  10. 2023Patch n' Pack: NaViT, a Vision Transformer for any Aspect Ratio and Resolutioncited by 229
  11. 2018Online normalizer calculation for softmaxcited by 162
  12. 2021Self-attention Does Not Need O(n2) Memorycited by 154
  13. 2024In-Context Learning with Long-Context Models: An In-Depth Explorationcited by 128
  14. 2024LiPO: Listwise Preference Optimization through Learning-to-Rankcited by 96
  15. 2024NACL: A General and Effective KV Cache Eviction Framework for LLMs at Inference Timecited by 43
  16. 2023Faster Causal Attention Over Large Sequences Through Sparse Flash Attentioncited by 25

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2024: 1; 2025: 10; 2026: 9.

20 papers.

Sort:

By area:

  1. 2025MAGI-1: Autoregressive Video Generation at Scalecited by 276
  2. 2024Flex Attention: A Programming Model for Generating Optimized Attention Kernelscited by 185
  3. 2025Inference-Time Hyper-Scaling with KV Cache Compressioncited by 27
  4. 2025FlashBias: Fast Computation of Attention with Biascited by 11
  5. 2026ERNIE 5.0 Technical Reportcited by 11
  6. 2025DCP: Addressing Input Dynamism In Long-Context Training via Dynamic Context Parallelismcited by 7
  7. 2026Toward Native Multimodal Modeling: A Roadmapcited by 7
  8. 2025Tree Training: Accelerating Agentic LLMs Training via Shared Prefix Reusecited by 5
  9. 2025Attention in Diffusion Model: A Surveycited by 4
  10. 2025FG-Attn: Leveraging Fine-Grained Sparse Attention in Video Diffusion Modelscited by 4
  11. 2026MaxCode: A Max-Reward Reinforcement Learning Framework for Automated Code Optimizationcited by 4
  12. 2025Unifying and Enhancing Graph Transformers via a Hierarchical Mask Frameworkcited by 2
8 more
  1. 2026CuBridge: An LLM-Based Framework for Understanding and Reconstructing High-Performance Attention Kernelscited by 2
  2. 2025A Scalable Distributed Framework for Multimodal GigaVoxel Image Registrationcited by 1
  3. 2026SAFE-DiT: Semantics-Aware Fast-path Execution for High-Resolution Diffusion Transformerscited by 1
  4. 2025Accelerating Sparse Transformer Inference on GPUcited by 0
  5. 2026Graphical einops: bridging tensor networks and computation graphscited by 0
  6. 2026SPADE: An Input-Adaptive Sparse Attention Engine for Fast Video Diffusion Models Inferencecited by 0
  7. 2026Competition Domains Matter: Selective Head Globalization for Training-Free Sparse Attention in Video Diffusion Transformerscited by 0
  8. 2026FlashMask-3: Efficient and Expressive Mask-Aware Distributed Attentioncited by 0

Similar, not cited

Close in wording, no citation either way

  1. 2025SCOUT: Toward Sub-Quadratic Attention via Segment Compression for Optimized Utility in Transformers
  2. 2023Gated Linear Attention Transformers with Hardware-Efficient Training
  3. 2026QFlash: Bridging Quantization and Memory Efficiency in Vision Transformer Attention
  4. 2021Energon: Towards Efficient Acceleration of Transformers Using Dynamic Sparse Attention
  5. 2023AttMEMO : Accelerating Transformers with Memoization on Big Memory Systems
  6. 2025FlashOmni: A Unified Sparse Attention Engine for Diffusion Transformers
  7. 2023FlashFFTConv: Efficient Convolutions for Long Sequences with Tensor Cores
  8. 2026Scaling Attention via Feature Sparsity