DASH: Deterministic Attention Scheduling for High-throughput Reproducible LLM Training

Xinwei Qiang, Hongmin Chen, Shixuan Sun, Jingwen Leng, Xin Liu, Minyi Guo

TL;DR

Enforcing determinism in Large Language Model (LLM) training ensures bitwise reproducibility but introduces up to a 37.9% throughput penalty during the attention backward pass due to serialized gradient accumulation. This paper presents DASH (Deterministic Attention Scheduling for High-Throughput), a framework that models the backward pass as a Directed Acyclic Graph (DAG) scheduling problem. By co-optimizing tile computation order and reduction phases, DASH eliminates pipeline stalls and delivers up to a 1.28× speedup for deterministic attention.

What Problem Does This Paper Address?

Reproducibility is a cornerstone of deep learning engineering, allowing practitioners to debug training instabilities (like loss divergence) and precisely evaluate architectural changes. However, floating-point arithmetic is inherently non-associative (i.e., $(A + B) + C \neq A + (B + C)$). In highly parallel GPU environments, different Streaming Multiprocessors (SMs) accumulate gradients in an unpredictable, race-condition order using atomic operations, leading to slight variations between training runs.

To guarantee bitwise identical results, state-of-the-art libraries like FlashAttention-3 introduce a deterministic mode that enforces a rigid, sequential accumulation order using synchronization barriers. Unfortunately, this creates massive pipeline stalls ("bubbles") where SMs sit idle waiting for their turn to reduce gradients.

Performance degradation of deterministic attention under different masks

The authors identify that this performance drop is not an unavoidable cost of serialization, but rather a failure of standard tile scheduling to align with the required accumulation order.

Methods

The authors formalize the deterministic attention backward pass as an optimization problem on a Directed Acyclic Graph (DAG), where the goal is to minimize the critical path length.

Modeling the backward pass as a DAG to minimize the critical path

Based on this framework, they introduce two primary scheduling strategies under the DASH umbrella:

  1. Descending Q-Tile Iteration: A robust heuristic designed for causal attention masks. By reversing the traversal order of query (Q) blocks, shorter tasks are processed first. This resolves data dependencies faster and allows subsequent attention heads to pipeline tightly, dramatically shrinking idle periods.
  2. Shift Scheduling: A theoretically optimal schedule for full attention masks. It assigns tasks to SMs using a phase-shifted, cyclic pattern (e.g., SM $i$ processes blocks starting at index $i$). This staggered execution ensures that serialized reduction operations proceed smoothly without resource contention or added bubbles. For causal masks, this is extended into Symmetric Shift Scheduling, which pairs the longest and shortest task chains to perfectly balance the workload across SMs.

Datasets

The paper does not utilize standard machine learning datasets (like Pile or SlimPajama) since it focuses purely on kernel-level computational efficiency. Instead, the profiles and benchmarks are executed using synthetic random inputs in BF16 precision. The dimensions of these inputs are meticulously chosen to match the exact layer configurations of prominent real-world models:

  • Causal LLMs: LLaMA3-8B, Qwen2.5-7B, and Mistral-8×7B.
  • Full Mask Models: SAM-ViT-Huge (Vision), StableDiffusion3.5 Medium/Large (Diffusion), and LLaDA-1b (Diffusion-based Language Model).

Key Insights and Ideas

  • Compute-Reduction Co-optimization: Traditional attention kernels separate the scheduling of tile computation from the reduction mechanism. DASH demonstrates that these two phases are deeply coupled; changing when a tile is computed can completely eliminate the overhead of how its gradient is accumulated.
  • Theory vs. Hardware Reality: A fascinating "aha!" moment occurs when comparing the two causal mask strategies. While Symmetric Shift Scheduling is theoretically perfect in the DAG model, the simpler Descending Q-Tile heuristic actually outperforms it at larger head dimensions ($HD=128$). The optimal schedule requires complex state tracking that increases "register pressure" on the GPU, forcing the compiler to spill data into slow local memory.
  • The Cost of Synchronization: At extreme sequence lengths (e.g., 16,384), cross-SM synchronization signals must traverse the GPU's distributed L2 cache, incurring a latency of 200–500 cycles. This hardware reality penalizes intricate dependency graphs, causing a slight performance divergence from the idealized theoretical model.

Key Results

  • Attention Kernel Speedup: DASH improves the throughput of the deterministic attention backward pass by up to 1.28× compared to the FlashAttention-3 baseline.
  • End-to-End Training Gains: When evaluating an entire transformer block (accounting for both forward and backward passes), DASH provides an end-to-end speedup of 2% to 10% for causal LLMs and roughly 4% for full-mask models.
  • Perfect Reproducibility: DASH achieves a maximum gradient deviation of exactly 0 (bitwise identical), successfully eliminating the $O(10^{-4})$ run-to-run variance observed in non-deterministic baselines.

Limitations and Future Work

The primary limitation of DASH's theoretically optimal Shift Scheduling is its sensitivity to register pressure on current GPU architectures (like the NVIDIA Hopper generation), which degrades performance when the head dimension is large ($HD=128$).

The authors note that these algorithmic strategies are poised to shine on upcoming hardware generations. Architectures like NVIDIA Blackwell, which feature expanded register files and specialized hardware-managed memory structures (TMEM), will likely be able to execute DASH's optimal schedules without experiencing register spills.

Summary updated

BibTeX
@inproceedings{qiang2026dash,
  author = {Xinwei Qiang and Hongmin Chen and Shixuan Sun and Jingwen Leng and Xin Liu and Minyi Guo},
  title = {{DASH: Deterministic Attention Scheduling for High-throughput Reproducible LLM Training}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=bMi5ssfPoM},
}
Figure