FlashMask-3: Efficient and Expressive Mask-Aware Distributed Attention
Guoxia Wang, Qianyue He, Siming Wu, Haoyang Xie, Qiwen Bao, Jinle Zeng, Jiabin Yang, Dianhai Yu, TIAN WU
NeurIPS page · OpenReview · Open on the map
Category: Efficient LLM Inference & Training › Sparse Long-Context Attention · Type: new method · Keywords: attention masks, distributed training, GPU optimization, sparse masks, context parallelism
Areas: Long Context › Long-context mechanisms › Attention optimizations; Model Architectures & Sequence Modeling › Language Model Architectures › Sparse Attention
Summary
FlashMask-3 introduces a mask-aware distributed attention kernel that leverages a column-wise sparse mask and a three-role warp-specialized design on Hopper GPUs, achieving up to 5× higher throughput than existing methods in long-context training.
Explained to a 5-year-old
We want to help big computer programs learn from very long stories. These programs use a special mask to decide which parts of the story to look at. The mask is like a map that tells the computer which words to connect. Making this map for many computers at once is slow and uses a lot of memory. The new idea makes the map simpler and lets the computers share the work without talking to each other a lot. This makes the learning faster and uses less memory, so the programs can learn longer stories more easily.
Explained to a 5-year-old, longer
Imagine you have a huge book with thousands of pages and you want to read it together with friends. Each friend can only look at a small part of the book at a time, and you need a map to tell each friend which pages are important for them to read. The old maps were big and complicated, so they took a lot of space and time to copy. The new method creates a much simpler map that works like a set of lines showing where the important pages start and end. This simple map can be shared quickly without everyone needing to copy the whole thing. The computers also have a special way of working together, like a team where some workers prepare data, some do the calculations, and some send the results, all at the same time. This teamwork makes the whole reading process faster and uses less memory, so you can read much longer books without slowing down.
For a technical reader
The paper presents a column-wise sparse mask that reduces mask storage from O(n2) to O(n) and enables zero-communication localization in distributed settings. It builds a mask-aware kernel on Hopper GPUs that integrates with FlashAttention-3’s TMA/WGMMA pipeline using three warp roles, adds a sparsity-aware load balancer, and prunes communication based on the mask. Experiments show up to 141% TFLOPs gain and 5× throughput improvement over existing methods.
Problem
Training large language and multimodal models on long sequences requires expressive structured attention masks, which become a dominant bottleneck when combined with multi-node context parallelism, leading to high memory usage and communication overhead.
Method
The approach uses a column-wise sparse mask representation that enables zero-communication mask localization, integrates a three-role warp-specialized kernel with FlashAttention-3’s TMA/WGMMA pipeline, adds a sparsity-aware load balancer, and applies mask-driven communication pruning with hierarchical routing for distributed training.
Results
The approach achieves up to 141% TFLOPs improvement over prior mask schemes and up to 5.11× throughput gains under distributed context parallelism, with compute-communication overlap efficiencies of 31-75%.
Contributions
It introduces a column-wise sparse mask enabling provably zero-communication localization, a mask-aware Hopper kernel with three-role warp specialization, a sparsity-aware load balancer, and mask-driven communication pruning with hierarchical routing for efficient distributed attention.
Practical relevance
Enables small teams and large-scale deployments to train long-context models more efficiently on modern GPU clusters.
Research questions this paper is counted under
This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. Suggest a correction