Skip to content

FlashMask v4.0.0: Efficient Mask-Aware Attention for Long-Context Training

Latest

Choose a tag to compare

@GuoxiaWang GuoxiaWang released this 03 Nov 07:02
· 13 commits to main since this release
e81416d

Overview

FlashMask is an efficient attention kernel library designed for flexible masking and distributed long-context training.

  • FlashMask (ICLR 2025): Introduced memory-efficient column-wise sparse mask representation, reducing mask storage complexity from O(N²) to O(N), while skipping unnecessary attention computation.
  • FlashMask-3 (NeurIPS 2026): Extended mask-aware attention to distributed long-context training with mask-aware load balancing and communication/computation overlap.
  • FlashMask-4: Introduces high-performance CuTe DSL kernels for NVIDIA Hopper and Blackwell, with support for flexible masks, sink bias, deterministic computation, and large head dimensions.

Key Features

  • Flexible and memory-efficient sparse mask representation.
  • High-performance attention kernels for Hopper (SM90) and Blackwell (SM100).
  • Large head dimension and shared KV optimizations.
  • Mask-aware context parallelism and communication/computation overlap.
  • Native PaddlePaddle and PyTorch interfaces.

Getting Started

See the [README](https://github.com/PaddlePaddle/FlashMask) for installation, usage examples, benchmarks, and supported configurations.

Acknowledgements

FlashMask builds upon [FlashAttention](https://github.com/Dao-AILab/flash-attention). We sincerely thank Tri Dao and the FlashAttention team for their foundational contributions.