Reproduce “The KL Divergence Is Never Negative, Except in PyTorch” on OpenResearch
Run Claude Code, Codex or any coding agent as a research agent: literature, hypotheses and experiments on your laptop, cluster or cloud GPUs.
Universal app for Apple silicon and Intel. Requires macOS 11 or later.
About this paper
Zhen Yang, Wei Tang, Chu Chen, Rui Qian, Yixuan Chen, Fan Yang, Kangning Cui
The authors analyze PyTorch’s KL-divergence interfaces and develop stable rewrites that build divergence from nonnegative terms, compute small differences carefully, and use analytic gradients; a logits-based path avoids errors from rounded probabilities. The repairs have no significant errors across 7,234,454 scored closed-form samples, but cannot recover information lost in stored inputs; benchmark error rates are not workload prevalence.
Summary by alphaXiv.
Tip: change arxiv.org to autoarxiv.org in any arXiv abstract link to open the paper here.