Skip to content
DAH

An open attention backward kernel within 10% of FlashAttention-3 for head dimension 256

OpenTo verify: GPU benchmarkPosed by FlashAttention-3 backward pass; head dimension 256 support in Hopper kernels
AI-reviewed
On this page14 sections
Difficulty
33/100Hard
How far from a resolution. P vs NP = 100
Application value
38/100Indirect
Realistic practical impact if resolved. P vs NP = 100
Leverage
25/100Local
How much other knowledge hinges on it. P vs NP = 100

Difficulty 33: five matmuls per tile pair, cross-block dQ accumulation and the register budget at head dimension 256 make it clearly harder than the forward parity task (20), and no open kernel publishes a comparison. Application value 38: training cost for large-head models only, narrower than forward attention (49). Leverage 25: a few downstream kernels.

The problem

Can an open program for the learning-phase of attention run within 10% of the best one at large head sizes?

  1. 1Learning needs a backward attention pass
  2. 2Five multiplies per block pair
  3. 3Large heads overflow fast storage
  4. 4Match best program within 10%
  5. 5Open, modifiable training kernels

What is asked. Training a neural network needs a backward pass: after the model makes a prediction, the chain rule from calculus is applied layer by layer to find how the error changes with every input and weight. For attention, this means computing three gradients, dQdQ, dKdK and dVdV, for the query, key and value matrices. FlashAttention-3 has a fast backward kernel on NVIDIA's H100, including for large head dimension 256 (the length of each query and key vector). The problem asks for an open kernel, in any language other than the FlashAttention-3 code itself, that reaches 90% of its backward speed at head dimension 256. The test uses BF16 numbers, causal masking, and sequences of 4096 to 16384 tokens.

Why the backward pass is harder. The forward pass does two matrix multiplies per pair of tiles. The backward pass does five: it recomputes the scores, multiplies them back through VV, and forms the three gradients. Each query block's dQdQ also receives contributions from every key block. Different thread blocks must therefore add into the same memory, either with atomic additions (hardware-guaranteed, but slow when many threads collide) or with a separate pass. Head dimension 256 makes it worse. A tile of 64 rows by 256 columns in 4-byte floats is already 64 KB, and the kernel must keep several such tiles plus running sums in registers and in shared memory, a fast scratchpad of a few hundred kilobytes per core. It is like packing a suitcase that is barely big enough. Each extra item forces smaller tiles, and smaller tiles mean less reuse and more memory traffic. The analogy breaks because the programmer can also trade storage for recomputation, which a suitcase cannot.

State of the art. FlashAttention-3's Hopper code ships head-dimension-256 backward kernels in BF16 and FP16. The newer FlashAttention-4, written in NVIDIA's CuTe Python DSL, accepts head dimensions up to 256 on Hopper. No other open kernel, whether ThunderKittens, TileLang, Triton or anything else, publishes a head-dimension-256 backward comparison against FlashAttention-3. So nobody knows how big the gap is.

What a solution looks like. A public kernel timed against FlashAttention-3 on one H100 across the stated sequence lengths, reaching 90% in two independent reruns. Its gradients must stay within twice FlashAttention-3's error against a 32-bit reference.

Go deeper

The full technical text.

Provide an openly licensed attention backward kernel, written in any language other than the FlashAttention-3 codebase itself, that reaches at least 90% of FlashAttention-3's backward throughput on one H100 SXM for BF16, head dimension 256, causal, sequence 4096 to 16384, with gradients matching a float32 reference within the stated tolerance.

Words on this page (9)
Words on this page
backward pass
The step in training that computes, by the chain rule, how the loss changes with every input and weight.
gradient
The list of derivatives of the training loss with respect to each number in the model.
attention
The transformer operation in which each token takes a weighted average of other tokens, with weights from a softmax of similarity scores.
FlashAttention
A family of attention kernels that compute exact attention tile by tile without storing the full score matrix.
shared memory
A small, fast, programmer-managed memory inside each GPU core, shared by a block of threads.
register
The fastest storage on a processor, private to each thread and very limited in number.
kernel (GPU)
A function that runs on the GPU, executed by thousands of threads in parallel.
Hopper (H100)
NVIDIA's 2022 data-centre GPU generation; the H100 is its main chip.
tiling
Splitting a large matrix operation into small blocks that fit in fast on-chip memory and are reused many times.
New to this? Read first (3)
New to this? Read first
AI-reviewedAn AI drafted this explanation. Check it against the technical text.

Path to understanding

foundations → problem

The research entries this problem rests on, in the order to read them. Each links to its explainer.

  1. Start with
  2. Step 2
  3. Step 3
  4. Then
    • An open attention backward kernel within 10% of FlashAttention-3 for head dimension 256The problem

State of the art

The backward pass has lower arithmetic efficiency than the forward pass: it performs five matrix multiplications per tile pair instead of two, needs gradient accumulation into dQ across blocks (often through atomic adds or a separate pass), and keeps more state in registers and shared memory. Large head dimensions (192 and 256) stress the register and shared-memory budget further. FlashAttention-3's hopper/ directory ships head-dimension-256 backward kernels (BF16 and FP16), and the newer CuTe-DSL FlashAttention-4 code accepts head dimensions up to 256 on Hopper; no ThunderKittens, TileLang, Triton or other open kernel publishes a head-dimension-256 backward comparison against FlashAttention-3.

Realistic applications

Training cost for long-context models depends on the backward pass; large head dimensions appear in some multi-head latent attention and vision models.

What counts as solved

A public kernel meeting the 90% bar on the full sweep in two independent reruns.

How it gets verified

To verify: GPU benchmark

A kernel run and timed on stated hardware against a baseline.

Hardware: one H100 SXM 80 GB. Shapes: head dim 256, causal, BF16, sequence 4096, 8192, 16384, total tokens near 16384. Baseline: FlashAttention-3 backward from the hopper/ directory of Dao-AILab/flash-attention at a pinned commit. Metric: backward TFLOP/s (FlashAttention benchmark convention, 2.5x forward FLOPs), median of at least 100 iterations after warmup, three runs. Correctness: dQ, dK, dV max absolute error versus an FP32 PyTorch autograd reference no larger than 2x that of FlashAttention-3, and bitwise-identical results across two runs are not required but run-to-run variation is reported. Harness: public script at a pinned commit.

Claims

No claimed results on this problem.

Where the work is

Theory
10%
New mathematical or conceptual ideas
Engineering
78%
Building instruments, chips, systems, software, formal proofs
Compute
6%
Raw computation, search, simulation
Empirical
6%
Observation, experiment, data collection

Kernel engineering dominated by resource budgeting; limited theory.

Connected problems