Frontier tech and the singularity, minus the hype.

Explainer · Oct 25, 2026

A precision bug in standard softmax code bites at very high confidence, Google DeepMind researchers report

Preprint, not peer reviewed. Three Google DeepMind researchers say standard softmax and cross-entropy code rounds a very confident prediction's gradient to zero, and they offer a drop-in fix. They also say the extreme margins involved are uncommon in standard large-scale training.

By STFUnion Staff · AI-written, fact-checked

Line chart of the target-logit gradient against logit margin on a log scale. The exact value shrinks smoothly, but standard softmax rounds it to exactly zero at a margin of about 5.5 in bf16 and about 16.6 in fp32.
Chart: STFUnion Staff, computed in PyTorch following arXiv 2610.31642 · original · source

Softmax is the function that turns a model's raw scores into probabilities, and cross-entropy is the loss that grades them. A preprint, not peer reviewed, posted Oct 22 by Jonathan T. Barron, Dan Gnanapragasam and Michael Tschannen of Google DeepMind argues that the standard code for both, the kind that ships in JAX, PyTorch and TensorFlow, has two numerical bugs, and that one of them switches on at exactly the moment a model becomes very sure it's right.

The authors are careful about scope, and so should we be. "Though the extreme margins and near-zero student–teacher gaps probed by our experiments are uncommon in standard large-scale training, our fixed functions are easy drop-in replacements that can be implemented without meaningful slowdown," they write in the paper's conclusion. This is a sharp, checkable result about an edge, not a claim that today's big models are broken.

Bug one: the precision cliff

Here's the mechanism in plain terms. Standard implementations subtract the largest score before exponentiating, which stops overflow. For a confident prediction, that leaves a denominator of 1 plus a tiny number: the combined weight of all the wrong answers. Floating-point numbers are very precise near zero but coarse near one; in fp32, anything smaller than about 10⁻⁷ added to 1.0 is simply rounded away, the paper explains. Once the model's "margin" (how far the right answer's score sits above the rest) passes a threshold, the tiny number vanishes, the denominator becomes exactly 1.0, and the loss and the right answer's gradient both become exactly zero.

The authors call that threshold the precision cliff and put it at about 5.5 in bf16, 16.6 in fp32 and 36.7 in fp64, per the preprint. In probability terms (our arithmetic, not the paper's), a margin of 5.5 means the model gives the right answer roughly 99.6% probability, and a margin of 16.6 means the wrong answers share about one chance in 16 million. That's why it's called a confidence bug: you have to be very sure to hit it, and bf16, the lowest-precision format the paper tests, hits it far sooner.

The nasty part is the asymmetry. The wrong answers' gradients are computed without adding 1, so they stay small and positive while the right answer's gradient is zeroed, and the gradients no longer sum to zero, the authors write. Their worked example is three numbers: for scores of 9, −9 and −9 in fp32, the standard jax.nn and optax functions return a loss of 0.0 and a target gradient of 0.0, while the fixed versions return about 3×10⁻⁸ and gradients that balance.

Why a zero becomes a spike

Adam and AdamW scale each update by a running average of recent gradient sizes. When every training example sits past the cliff, gradients nearly vanish and that average decays toward zero. When a few examples slip back under, their gradients switch back on and get divided by a very small number, producing a huge step and a loss spike, according to the paper. The authors say this explains the "Slingshot" spikes that Thilak et al. reported in 2022 in grokking, where networks memorize first and generalize much later.

In their tests the damage depends on the setup. With weight decay on a modular-addition task, standard cross-entropy reached 94 ± 5% test accuracy against 100 ± 0% for the fix; without weight decay or LayerNorm, a single spike dropped standard cross-entropy from 61% to 23% test accuracy while the fixed version went on to 85%, the authors report. Those are 1-layer Transformers and 2-layer MLPs learning modular arithmetic, not production models.

There's a neat side result. With AdamW and weight decay, the margin settles near log(1/ε), where ε is Adam's small stabilizing constant. At the default ε of 10⁻⁸ that's about 18.4, just past the fp32 cliff, which is why standard code spikes right before it would have settled. In the paper's fp32 setup, an ε of 10⁻⁷ or larger keeps the equilibrium below the cliff and standard cross-entropy "settles without spiking," the preprint says.

Bug two: a student that drifts from an identical teacher

The second bug, which the authors call Softmax Cancellation, shows up in distillation, where a student model learns to match a teacher's probabilities. Standard code computes both softmaxes separately and subtracts them, losing precision when they're close, and its forward and backward passes use slightly different formulas, so the gradient isn't zero even when student and teacher are identical, the paper says. Start a student with the teacher's exact weights, and in bf16 the leftover noise drives it away from the teacher and hurts test accuracy; in fp32 it causes an initial spike in the gap. The fixed loss returns a gradient of exactly zero, and the student stays put.

The fix, and who got there first

The repair is a rewrite in log space using softplus, expm1 and log1p, so the code never adds 1 to a tiny number. The project page prints short JAX implementations of the fixed log-softmax, softmax and both cross-entropies, and the paper says they work across bf16, fp32 and fp64 without internally casting to higher precision.

The failure itself isn't new. Prieto, Barsbey, Mediano and Birdal named it "Softmax Collapse" in a peer-reviewed ICLR 2025 paper, showed it can stop grokking, and proposed StableMax, a replacement activation. The new paper credits them for the name and compares directly: in its modular-addition table, StableMax's margins balloon into the thousands and its test accuracy trails the fixed cross-entropy at every ε tested, per the preprint. What's new is fixing the standard functions themselves rather than swapping them out.

What to take from it

If you train in bf16, push models to near-certainty, or distill from a teacher that's very close to the student, this is worth a look; the authors say the fix "may prove useful whenever models make high-confidence predictions or distill from close teachers," in their conclusion. If you're training a large model on ordinary data, the authors themselves say these margins are uncommon. The evidence so far is small, clean experiments and one team's preprint. That's not a crisis. It's a clearly explained bug with a few lines of fix, which is the best kind.