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

- **ID:** 1230
- **Kind:** paper
- **URL:** https://arxiv.org/abs/2609.34272
- **Authors:** Junlin Chen, Daize Dong, Huanwei Di, Haolong Jia, Jiawei Wu, Haotian Xie, Mingkai Zheng, Yang Li, Leshang Chen, Huishu Wang, Eric P. Xing, Hongyi Wang
- **Venue:** arXiv:2609.34272 (cs.LG), submitted 28 Sep 2026
- **Published:** 2026
- **Source:** arxiv
- **Language:** en
- **Access:** free
- **Tags:** flashattention, bf16, gradient-stability, attention-backward, precision, gproj, gauge-projection, kohakufa
- **Topics:** FlashAttention, BF16, numerical precision, gradient stability, attention backward, training-run debugging, KohakuFA
- **Added:** 2026-10-04
- **Verified:** 2026-10-05
- **Page:** https://papers.projxon.ai/entries/1230

## Summary

Diagnoses a late-training blow-up training a 450M transformer on 50B tokens with FlashAttention-3 in BF16: healthy for 25B tokens, then gradient norm grows 1000x and loss ends 0.2 nats above FP32 attention — with no NaNs at all. Recomputing just two layers' attention backward in FP32 removes almost all excess gradient. Part of the cause is known (a fused multiply-add in the forward softmax, never fixed in FA3); repairing it stops the blow-up but leaves the query gradient wrong by more than its own size (219% median error). The deeper cause is a broken conservation law: the softmax score gradient dS sums to zero along every row, making dQ blind to where the keys sit as a group; rounding dS to BF16 leaves a small nonzero sum that leaks the mean key into dQ — and the leak grows exactly as late training makes keys large and attention sharp. Fix: GProj (gauge projection), which restores the zero row sum after the cast with two rank-one corrections per row — cuts median dQ/dK errors from 219%/13% to 0.34%/0.37% (FP32-attention level) for 4.7% more step time; in matched from-scratch runs it reaches the same loss as FP32 attention while FA3 and key smoothing destabilize. KohakuBlueleaf replied on the thread reporting the same class of precision bug in FA4/cuDNN/flex attention and their KohakuFA fix. If a BF16 run blows up late with no NaNs, check the attention backward. Directly relevant to the user's LLM training-run debugging work.

## Research notes

- Discovery: @Chen94751623484 (Junlin Chen, author) X thread 2026-10-04 1:36 AM ET (https://x.com/Chen94751623484/status/2106619462287802663), 13.7K views
- Rutgers / MBZUAI
- Code: https://github.com/chenjunlin110/gproj-fa3
- Related catalog entry: 1526 KohakuFA — 琥珀青葉 (@KBlueleaf) replied on this thread reporting similar backward-precision issues in FA4/cuDNN/flex attention
- Commentary: @hillbig (Daisuke Okanohara, PFN co-founder/CEO, verified) long Japanese explainer 2026-10-04 6:32 PM ET (https://x.com/hillbig/status/2106875129590698465), 12.8K views, 138 likes, 80 bookmarks — frames the bug as insidious because it is invisible early in training (~25B tokens) and only surfaces once internal states reach a critical regime; emphasizes understanding symmetries/conservation laws in backward passes to distinguish tolerable vs structurally dangerous errors, increasingly important as training moves to FP8/FP4. Note: replier @KBlueleaf linked his own FA4/cuDNN/flex-attention precision repo under this thread.

## Similar entries

- [KohakuFA: Attention Kernel with Fixed Backward-Pass Precision](https://papers.projxon.ai/entries/1217) (code, #1217)
- [You Need Better Attention Priors](https://papers.projxon.ai/entries/1216) (paper, #1216)
- [DualKV: Shared-Prompt Flash Attention for Efficient RL Training with Large Rollouts and Long Contexts](https://papers.projxon.ai/entries/500) (paper, #500)
- [xattn](https://papers.projxon.ai/entries/782) (code, #782)
- [Parallax: Parameterized Local Linear Attention for Language Modeling](https://papers.projxon.ai/entries/497) (model, #497)
- [SageAttention: Accurate 8-Bit Attention for Plug-and-play Inference Acceleration](https://papers.projxon.ai/entries/570) (paper, #570)
