A Fix for Softmax and Cross-Entropy
TL;DR - This paper identifies two numerical bugs in standard softmax and cross-entropy implementations and proposes simple corrected versions. The fixes improve numerical gradient behavior and stabilize grokking and knowledge distillation.
- “Softmax Collapse” can round a dominant target logit’s gradient to zero, breaking the zero-sum gradient property.
- “Softmax Cancellation” can produce nonzero gradients even when student and teacher logits match.
- Corrected implementations eliminate the observed “Slingshot” phenomenon and prevent accuracy collapse or teacher-student drift.
- The analysis links bounded post-memorization logit growth to an equilibrium between weight decay and Adam’s ε.