← Lab
softmaxdual
confirmedC++ · CPUSystems & data structuresJuly 9, 2026
the question
Why does attention accumulate softmax in fp32 when the rest of the kernel is bf16?
what came out
Because fp16 and bf16 fail at softmax for opposite reasons: fp16 overflows past logit ~11, while bf16's 7-bit mantissa swamps the sum so the output doesn't even total 1. And the famous max-subtraction trick only rescues fp16, not bf16 -- hence fp32.
method & receipts
- Result: confirmed
- Pre-registered — the prediction was written down and committed before the run.
→ read the code and re-run it
github.com/v-code01/softmaxdual