Grokking or Glitching? How Low-Precision Drives Slingshot Loss Spikes

Liu Hanqing, Jianjun Cao, Yuanze Li, Zijian ZhouNeurIPS 2026

TL;DR

When neural networks train for a long time without regularization, their loss often explodes in periodic, violent bursts—a mystery known as the "Slingshot Mechanism." Researchers previously blamed the intrinsic physics of optimization, assuming optimizers were naturally bouncing off sharp canyon walls in the loss landscape. This paper proves it’s actually a computer arithmetic glitch: floating-point rounding errors break a fundamental mathematical symmetry in the cross-entropy loss, triggering a runaway feedback loop that inflates model weights until the whole system snaps.

What Problem Does This Paper Address?

If you train a deep network long past the point of memorizing the training data, strange things happen. Sometimes the network suddenly learns to generalize (a phenomenon called grokking). Without weight decay, this late-stage training is often punctuated by the Slingshot Mechanism: last-layer weights grow exponentially, followed by a sudden, massive spike in training loss, after which the network recovers and generalizes a little better.

Stepwise test accuracy jumps accompanying Slingshot loss spikes

Until now, the consensus was that Slingshots were an intrinsic property of adaptive optimizers like Adam navigating steep loss landscapes. Meanwhile, classical theory predicts that unregularized parameter norms should grow at a leisurely logarithmic pace—yet in practice, engineers constantly battle rapid weight and logit blowups. Why does real-world training deviate so wildly from clean mathematical theory?

Methods

Instead of treating optimization as continuous math with infinite precision, the authors analyze the exact IEEE 754 floating-point mechanics inside PyTorch’s cross-entropy loss.

They combine two late-stage training concepts:

  1. Softmax Collapse (SC): When a model gets super confident, the gap between the winning logit and the runner-up exceeds float32 precision limits ($\approx 16$). Due to floating-point absorption error (like adding $10^{-8}$ to $1$ and getting $1$), the gradient for the correct class rounds to strictly zero, while incorrect classes retain tiny, non-zero gradients.
  2. Neural Collapse (NC): The geometric tendency of penultimate-layer features and final classifier weights to arrange themselves into a neat, symmetric structure.

By coupling SC and NC mathematically, the authors uncover Numerical Feature Inflation ($\mathcal{NFI}$). In exact math, logit gradients across all classes sum to zero. Under Softmax Collapse, losing the correct-class gradient breaks this zero-sum rule. This imparts a tiny drift to the average classifier weights, which pushes the average feature vectors in the exact opposite direction, which in turn pushes the weights harder—an anti-parallel positive feedback loop causing exponential growth.

To prove this mechanism is the culprit, the authors test surgical interventions: casting only the loss calculation to float64, manually projecting gradients to restore the zero-sum rule, and placing Batch Normalization right before the final layer to subtract out the drifting feature mean.

Datasets

The authors evaluate their theory across three standard domains (introducing no new benchmarks):

  • Modular Arithmetic: Modular division ($p = 97$) using a 2-layer Transformer and a 6-layer MLP.
  • Image Classification: CIFAR-10 trained on a 6-layer MLP, VGG11, ResNet18, and a 12-layer Vision Transformer (ViT).
  • Language Modeling: The FineWeb dataset trained on a 110M-parameter nanoGPT model.

Key Insights and Ideas

  • It’s a rounding bug, not optimization physics: Upgrading just the logits-to-loss computation from float32 to float64 completely erases Slingshot spikes, proving the instability is born inside finite-precision log-probability math.
Figure 1: Precision-induced NFI dynamics. (a) Slingshot loss spikes disappear when training is performed in float64. Casting only the logits/loss computation to float64 is also sufficient to remove the spikes, showing that the instability originates from the loss computation. (b) Before most samples enter Softmax Collapse, the global feature mean grows slowly. Once most samples collapse, ∥µG∥ enters a rapid-growth phase. (c) The cosine similarity between WG and µG approaches −1. Under this anti-parallel alignment, even the correct-class logits become deeply negative.
  • How the "snap" actually happens: Exponential $\mathcal{NFI}$ growth doesn't directly cause the spike. Instead, outlier samples near the decision boundary drift faster than others, shrinking their confidence margin until one slips back into float32 visibility. Meanwhile, Adam’s second-moment accumulator has been asleep at the wheel (seeing near-zero gradients), cranking its effective learning rate up by orders of magnitude. When the gradient suddenly wakes up from $0$ to $\sim 10^{-7}$, Adam panics and takes a massive step ($\sim 50\times$ larger than normal), wrecking the loss.
  • Why ResNet18 is immune: ResNet18 was the only tested architecture that didn't Slingshot. Why? It learns so fast that its incorrect-class probabilities decay faster than the $\mathcal{NFI}$ feedback loop can compound.
  • Silent inflation in LLMs: In mini-batch training and LLMs, not all tokens collapse at once, so Adam stays awake and you don't see dramatic loss spikes. Yet $\mathcal{NFI}$ still operates silently in the background on predictable tokens (like "." or "org"). Curiously, in nanoGPT, switching to float64 actually increased mean logits (from $183$ to $498$), because natural language follows Zipf's law—imbalanced token frequencies create their own weight drift that float32's anti-parallel $\mathcal{NFI}$ drift was accidentally counteracting!

Key Results

  • Pinpoint spike predictions: A back-of-the-envelope scalar calculation using float32 absorption limits ($1.19 \times 10^{-7}$) predicts an Adam parameter update jump to $4 \times 10^{-4}$ at the spike step—matching empirical classifier updates (which jump from $1 \times 10^{-5}$ to bimodal peaks at $\pm 4 \times 10^{-4}$).
  • 100% elimination via zero-sum or BN: Enforcing zero-sum logit gradients or placing BatchNorm immediately before the classifier eliminates 100% of Slingshot spikes (compared to 20/20 runs spiking across 5 seeds each on CIFAR-10 for standard MLP, VGG11, VGG11-BN, and ViT).
  • Normalization Plot Twist: LayerNorm before the classifier actually accelerates Slingshots because normalizing individual sample norms makes angular margins more fragile, whereas pre-classifier BatchNorm cures them by centering the global batch mean.
  • LLM Collapse: During nanoGPT training on FineWeb, roughly $4,000$ out of $130,000$ tokens per step suffer exact Softmax Collapse (strictly zero loss).

Limitations and Future Work

The theoretical derivations rely on the Unconstrained Feature Model—assuming the network backbone is expressive enough to move penultimate features freely in response to gradients. While valid for deep networks, the authors note this oversimplifies shallow networks (where Slingshots are historically harder to trigger) because class means alone cannot capture constrained feature dynamics. Looking forward, as AI hardware marches aggressively toward fp8 and fp4 training, treating finite-precision arithmetic as a first-order driver of optimization dynamics will be vital for keeping large-scale training runs stable.

Summary updated

BibTeX
@inproceedings{hanqing2026grokking,
  author = {Liu Hanqing and Jianjun Cao and Yuanze Li and Zijian Zhou},
  title = {{Grokking or Glitching? How Low-Precision Drives Slingshot Loss Spikes}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=fs99JEN6m5},
}
Figure