A Fix for Softmax and Cross-Entropy
Not on the map. Why?
Abstract (arXiv)
Standard implementations of softmax, log-softmax, and cross-entropy have two numerical bugs. The first bug, Softmax Collapse, rounds the target logit's gradient to zero if that one logit is much larger than the others, resulting in gradients that no longer sum to zero. The second bug, Softmax Cancellation, occurs when student logits are close to teacher logits, and produces non-zero gradients even when the student and teacher logits are equal. We present simple implementations of log-softmax, softmax, and cross-entropy that fix both bugs. Our fix eliminates the previously observed "slingshot" phenomenon, speeds up grokking with weight decay, prevents accuracy collapse without weight decay, stops student networks from drifting away from the teacher during distillation, and shows that after memorization, logit growth is bounded by an equilibrium between weight decay and Adam's ε hyperparameter.
Key facts. Cited by 5 papers in the map (data through 24 Nov 2026). Builds on 15 of its 20 references that are in the map. Submitted 22 Oct 2026.
Builds on
15 of 20 references.
References · 15
- 2015Distilling the Knowledge in a Neural Networkcited by 10,967
- 2023Progress measures for grokking via mechanistic interpretabilitycited by 919
- 2022Grokking: Generalization Beyond Overfitting on Small Algorithmic Datasetscited by 710
- 2017The Implicit Bias of Gradient Descent on Separable Datacited by 678
- 2023Small-scale proxies for large-scale Transformer training instabilitiescited by 206
- 2023Explaining grokking through circuit efficiencycited by 124
- 2022The Slingshot Mechanism: An Empirical Study of Adaptive Optimizers and the Grokking Phenomenoncited by 105
- 2024Scaling Exponents Across Parameterizations and Optimizerscited by 92
- 2023A Theory on Adam Instability in Large-Scale Machine Learningcited by 66
- 2023Rotational Equilibrium: How Weight Decay Balances Learning Across Neural Networkscited by 63
- 2025Grokking at the Edge of Numerical Stabilitycited by 61
- 2020LaProp: Separating Momentum and Adaptivity in Adamcited by 23
3 more
- 2024Grokking Modular Polynomialscited by 23
- 2025What Can Grokking Teach Us About Learning Under Nonstationarity?cited by 11
- 2026Grokking or Glitching? How Low-Precision Drives Slingshot Loss Spikescited by 8
Built on by
Citing papers per year: 2026: 5.
5 papers.
- 2026Property-Based Testing for Robust Softmax and Cross-Entropycited by 1
- 2026The Role of Quantization in Loss Spikescited by 0
- 2026FLAMIA: FLAsh MIcroscaling Attention for Fast and Causally Safe Training on Blackwellcited by 0
- 2026On numerical issues of divergences between nearly equal distributionscited by 0
- 2026The KL Divergence Is Never Negative, Except in PyTorchcited by 0
- 2026The KL Divergence Is Never Negative, Except in PyTorch23 Nov 2026
- 2026On numerical issues of divergences between nearly equal distributions13 Nov 2026
- 2026FLAMIA: FLAsh MIcroscaling Attention for Fast and Causally Safe Training on Blackwell2 Nov 2026
- 2026The Role of Quantization in Loss Spikes28 Oct 2026
- 2026Property-Based Testing for Robust Softmax and Cross-Entropy27 Oct 2026