Reproduce “A Fix for Softmax and Cross-Entropy” on OpenResearch
Turn your favorite coding agents into research agents that review literature, develop hypotheses, and run experiments.
Universal app for Apple silicon and Intel. Requires macOS 11 or later.
About this paper
Jonathan T. Barron, Dan Gnanapragasam, Michael Tschannen
Authors rewrite softmax, log-softmax, and cross-entropy to preserve gradients lost at high confidence or when student and teacher outputs nearly match, addressing Softmax Collapse and Softmax Cancellation without higher-precision casting. In an fp32 grokking experiment, test accuracy fell from 61% to 23% with standard cross-entropy, while fixed cross-entropy reached 85%; these results are specific, and studied extremes are uncommon in large-scale training.
Key insights
- Numerical stability requires preserving small gradients, not merely preventing overflow in the forward softmax calculation.
- Softmax Collapse can create a precision cliff: the target gradient vanishes abruptly as margins grow, which can contribute to Adam-family optimizer loss spikes in the reported experiments.
- With weight decay, the experiments support an approximate post-memorization margin equilibrium of \(m^* \approx \log(1/\epsilon)\), where \(\epsilon\) is Adam’s stabilizing parameter.
Summary by alphaXiv.
Tip: change arxiv.org to autoarxiv.org in any arXiv abstract link to open the paper here.