← Lab
bf16-native-softmax
confirmedC++ · CPUSystems & data structuresJuly 10, 2026
the question
Can softmax run entirely in bf16 with no wide accumulator?
what came out
Yes -- structural summation clears the fp32-accumulate bar within 2x, while compensated (Kahan) summation fails, because at bf16's 7-bit mantissa the correction word is as coarse as the sum itself. It inverts the fp64 textbook ordering of summation methods.
method & receipts
- Result: confirmed
- Reproducible — one script re-runs the whole thing from scratch.
→ read the code and re-run it
github.com/v-code01/bf16-native-softmax