On numerical issues of divergences between nearly equal distributions

on-numerical-issues-of-divergences-between-nearly-equal-distributions

On numerical issues of divergences between nearly equal distributions

[Submitted on 13 Nov 2026 (v1), last revised 20 Nov 2026 (this version, v2)]

View PDF HTML (experimental)

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.

Submission history

From: Brandon Amos [view email]
[v1] Fri, 13 Nov 2026 18:26:07 UTC (694 KB)
[v2] Fri, 20 Nov 2026 23:19:19 UTC (693 KB)