The KL Divergence Is Never Negative, Except in PyTorch
23 Nov · Zhen Yang, Wei Tang, Chu Chen +4 · arXiv:2611.30835
A Kullback--Leibler (KL) divergence is never negative, yet PyTorch users have reported negative values for years, and the standard advice is to clamp them at zero. The sign is only the visible part of a silent failure. Many machine-learning applications compare nearby distributions, where conventional KL formulas lose accuracy. On 8.5 million inputs with certified references across 18 closed-form KL families and…