FlashMask-3: Efficient and Expressive Mask-Aware Distributed Attention
FlashMask-3 adds Hopper and distributed mask-aware attention, raising long-context training throughput over prior kernels.
FlashMask-3 extends column-wise sparse attention masks to Hopper GPUs and multi-node context parallelism. It uses a three-role warp-specialized kernel on FlashAttention-3's TMA/WGMMA pipeline, zero-communication mask localization, a sparsity-aware load balancer, and mask-driven communication pruning. On one H100, across 12 masks at 4K-128K context, it improves achieved TFLOPs by 45-141% over FlashMask, 34-71% over FlexAttention, and 2-44% over MagiAttention. At context-parallel degrees 4-32 it reaches 31-75% compute-communication overlap, and training a 118B-A14B MoE at 128K on 128 H100s raises throughput 7.3-11.0% over a Dual Chunk all-gather baseline.
- FlashMask-3 adds a mask-aware Hopper kernel on FlashAttention-3's TMA/WGMMA pipeline.
- Mask localization across context-parallel ranks needs zero communication via clip-shift-max.
- Single-H100 TFLOPs rise 45-141% over FlashMask across 12 masks at 4K-128K context.
- On 128 H100s, a 118B-A14B MoE at 128K gains 7.3-11.0% end-to-end throughput.
- Vendors
- NVIDIA
From the original article
1 min read at huggingface.coLong-context training of large language and multimodal models couples structured attention masks (document, prefix-LM, share-question, sliding-window, block-sparse) with multi-node context parallelism, making the mask a dominant bottleneck. FlashMask's column-wise sparse mask compresses them from O(n^2) to O(n) via four query-axis boundary vectors, covering broad structured patterns.
By Guoxia Wang, Qianyue He, Siming Wu · huggingface.co
A short excerpt; the article and its images belong to the publisher. Summary, key facts and assessment above are AI-written from the article and can be wrong.