potentialpaper

Broken Symmetry in BF16 Attention: Why FlashAttention Gradients Blow Up Late in Training

Keep the title, authors and abstract in paper.json

potentialpaper · 2026-11-23 20:14 UTC · f18d8ced5108 ·

.potentialpaper/metadata.json modified

+++ b/.potentialpaper/metadata.json
@@ -1,19 +1,5 @@
{
- "layout": 5,
- "identifiers": [
- {
- "scheme": "openreview",
- "value": "LJvGaCWmFh"
- }
- ],
- "title": "Broken Symmetry in BF16 Attention: Why FlashAttention Gradients Blow Up Late in Training",
- "authors": [],
- "abstract": "BF16 is now standard in large-scale pretraining, including in fused attention\nkernels such as FlashAttention, and these kernels are widely trusted. When we\nused FlashAttention-3 to pretrain a 450M-parameter transformer on 50B tokens,\nhowever, we ran into a problem: training was healthy for 25B tokens, then the\ngradient norm grew a thousandfold and the loss ended 0.2 nats above FP32\nattention, without a single NaN. Recomputing the\nattention backward of just two layers in FP32 removes almost all of the excess\ngradient. Part of the cause is known: a fused multiply-add in the forward\nsoftmax, so far treated as an extreme-input NaN case and never fixed in\nFlashAttention-3. Repairing it stops the blow-up, but the query gradient is\nstill wrong by more than its own size, and training still drives attention\nlogits to thousands of times their size under accurate gradients. The remaining\nerror comes from a broken conservation law. The softmax score gradient sums to\nzero along every row, which makes the query gradient blind to where the keys sit\nas a group; rounding it to BF16 leaves a small nonzero sum that leaks the mean\nkey into the gradient, and the leak grows exactly as late training makes keys\nlarge and attention sharp. We introduce GProj (gauge projection), which restores the zero sum after\nthe cast with two rank-one corrections. It cuts the remaining median query/key\ngradient errors from 219\\%/13\\% to 0.34\\%/0.37\\%, on par with FP32 attention,\nfor 4.7\\% more time per training step. In matched from-scratch runs it trains\nto the same loss as FP32 attention, while FlashAttention-3 and key smoothing\nboth destabilize.",
- "year": 2027,
- "venue": "ICLR 2027 (under review)",
- "source": "openreview",
- "license": {
- "metadata": "CC0-1.0",
- "abstract": "CC0-1.0"
- }
+ "layout": 6,
+ "kind": "paper",
+ "key": "9c1f0afd-49d6-40a1-b196-94b6e78113bb"
}

paper.json added

+++ b/paper.json
@@ -0,0 +1,9 @@
+{
+ "title": "Broken Symmetry in BF16 Attention: Why FlashAttention Gradients Blow Up Late in Training",
+ "authors": [],
+ "abstract": "BF16 is now standard in large-scale pretraining, including in fused attention\nkernels such as FlashAttention, and these kernels are widely trusted. When we\nused FlashAttention-3 to pretrain a 450M-parameter transformer on 50B tokens,\nhowever, we ran into a problem: training was healthy for 25B tokens, then the\ngradient norm grew a thousandfold and the loss ended 0.2 nats above FP32\nattention, without a single NaN. Recomputing the\nattention backward of just two layers in FP32 removes almost all of the excess\ngradient. Part of the cause is known: a fused multiply-add in the forward\nsoftmax, so far treated as an extreme-input NaN case and never fixed in\nFlashAttention-3. Repairing it stops the blow-up, but the query gradient is\nstill wrong by more than its own size, and training still drives attention\nlogits to thousands of times their size under accurate gradients. The remaining\nerror comes from a broken conservation law. The softmax score gradient sums to\nzero along every row, which makes the query gradient blind to where the keys sit\nas a group; rounding it to BF16 leaves a small nonzero sum that leaks the mean\nkey into the gradient, and the leak grows exactly as late training makes keys\nlarge and attention sharp. We introduce GProj (gauge projection), which restores the zero sum after\nthe cast with two rank-one corrections. It cuts the remaining median query/key\ngradient errors from 219\\%/13\\% to 0.34\\%/0.37\\%, on par with FP32 attention,\nfor 4.7\\% more time per training step. In matched from-scratch runs it trains\nto the same loss as FP32 attention, while FlashAttention-3 and key smoothing\nboth destabilize.",
+ "license": {
+ "metadata": "CC0-1.0",
+ "abstract": "CC0-1.0"
+ }
+}