Softmax's standard implementations hide two numerical bugs, Google paper shows

srush_nlp · x · 2026-10-28

A paper by Jonathan T. Barron et al. identifies two numerical bugs in standard softmax/log-softmax/cross-entropy implementations: Softmax Collapse (gradient of a dominant logit rounds to zero, so gradients no longer sum to zero) and Softmax Cancellation (non-zero gradients even when student and teacher logits are equal). The authors present simple fixed implementations that eliminate the "slingshot" phenomenon, speed up grokking with weight decay, prevent accuracy collapse without it, and stop student drift during distillation. The surrounding discussion notes TorchLean had the same bug, using it as a lesson in the mindset needed for formal verification.

Related event: Google Paper Reveals Two Numerical Bugs in All Softmax Implementations(3 posts)→

Original post →

More from Research

Research channel →