Nearly equal distributions break standard KL and JSD calculations
Original title: On numerical issues of divergences between nearly equal distributions
Rounding and cancellation corrupt forward and reverse KL, generalized JSD, Monte Carlo KL, and entropy when categories nearly match.
The paper extends numerical problems recently identified in softmax and soft cross-entropy to standard divergences between categorical distributions. Forward and reverse Kullback-Leibler divergence, generalized Jensen-Shannon divergence, Monte Carlo KL estimates, and entropy can fail when the distributions are nearly equal because of rounding and cancellation in both values and gradients. Those failures can affect optimization that uses divergences, including knowledge distillation, reinforcement learning, and proximal methods. The authors propose numerically stable reformulations with example implementations and property-based tests.
- Affected operations include forward and reverse KL, generalized JSD, Monte Carlo KL, and entropy.
- Errors appear in both the divergence value and its gradient.
- Cited use cases are knowledge distillation, reinforcement learning, and proximal methods.
- Stable reformulations are checked with property-based tests.
From the original article
1 min read at arxiv.orgBarron 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.
By Brandon Amos · arxiv.org
A short excerpt; the article and its images belong to the publisher. Summary, key facts and assessment above are AI-written from the article and can be wrong.