AI
A Fix for Softmax and Cross-Entropy
Jonathan T. Barron, Dan Gnanapragasam, Michael Tschannen · Submitted 2026-10-22
Preprint · not peer reviewed
The authors show that standard code for softmax and cross-entropy, used to train almost every classifier and language model, has two numerical bugs, and they give simple replacements.
Key finding: One bug rounds a gradient to zero when one score dominates; the other gives non-zero gradients when a student already matches its teacher. Fixing them removes the 'Slingshot' effect and stops students drifting during distillation.
Why it matters: Small rounding errors in a basic building block can quietly change how models train.