Jon Barron: all softmax and cross-entropy implementations (JAX, PyTorch, textbooks) harbor two subtle bugs

agarwl_ · x · 2026-10-24

Google researcher Jon Barron shares a new result: every existing implementation of softmax and cross-entropy — in JAX, PyTorch, and even textbooks — contains two subtle bugs. A simple rewrite fixes both and eliminates 'slingshots' during grokking.

Retweeter petrenkoai notes his team spotted this softmax 'bug' 1.5 years ago in a paper, but it's hard to construct training scenarios where it matters since gradients on highly likely tokens are tiny anyway. Still, he recommends applying the fix — one less thing to worry about.

Related event: Google researchers find two numerical bugs in all softmax and cross-entropy implementations(13 posts)→

Original post →

More from Research

Research channel →