Skip to main content
← Lab

kahansoftmax

null resultC++ · CPUSystems & data structuresJuly 9, 2026

the question

Does bf16 softmax really need fp32 accumulation?

what came out

Not for the part that matters. The error splits into a large accumulation error -- which a compensated (Kahan) sum recovers 98-100% of in pure bf16 on diffuse distributions -- and a small term-quantization floor that only wider terms fix. Kahan in bf16 buys back almost all of it.

method & receipts

  • Result: null result — an honest negative, reported as it came out.
  • Pre-registered the prediction was written down and committed before the run.

→ read the code and re-run it

github.com/v-code01/kahansoftmax