acceptodds
Published as a conference paper at NeurIPS 2026

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

Abstract

Long-context training of large language and multimodal models couples expressive structured attention masks (document, prefix-LM, share-question, sliding-window, block-sparse) with multi-node context parallelism, exposing the mask as a dominant bottleneck. The column-wise sparse mask of FlashMask compresses such masks from to via four query-axis boundary vectors and covers a broad family of structured patterns. Implemented for Ampere GPUs, FlashMask does not exploit FlashAttention-3's TMA/WGMMA warp-specialized pipeline on Hopper GPUs, and offers no distributed support. We observe that the column-wise sparse mask is indexed by key positions but stores query-axis interval boundaries. Under any multi-chunk context-parallel assignment, this property reduces per-rank mask localization to a provably zero-communication clip–shift–max on the boundary vectors, directly compatible with the single-GPU kernel. Building on this property, FlashMask-3 introduces a mask-aware Hopper kernel with a three-role warp specialization atop the FlashAttention-3 TMA/WGMMA pipeline, together with a mask-aware distributed extension: zero-communication mask localization, a sparsity-aware load balancer (HCC-IPO), and a mask-aware compute-communication overlap with mask-driven communication pruning, whose forward all-gather additionally adopts topology-aware hierarchical routing. On a single H100 GPU across 12 structured masks at context lengths from 4K to 128K, FlashMask-3 improves achieved TFLOPs over FlashMask, FlexAttention, and MagiAttention by 45% to 141%, 34% to 71%, and 2% to 44%, respectively. Under context-parallel degrees from 4 to 32 with 8K sequence per device, it attains 31% to 75% compute-communication overlap efficiency and improves throughput over Megatron-Core CP (ring), Megatron-Core CP (all-gather) and MagiAttention by to , to and to respectively. The source code will be released on GitHub.

Keywords:
Sydney

Reviews

Among:
Shape:
123456this paper, Top 24%
Figure 1. Mean review rating of the reviewed papers at NeurIPS 2026. This paper averages 4.67 over 3 reviews, above 76% of the others.
Reviewer_FM36OpenReview ↗
Rating
5
Clarity
3
Confidence
3
Originality
3
Quality
3
Significance
3
Read review
Summary

for 8x8 attention mask matrix 0 1 2 3 4 5 6 7 query q=0 . . . . X . . . query q=1 . . . . X . . . query q=2 . . . . . . . . query q=3 . . . . . . . . query q=4 . . . . D . . . query q=5 . . . . X . . . query q=6 . . . . X . . . query q=7 . . . . X . . .

Prior FlashMask stores those masked query rows using two intervals:

  • upper masked interval: [UTS[4], UTE[4]) = [0, 2)
  • lower masked interval: [LTS[4], LTE[4]) = [5, 8)

This FlashMask-3 paper observes that these boundary values are query-axis coordinates, so under context parallelism each rank can convert global boundaries into local boundaries with clip -> shift -> max, without communicating with other ranks.

It implemented mask-aware attention using Hopper TMA/WGMMA, covering warp specialization, tile skipping and scheduling, load balancing

Strengths and weaknesses

Strengths

  • the idea is effective and simple: convert global boundaries into local boundaries with clip -> shift -> max, avoiding cross-rank communication
  • coherent system design from prior FlashMask to this new FlashMast-3, with specialization on Hopper GPUs
  • conducted valuable ablation studies on persistent scheduling, load balancing, and communication overlap

Weakness

  • the specific implementation is very narrowed to column-wise sparse boundary format. General masks would need other implementation
  • lacks FlashAttention-3 baseline for masks FA3 already supports
  • "our code will be open-sourced" - I did not see an URL, anonymized repository, artifact link
Questions
  • would it possible to do a direct comparison against FA3 on the subset of masks it supports, such as full, causal, and varlen/document masks?
  • I see claim that "our experimental results have reported the standard error", but the experiment seems to be reporting mean value only? Can you add them and explain how they are computed
  • can you provide a more detailed ablation that separates gains from the Hopper/FA3-style kernel port from FlashMask-3-specific contributions
Limitations
  • talk about tensor-shape sensitivity, including larger batch sizes, head dimensions, MHA vs. GQA, and different hq/hkv ratios
  • be accurate about reproducibility limitations, since code is promised but not available yet
Paper formatting concerns

address unresolved figure number "Figure ?? compares FlashMask-3 (Balance+Overlap) against MagiAttention" page 23 figure font are too small to read - not printing friendly

Reviewer_PNaGOpenReview ↗
Rating
5
Clarity
3
Confidence
3
Originality
3
Quality
3
Significance
3
Read review
Summary

This paper presents FlashMask-3, a mask-aware exact attention system for structured long-context masks on Hopper GPUs and distributed context parallelism. It keeps FlashMask's O(n) column-wise sparse mask representation, adds a FlashAttention-3-style Hopper kernel, and extends it to distributed CP via zero-communication mask localization, HCC-IPO load balancing, and NVSHMEM-based communication overlap/pruning. The evaluation reports strong single-GPU attention throughput and distributed CP-attention speedups over FlashMask, FlexAttention, MagiAttention, and Megatron CP baselines.

Strengths and weaknesses

Strengths

  • Clean, proven distributed mask transform. The key-indexed/query-boundary mask structure enables an elementwise clip-shift-max transform that derives rank-local masks with no cross-rank communication while preserving the single-GPU kernel interface. Theorem 1 proves equivalence to the global mask.
  • Principled load balancer. HCC-IPO targets the min-max CP compute objective, uses exact 2/3-way sub-solvers, provides a lower-bound optimality certificate, and is deterministic so ranks can derive the same assignment without extra communication. Its overhead remains an open systems question, but the formulation is strong.
  • Strong attention-level evaluation and ablations. The experiments cover many structured masks, long sequence lengths, CP degrees up to 32, multiple baselines, and ablations for tile scheduling, load balancing, and communication overlap.
  • Well-integrated systems design. The paper connects mask representation, Hopper TMA/WGMMA kernel design, persistent tile scheduling, CP load balancing, and NVSHMEM communication overlap/pruning into a coherent attention system for packed long-context workloads.

Weakness

  • Scheduler overhead is not isolated. In packed training, mask geometry can change every microbatch, so w_i preprocessing and scheduling may run at per-batch frequency. This can matter for smaller or highly sparse cases: with S=8K, SWA=256, useful attention is roughly S * window, while a full scan with 128-token Q/K blocks still touches (8192/128)^2 = 4096 tiles. Appendix A notes that smaller contexts may not amortize scheduler overhead, but the paper does not report standalone preprocessing+scheduling latency, overlap/prefetch behavior, or deterministic per-rank recomputation cost.
  • Unclear communication pruning at B>1. The per-batch HCC-IPO assignment is sound for compute because w_i aggregates over batch and heads. Communication pruning is stricter: a K/V chunk is skipped only if fully masked for the rank's whole batched attention work. With heterogeneous packed samples, the needed K/V union can grow with batch size, reducing pruning and communication benefit. The CP experiments use B=1.
  • Overlap robustness under sparse/small workloads is unclear. The overlap design needs enough attention compute to hide AG/RS, but sparse masks and smaller contexts reduce that compute. The implementation also relies on careful kernel ordering to avoid deadlock, using a sentinel mechanism while setting sm_margin=0 in experiments. Robustness across sparsity levels, context sizes, and GPU scheduling behavior is not fully characterized.
  • Distributed speedup reporting appears inconsistent. The abstract and §4.2 report 1.09-1.47x over MagiAttention, 1.73-2.93x over Megatron all-gather, and 1.82-3.72x over Megatron ring. Appendix Table 5 reports larger maxima and different geomeans, e.g. 1.06-4.09x and 1.99x geomean over MagiAttention. The included configurations need clarification.
  • Megatron speedups need context. Megatron CP is a useful systems baseline, but its chunking assumptions are known to break under expressive document/prefix masks, as the paper discusses and visualizes. MagiAttention is the cleaner comparison for mask-aware distributed attention; large Megatron speedups should be interpreted with this caveat.
Questions
  • What is the standalone latency of w_i preprocessing plus HCC-IPO scheduling, and is this work overlapped/prefetched or on the critical path?
  • In mixed global/local/SWA layer stacks, is the HCC-IPO assignment cached per distinct mask pattern and reused across layers, or recomputed for each attention call?
  • Does HCC-IPO replace the backend's default context-parallel chunk layout, or can it compose with simpler layouts when they are already effective?
  • How does mask-driven communication pruning change with batch size and heterogeneous packing, particularly skipped K/V chunk fraction and throughput for B>1?
  • Can the authors break down communication-overlap gains by component: mask pruning, hierarchical routing, and NVSHMEM overlap?
Limitations
  • Batch-size effects on communication pruning are not evaluated. The distributed CP experiments use B=1, leaving unclear how much mask-driven AG/RS pruning remains for heterogeneous packed batches.
Paper formatting concerns

No.

Final justification

I would like to raise my score from weak accept to accept. The rebuttal addressed my main concerns: end-to-end 128-GPU results, quantified scheduler/preprocessing overhead and showed it is prefetched/cached, characterized communication pruning for B>1, reconciled the speedup reporting, and provided a direct FA3 comparison. Even though static aggregate assignment for mixed mask stacks limitation exists, the new evidence provided by the authors strengthens the paper and supports a positive recommendation.

Reviewer_wuBVOpenReview ↗
Rating
4
Clarity
3
Confidence
4
Originality
3
Quality
3
Significance
3
Read review
Summary

This work addresses the central challenge of efficiently supporting expressive structured attention masks during long-context distributed transformer training. The paper introduces FlashMask-3, a distributed attention framework built on FlashAttention-3 that extends the original FlashMask representation to Hopper GPUs and context-parallel training. Its main technical contributions include: (1) a Hopper-optimized, mask-aware attention kernel based on a three-role, warp-specialized pipeline; (2) a zero-communication distributed mask localization algorithm using a clip-shift-max transformation; (3) a hierarchical sparsity-aware load-balancing scheduler (HCC-IPO); and (4) a mask-aware communication overlap mechanism that combines communication pruning with hierarchical all-gather. The authors evaluate the proposed method on H100 GPUs using twelve structured attention mask patterns, comparing it against FlashMask, FlexAttention, MagiAttention, and Megatron-Core context parallelism. The reported results demonstrate substantial improvements in both single-GPU throughput and distributed scaling performance.

Strengths and weaknesses

Strengths:

  • Unlike many prior works that optimize either FlashAttention kernels or communication in isolation, this work jointly optimizes kernel execution, distributed mask handling, load balancing, and communication overlap. The overall system design is coherent and well integrated.
  • The integration of TMA, WGMMA, warp specialization, and persistent scheduling is technically sophisticated and demonstrates a strong understanding of Hopper GPU architecture.
  • The reported performance gains are substantial, including up to 141% improvement over FlashMask, up to 71% over FlexAttention, and consistent distributed performance improvements over Megatron-Core and MagiAttention. If these results are reproducible, they represent meaningful practical advances.

Weaknesses:

  • Many of the proposed contributions are engineering integrations rather than fundamentally new algorithms. While the zero-communication mask localization theorem appears to be a novel contribution, the remainder of the system primarily consists of a careful integration of existing optimization techniques.
  • Several important evaluations are missing, including end-to-end training throughput (e.g., tokens/s), overall training performance, convergence behavior, downstream model quality, and training cost. Demonstrating kernel-level improvements alone is generally insufficient for a systems paper unless they are accompanied by compelling end-to-end results that validate their impact on overall training performance.
  • The paper provides limited theoretical analysis of communication complexity, scheduler optimality, overlap efficiency, scalability, and the approximation quality of HCC-IPO. Moreover, the scheduling algorithm appears to be largely heuristic, with little theoretical justification for its design or performance guarantees.
  • The reported communication reduction relies heavily on structured attention masks that produce fully masked KV chunks. It remains unclear how much of the proposed approach's benefit would carry over to dense attention, randomly sparse attention, learned sparse masks, or adaptive masking methods.
Questions
  • Can the proposed distributed mask localization algorithm be generalized beyond FlashMask's column-wise sparse representation?
  • How does FlashMask-3 affect end-to-end LLM pretraining throughput (e.g., tokens/s), rather than only attention kernel TFLOPS?
  • What fraction of the total training time is spent executing the optimized attention kernels?
  • How does HCC-IPO compare with more advanced graph partitioning or load-balancing algorithms?
  • How sensitive is the performance to the chunk size, segmentation strategy, and communication overlap configuration?
Limitations

Constructive improvements would include a more thorough discussion of the method's dependence on Hopper-specific hardware features, the absence of end-to-end LLM pretraining experiments, its reliance on structured attention masks, scalability beyond 32 GPUs, portability to heterogeneous clusters, applicability to adaptive or learned masking schemes, the heuristic nature of the scheduler, and the GPU memory overhead associated with the additional distributed metadata.

Paper formatting concerns

Some figures, particularly the overview diagrams, are visually crowded and could be simplified to improve readability.

Comments on the paper

1 comment
Meta-review

I have read the authors' responses, which addressed all five priorities from the initial meta-review with new experiments: (1) end-to-end 128-GPU pretraining evidence (tokens/s/GPU with component ablations showing the necessity of hierarchical communication at cross-node scale); (2) a direct FlashAttention-3 head-to-head on the masks FA3 supports, plus a three-way ablation separating the Hopper-port gains from the FlashMask-3-specific KV Index Generator; (3) a characterization of communication pruning under packed batches - including the authors' correction of a reporting error (the CP experiments used weak scaling with global batch B=32/P, not B=1); (4) reconciled speedup reporting (the appendix numbers came from an early measurement run and are corrected); and (5) quantified scheduler/preprocessing overhead, prefetched off the critical path at 0.60-0.75% of a step. Reviewer_PNaG's final justification raises their score to 5 on this basis; Reviewer_FM36 rates 5; Reviewer_wuBV (4) did not return in discussion, but each of their questions received a substantive answer. Final ratings are 4/5/5.

The recommendation is Accept. The camera-ready must include: (a) the citation corrections flagged by the conference's reference check - the Child et al. sparse-transformers reference is an arXiv preprint (1904.10509), not an ICLR paper, and the USP (Fang et al.) reference lists numerous co-authors who are not authors of that paper and must be corrected; (b) the promised standard deviations, the resolved "Figure ??" reference, and the artifact/code link; and (c) the B>1/weak-scaling erratum and corrected appendix numbers.

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.