# On numerical issues of divergences between nearly equal distributions

거의 같은 분포 사이 발산의 수치적 문제에 관하여

Brandon Amos · arXiv · 2026년 11월 13일

- **연구 문제** 두 확률분포가 거의 같을 때 KL 다이버전스와 그 기울기가 반올림과 상쇄로 흐려지는 문제입니다.
- **연구 방법** 로짓 차이로부터 로그비를 재구성하고 나머지 항과 중심화를 써서 값과 기울기를 계산합니다.
- **주요 결과** 예제 구현에서 FP32 기초 평가보다 전방 KL과 역방향 KL의 값과 기울기를 가까운 분포에서도 더 잘 유지했습니다.

## log 확률 차이에서 생기는 수치 오류

이 논문은 두 확률분포가 거의 같을 때 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로 계산한 뒤 두 KL 항에 같은 나머지 항 구조를 적용합니다.

## Monte Carlo KL 추정량의 로그비 계산

Monte Carlo KL은 모든 범주를 합산하지 않고 샘플링된 범주 a에서 로그확률을 평가합니다. K1은 s\_a를 그대로 반환하고, K2는 s\_a^2/2를 쓰며, K3는 s\_a+e^(−s\_a)−1 형태의 제어변량입니다. 샘플링 방향에 따라 기대 기울기가 달라지며, K1은 q에서 샘플링할 때 기대 로짓 기울기가 0이고 p에서 샘플링할 때 전방 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 지수 계산이 오버플로하며, 저자들은 이를 가드로 막고 넓은 범위에서는 별도 폴백이 필요하다고 봅니다. 또 로짓 차이 자체가 반올림되면 고정 전방 KL과 기울기가 p와 q가 다름에도 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)

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}
}
```

## 이 논문의 용어

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

## 다른 논문 해설

- [Probabilities of Causation in Nondeterministic Causal Models](https://refivu.com/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/papers/cf42114d-78fb-47c0-aadb-1b56a39f01ce-training-point-consistency-of-kernel-ridge-regression-with.md)
- [On the Limits of Sufficient Explanations](https://refivu.com/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/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/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/papers/e50737f2-d670-42f4-9b3c-5a4a5eaf3da4-tracing-uncertainties-of-extreme-el-nino-prediction-to.md)
- [Can Mechanistic Interpretability Help Explain LLM Agent Failures? A Case Study on Web Element Hallucination](https://refivu.com/papers/74676e7c-7ca6-43c4-898e-67bb8ae2adc8-can-mechanistic-interpretability-help-explain-llm-agent.md)
- [Agentic AI for Discovering Fault-Tolerant Quantum Circuits](https://refivu.com/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/papers/0d74aa73-ffaa-49b3-a4c5-d25a28c93089-mmflash-faster-speculative-decoding-for-vision-language.md)
- [Interactive Program Induction with Language Model Priors](https://refivu.com/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/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/papers/5e6a626e-e508-4fd8-80fa-b09e4ba2171a-bregman-geometry-in-regular-exponential-families-dual.md)

---

AI 해설에는 오류가 있을 수 있습니다. [Refivu](https://refivu.com/papers/773d1588-c8f1-4b62-bd60-761e8d81008b-on-numerical-issues-of-divergences-between-nearly-equal)
