Skip to content
Sina Tech·Indexed by this site · Originally published· AI updates →SelectedAttention43

Google DeepMind team discloses hidden numerical bug in Softmax in frameworks such as PyTorch and JAX; Gemini participated in the discovery and fix

PyTorch、JAX都被点名!Softmax曝出隐藏Bug,Gemini立功

AI summary

A paper submitted to arXiv on October 22 by Google DeepMind principal research scientist Jonathan T. Barron and others points out that the standard implementations of Softmax and cross-entropy widely used by mainstream frameworks such as PyTorch, JAX, and TensorFlow have two numerical precision bugs, and gives a fix that does not require increasing floating-point precision. The first, Softmax Collapse, occurs when a model is overconfident about the correct class; the standard implementation incorrectly zeroes the gradient of the correct class, and the paper uses this to explain the Slingshot phenomenon in which training loss suddenly spikes; the second, Softmax Cancellation, appears in scenarios such as knowledge distillation where teacher and student outputs are close, and a nonzero residual gradient is still computed when the student has already reached the distillation target. On the fp32 mod-31 addition Grokking task, standard cross-entropy achieved an average test accuracy of 94.3%±5.4% over 5 experiments, while the fixed version reached 100% in all.

Why it was selected

It provides a numerical-precision-level explanation for loss spikes that repeatedly occur during training, and the authors say the fix can replace existing implementations without increasing floating-point precision.

Related papers
Read originalfinance.sina.com.cn