On numerical issues of divergences between nearly equal distributions
Brandon Amos
Key points
From the paper's conclusion- We show that similar issues are present in standard divergence operations between categorical distributions.
Abstract
Barron et al. (2026) recently identified numerical issues in the softmax and soft cross-entropy loss. We show that similar issues are present in standard divergence operations between categorical distributions. This includes the forward and reverse Kullback-Leibler (KL) divergence and generalized Jensen-Shannon divergence (JSD), as well as Monte Carlo KL estimates and entropy. When the distributions are nearly equal, rounding and cancellation issues affect the forward and gradient computations. These issues can affect settings using divergences in optimization objectives, such as knowledge distillation, reinforcement learning, and proximal methods. We propose numerically stable reformulations and provide example implementations for each setting, validated by property-based tests.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- The KL Divergence Is Never Negative, Except in PyTorcharXiv · 2026
- Property-Based Testing for Robust Softmax and Cross-EntropyarXiv · 2026
- A Fix for Softmax and Cross-EntropyarXiv · 2026
- Divergence controls entropy in distillationarXiv · 2026
- Neighborhood Smoothing for CalibrationarXiv · 2026
- How Divergence Becomes Decision Flips in Compressed Language ModelsarXiv · 2026