# On numerical issues of divergences between nearly equal distributions

ほぼ等しい分布間のダイバージェンスにおける数値的問題について

Brandon Amos · arXiv · 2026年11月13日

- **課題** 2つの確率分布がほぼ等しいとき、KLダイバージェンスとその勾配が丸め誤差と打ち消しによって不正確になる問題です。
- **手法** ロジットの差から対数比を再構成し、残りの項と中心化を使って値と勾配を計算します。
- **結果** 例の実装では、FP32の基本評価と比べて、分布が近い場合でも前方KLと逆方向KLの値と勾配をよく保てました。

## log確率の差から生じる数値誤差

本論文は、2つの確率分布がほぼ等しいとき、KLダイバージェンスとその勾配を計算すると、浮動小数点の丸めと打ち消しによって値が不明瞭になる点から議論を始めています。各カテゴリのlog-softmaxを別々に計算してから引くと、異なる対数確率が同じ値に丸められ、小さな対数比が消えることがあります。また、KLの和の項は符号が混ざって互いに打ち消し合うため、実際の差より大きい項の誤差が最終的な値を覆い隠すことがあります。この問題は、知識蒸留や強化学習における逆方向KLの正則化、近接最適化のように、ダイバージェンスを目的関数や正則化項として使う設定で重要になります。

## 前方KLの対数比の再構成と残りの項

前方KLは参照分布pを基準にKL(p∥q)を計算し、ロジットに対する勾配はq−pになります。著者らはまず、ロジットの差δ=z−z\_refを中心化して対数比sを再構成し、expm1とlog1pで小さな増分を保存します。続いて、KL(p∥q)を−Σp\_i s\_iの代わりにΣp\_i E2(s\_i)の形に書き換えます。ここでE2(x)=e^x−1−xであり、すべての項が非負なので、カテゴリ間の打ち消しがなくなります。勾配はu=p·expm1(s)で作ったのち、和が0になるようq·Σu\_iを引いて補正します。

## 逆方向KLと一般化されたJSDの再定式化

逆方向KLはKL(q∥p)で、勾配はq(s−q⊤s)です。論文では、この式のsをロジットの差δに置き換えても、共通の対数正規化定数が中心化で消えるため勾配が同じになることが証明されています。値は、nonnegativeな残りの項Σq\_i E2(−s\_i)として計算します。一般化されたJSDは混合分布m=βp+(1−β)qを使い、βが0に近づくと前方KLに、1に近づくと逆方向KLに近づきます。この場合、混合対数比hをexpm1とlog1pで計算したうえで、2つのKL項に同じ残りの項の構造を適用します。

## Monte Carlo KL推定量における対数比の計算

Monte Carlo KLは、すべてのカテゴリを合計せず、サンプリングされたカテゴリaで対数確率を評価します。K1はs\_aをそのまま返し、K2はs\_a^2/2を使い、K3はs\_a+e^(−s\_a)−1の形をした制御変量です。期待勾配はサンプリングの方向によって変わり、qからサンプリングするとK1のロジットに対する期待勾配は0に、pからサンプリングするとK1は前方KLの勾配になります。著者らは、対数比をまずロジットの差でまとめて計算すると、log-softmaxの引き算による丸めを減らせると考え、K1、K2、K3にこの方法を適用しました。

![Table 2: Expected gradients of Monte Carlo KL estimators](https://refivu.com/papers/773d1588-c8f1-4b62-bd60-761e8d81008b/figures/figure-b9cb6c72e1ba07bdb29c0970a4730011.png?thumb=512)

**Table 2** : Expected gradients of Monte Carlo KL estimators

[出典](https://arxiv.org/abs/2611.18511v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Brandon Amos · On numerical issues of divergences between nearly equal distributions · 論文の図を引用 · 元のPDFの9ページ目から図の部分を抽出しています。

## 例の実装と数値検証

検証では、FP32の基本評価と修正した評価をCPU上で比較し、基準値は80桁のmpmathで計算しました。図1では、前方KLの基本実装は、ロジットの差hが小さくなると値と勾配がぼやけますが、再定式化した実装ではpとqが近くなっても値と勾配を保てています。逆方向KLの中心化勾配についても、同じ方法で確認しました。ただし著者らは、この結果は演算誤差を切り分けた例に限ったもので、大規模な学習結果は測定していないと述べています。

![Table 1: Numerical issues for nearly equal (categorical) distributions](https://refivu.com/papers/773d1588-c8f1-4b62-bd60-761e8d81008b/figures/figure-a48d84ab2f8a721a75425c178f7ad21d.png?thumb=512)

**Table 1** : Numerical issues for nearly equal (categorical) distributions.

[出典](https://arxiv.org/abs/2611.18511v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Brandon Amos · On numerical issues of divergences between nearly equal distributions · 論文の図を引用 · 元のPDFの2ページ目から図の部分を抽出しています。

## 適用範囲と失敗例

対数比の再構成には、ロジット差の範囲を制限するガードが必要です。z\_ref=(−h,0)、z=(h,0)でh=50とすると、FP32の指数計算がオーバーフローします。著者らはこれをガードで防ぎ、広い範囲では別のフォールバックが必要だと考えています。また、ロジットの差そのものが丸められると、pとqが異なるにもかかわらず、固定の前方KLと勾配が0になることがあります。この失敗はガードを通過し、既存の補正では解決しませんでした。

## 論文情報

- **著者**: Brandon Amos
- **学会・ジャーナル**: arXiv · プレプリント
- **公開日**: 2026年11月13日
- **登録日**: 2026年11月16日
- **更新日**: 2026年11月13日
- **バージョン**: v1
- **arXiv**: 2611.18511
- **カテゴリ**: cs.LG · math.NA · stat.ML
- **ライセンス**: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
- **掲載内容**: 論文情報・解説・論文の図

[元論文 ↗](https://arxiv.org/abs/2611.18511v1) · [PDF ↗](https://arxiv.org/pdf/2611.18511v1)

この解説は、Refivuの韓国語解説をAIで翻訳したものです。不正確な翻訳や誤りが含まれる可能性があります。論文と図の利用条件は各出典に従います。

## アブストラクト

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.

## この論文を引用

Brandon Amos (2026). On numerical issues of divergences between nearly equal distributions. arXiv:2611.18511v1. https://arxiv.org/abs/2611.18511v1

**BibTeX**

```
@misc{amos2026numerical,
  title = {{On numerical issues of divergences between nearly equal distributions}},
  author = {Brandon Amos},
  year = {2026},
  eprint = {2611.18511},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.18511v1}
}
```

## この論文の用語

- [log-sum-exp](https://refivu.com/ja/terms/4c54f0a445f9-log-sum-exp)
- [reverse KL](https://refivu.com/ja/terms/b4009b25a2b5-reverse-kl)
- [forward KL](https://refivu.com/ja/terms/5089d962fb3a-forward-kl)

## ほかの論文解説

- [Probabilities of Causation in Nondeterministic Causal Models](https://refivu.com/ja/papers/4a41c475-9406-46f0-81a1-d08a8eb59ede-probabilities-of-causation-in-nondeterministic-causal-models.md)
- [Training-point consistency of kernel ridge regression with varying correlation scales](https://refivu.com/ja/papers/cf42114d-78fb-47c0-aadb-1b56a39f01ce-training-point-consistency-of-kernel-ridge-regression-with.md)
- [On the Limits of Sufficient Explanations](https://refivu.com/ja/papers/5d229b65-8e92-4bdb-a2c0-ba1f553e51c1-on-the-limits-of-sufficient-explanations.md)
- [Small Is Not Dead: Distance-Aware Cluster Revival for e-means](https://refivu.com/ja/papers/f2b6f05d-7401-4871-be99-b749f117115c-small-is-not-dead-distance-aware-cluster-revival.md)
- [From Pen-and-Paper to Machine-Checked Proofs: Lean for System Identification](https://refivu.com/ja/papers/96a42630-24d1-4b73-800f-c3eb329e5262-from-pen-and-paper-to-machine-checked-proofs.md)
- [Tracing Uncertainties of Extreme El Niño Prediction to Mesoscale Ocean Currents](https://refivu.com/ja/papers/e50737f2-d670-42f4-9b3c-5a4a5eaf3da4-tracing-uncertainties-of-extreme-el-nino-prediction-to.md)
- [Agentic AI for Discovering Fault-Tolerant Quantum Circuits](https://refivu.com/ja/papers/e6680a5e-8c8b-48e6-aa57-a669a9a0c6a1-agentic-ai-for-discovering-fault-tolerant-quantum-circuits.md)
- [MMFlash: Faster Speculative Decoding for Vision-Language Models](https://refivu.com/ja/papers/0d74aa73-ffaa-49b3-a4c5-d25a28c93089-mmflash-faster-speculative-decoding-for-vision-language.md)
- [Interactive Program Induction with Language Model Priors](https://refivu.com/ja/papers/92ea057b-2bf7-43ba-8d48-9e24e96e388c-interactive-program-induction-with-language-model-priors.md)
- [Do Verifier Judgments Survive Abstraction? Measuring Verification Transport for LLM Agent Evaluation](https://refivu.com/ja/papers/14bd2e4c-85ea-4184-a7c7-04ab89b28c5b-do-verifier-judgments-survive-abstraction-measuring.md)
- [Bregman geometry in regular exponential families: dual representations and relative smoothness](https://refivu.com/ja/papers/5e6a626e-e508-4fd8-80fa-b09e4ba2171a-bregman-geometry-in-regular-exponential-families-dual.md)
- [MamaReason: Unfinished Reasoning and Answer Recovery in Clinical Language Models](https://refivu.com/ja/papers/cab37a8e-06cc-43ac-8da0-131aec33afef-mamareason-unfinished-reasoning-and-answer-recovery-in.md)

---

AI解説には誤りが含まれることがあります。 [Refivu](https://refivu.com/ja/papers/773d1588-c8f1-4b62-bd60-761e8d81008b-on-numerical-issues-of-divergences-between-nearly-equal)
