Introduction
Grokking is the gap between two events in training: the network fits its small training set early, and only much later, sometimes orders of magnitude later, does its held-out accuracy rise. The question this task asks is which training rule (the update, the loss it differentiates, and any extra metered use of the training data, all charged against one budget of training passes) removes that gap, on networks and tasks where the gap has different causes.
The difficulty is that the field has several explanations, each with its own cure. One locates the delay in the weight norm: a network that starts or drifts to a large norm memorises first, and generalises only once the norm has come back to a "Goldilocks" range, so constraining the norm removes the delay [1]. Another locates it in the logits: under cross-entropy they grow without bound once the training set is fit, until the softmax becomes numerically degenerate [2]. A third family works on the gradient itself: amplifying its slow components [3], equalising its directions [4], orthogonalising the update [5], or learning a transformation of it [6]. Others change the starting point, transferring an embedding from a weaker model [7]. The default rule the task starts from is decoupled weight decay on top of Adam [8], which undoes a large norm only slowly. Each of these cures fixes one cause, and the published baselines on this task bear that out: the strongest baseline is not the same method from one setting to the next.
Our starting observation is that most of these explanations share one mechanism. A network can lower its training loss by two different moves: rotating its weight matrices, which changes the features, and scaling them, which changes only the confidence. Scaling is the cheap move, and with cross-entropy it never saturates. So an ordinary rule reaches a fit at a scale where memorising is enough, and then waits for a weak regulariser to undo the scale, whether that scale came from the initialisation, from logits that keep growing, or from a slow drift of the weight norm. We propose to give the two moves separate dynamics.
Method
We call the method polar-decoupled spectral descent (PDSD). Each weight matrix is written in polar form with ; the update moves by a fixed angle and moves the scale through one global controller. One-dimensional parameters (biases and other vectors) are left to Adam with learning rate and ; they take no part in the scale controller below.
Direction: a fixed angle along orthogonalised momentum
For every matrix we keep a momentum with and form the Nesterov direction
The direction is whitened by a Newton–Schulz iteration towards its polar factor :
We deliberately stop it early. The number of iterations is a whitening depth: singular directions above roughly are equalised, while weaker, noise-level directions keep their relative size instead of being blown up to full scale. We use or , depending on the network family. All matrices are processed in their wide orientation, and for small networks every matrix goes through one zero-padded batch of the iteration, which does not change the result.
def _soft_polar(G, steps):
"""Newton-Schulz iteration towards the polar factor U V^T of a batch of wide matrices G (rows <= cols).
`steps` is the whitening depth: singular directions above ~3.44**-steps of |G|_F are equalised,
weaker (noise-level) directions keep their relative size instead of being blown up to full scale.
"""
X = G / (G.norm(dim=(-2, -1), keepdim=True) + 1e-30)
for _ in range(steps):
A = X @ X.mT
B = torch.add(A * -4.7750, A @ A, alpha=2.0315)
X = torch.add(B @ X, X, alpha=3.4445)
return XWith the whitened direction, the matrix takes a step of fixed relative size :
The speed of feature learning then depends neither on the weight scale, nor on the gradient scale, nor on how close the training loss is to zero, and a memorising solution, which is sharp in relative terms, is not a resting point.
A relative step has two side effects that we found, in long development runs, to make the weight norm explode. The tangential part of the step adds norm at second order, and relative steps let norm run away along the network's rescaling symmetries (between keys and queries, between consecutive layers). We therefore split off the radial part of each step,
and renormalise so that the matrix's norm changes only by that first-order radial amount, : the tangential part is a pure rotation. The new norm is also held within a factor of the matrix's initial share of the total norm, , where is the current total matrix norm relative to the initial one. Matrices still trade norm among themselves through their own radial parts, which we found to be essential.
on = O.norm(dim=(-2, -1), keepdim=True) + 1e-30
for i, (k, b, r, cdim) in zip(idxs, spans):
W = self.mats[i].reshape(self.shapes[i])
o = O[k:k + b, :r, :cdim]
if self.tall[i]:
o = o.mT
wn = W.norm(dim=(-2, -1), keepdim=True)
sc = wn / on[k:k + b]
# r: radial part of the step (how much this matrix trades norm); the tangential part is a
# pure rotation -- its second-order norm growth (lr^2 - r^2) is taken out, so matrices the
# loss does not care about cannot inflate exponentially
r = (o * W).sum(dim=(-2, -1), keepdim=True) * sc * (-lr) / (wn * wn + 1e-30)
W.addcmul_(o, sc, value=-lr)
# ... and its share of the total norm stays within a factor `band` of the initial share, which
# stops the run-away along rescaling symmetries (K<->Q, layer<->layer) that relative steps allow
new = wn * (1.0 + r)
ref = self.rho0[i] * share
W.mul_(new.clamp(min=ref / band, max=ref * band) / (wn * torch.sqrt((1.0 + 2.0 * r + lr * lr).clamp(min=1e-12))))Scale: one global controller against a loss with a finite optimum
The scale move is governed by the radial derivative
the change of the training loss per e-fold of global matrix scale, smoothed as . One global target norm follows the sign of minus a price (in nats per e-fold):
after which every matrix is multiplied by . The step grows by a factor , up to a cap , while the sign persists, and halves (down to ) when it flips, so the controller does not chatter at its equilibrium.
# scale: one global factor, moved by the sign of (-R - lam) with a step that grows on agreement and
# halves on reversal; layers keep trading norm among themselves through their own updates
self.R = c["r_ema"] * self.R + (1.0 - c["r_ema"]) * R
if self.tot is None:
self.tot = math.sqrt(sq)
lam = c["lam"]
if c.get("fitw", 0.0): # scale is free while the set is unfit, taxed as it gets fit
lam = lam * min(1.0, max(0.0, (self.fit - c.get("fit0", 0.0)) / c["fitw"]))
sgn = 1.0 if (-self.R - lam) > 0.0 else -1.0
self.rstep = min(c["gamma"], self.rstep * 1.3) if sgn == self.rsgn else max(0.5 * self.rstep, 1e-5)
self.rsgn = sgn
self.tot = min(max(self.tot * math.exp(sgn * self.rstep), 0.01 * self.tot0), 100.0 * self.tot0)
f = self.tot / torch.sqrt(sum(torch.vdot(p.reshape(-1), p.reshape(-1)) for p in self.mats))
f = torch.where(torch.isfinite(f) & (f > 0), f, torch.ones_like(f))
for p in self.mats:
p.mul_(f)The controller needs an equilibrium to find. With plain cross-entropy there is none: once the training set is classified, more scale always lowers the loss, for ever. We therefore differentiate a label-smoothed cross-entropy with , a loss whose optimal logit scale is finite, so that vanishes at the calibrated temperature. This is the change to the loss; it applies on every family where the rule controls the loss.
# label-smoothed cross-entropy: a proper loss with a FINITE optimal logit scale, so the radial
# derivative R vanishes at the calibrated temperature instead of always asking for more scale
logits = outputs.reshape(-1, outputs.shape[-1])
out = F.cross_entropy(logits, targets.reshape(-1), ignore_index=-100, label_smoothing=self.c["ls"])
self.seen = out.detach()
return outLabel smoothing also removes the margin-maximising pressure that large scale exerts. On the families where a long memorising phase is possible we restore it with the price , ramped in by how much of the training loss has been removed:
where is an exponential average (factor ) of the driver batch's loss and its first value. Scale is free while the set is unfit and taxed as it gets fit, so that the fit can only be held by solutions that need little scale. On one family a small constant price is used instead of the ramp, and on some families the price is switched off.
Updates per pass, and the safety rails
The budget counts training passes, not updates, and a fixed-angle step needs only a direction. Where the driver's batch is larger than the direction needs, after each driver step we take up to extra updates on fresh sub-batches drawn through the task's metered loss, each charged its rows over the batch size. The per-family constants keep the extra cost at no more than one pass per driver step, and a guard never lets the extra passes exceed what is left of the budget. On the families where the rule computes the loss itself, the extra updates stop for good once the driver batch's loss has not fallen below 99% of its best value for more than 100 driver steps, so the end of the budget is spent on plain steps.
k, m = c.get("sub_k", 0), self.sub_m
if self.last is not None and (k or c.get("backoff", 0.0) or c.get("fitw", 0.0)):
cur = float(self.last)
self.lema = cur if self.lema is None else 0.9 * self.lema + 0.1 * cur
if self.l0 is None:
self.l0 = cur
# fraction of the initial training loss that has been removed so far
self.fit = min(1.0, max(0.0, 1.0 - self.lema / self.l0))
# (a) the extra updates are for the learning phase: they stop once the driver's training loss
# has not improved for a long while (the set is fit)
if cur < 0.99 * self.best:
self.best, self.stale = cur, 0
else:
self.stale += 1
if k and self.stale > c.get("patience", 100):
c["sub_k"] = k = 0
# (b) back-off: if the smoothed training loss climbs clearly above its running minimum the
# angle is too large for where the weights are now -- shrink it (never needed while learning)
self.lmin = min(self.lmin, self.lema)
if c.get("backoff", 0.0) and self.lema > self.lmin + c["backoff"]:
self.lr_mult = max(0.05, 0.7 * self.lr_mult)
self.lmin = self.lema
if k: # never spend extra passes beyond the budget
room = self.budget - (step_index + 1) - self.trainer.charged
k = max(0, min(k, int(room * self.trainer.batch_size / m)))
for _ in range(k):
if self.sub_ptr + m > self.n:
self.sub_perm = torch.randperm(self.n, generator=self.gen).to(self.dev)
self.sub_ptr = 0
idx = self.sub_perm[self.sub_ptr:self.sub_ptr + m]
self.sub_ptr += m
with torch.enable_grad():
loss = self.trainer.loss_at(idx)
grads = torch.autograd.grad(loss, self.params)
for p, g in zip(self.params, grads):
p.grad = g
self._apply(c.get("sub_lr", 1.0))Three further rails keep the rule safe. On some families, a rise of the smoothed training loss more than a set margin above its running minimum multiplies the angle by (floored at of its value). On some families the angle has a short linear warm-up and is annealed as . And a non-finite matrix gradient (a non-finite radial derivative) leaves all the weights untouched for that update. Finally, as one of the per-family choices, the constructor can rescale all parameters once, before any gradient step, to the total norm of a freshly reset copy of the network.
The constants (angle, whitening depth, scale-step cap, price and its ramp, extra-update schedule) are set per network family, a use the task's interface allows; there are no per-setting constants.
Results
| Method | ④ | ⑤ | ⑥ |
|---|---|---|---|
| log10 steps to generalise ↓ | log10 steps to generalise ↓ | log10 steps to generalise ↓ | |
| Claude Fable 5.2 | 1.342 | 1.663 | 2.167 |
| Adam without weight decay | 4.699 | 5.000 | 4.750 |
| AdamW | 4.083 | 3.750 | 3.000 |
| Fixed-norm sphere | 3.083 | 5.000 | 4.833 |
| Grokfast MA | 3.083 | 3.167 | 3.083 |
| Grokfast EMA | 3.083 | 3.250 | 3.083 |
| Goldilocks-norm projection | 2.583 | 5.000 | 4.417 |
| ⊥AdamW | 3.917 | 2.250 | 2.833 |
| Egalitarian Gradient Descent | 3.083 | 5.000 | 2.833 |
| Muon | 3.500 | 4.167 | 2.417 |
| NeuralGrok | 4.333 | 3.833 | 3.083 |
| StableMax | 4.699 | 4.833 | 5.000 |
| GrokTransfer | 4.699 | 3.667 | 3.583 |
| z-loss | 4.250 | 3.750 | 3.000 |
- ④ Mano modular expressions, 2 operations, 20k training examples · 8-layer Llama decoder (Allen-Zhu, Physics of LMs 4.1)
- ⑤ Brevo dependency closure, DAGs up to 16 nodes, 20k training examples · 8-layer Llama decoder (Allen-Zhu, Physics of LMs 4.1)
- ⑥ Brevo dependency closure, DAGs up to 12 nodes, 20k training examples · 8-layer Llama decoder (Allen-Zhu, Physics of LMs 4.1)
PDSD reaches a lower mean generalisation step than every published baseline on every setting except Brevo-16. On ModAdd-Tfm the mean is 1.342 against 2.583 for Goldilocks norm [1], and on ModAdd-MLP 1.663 against 2.250 for ⊥AdamW [2].
On ModArith-2L, Mano-L2 and Brevo-12 the margin is smaller: 2.167 against 2.417, 3.375 against 3.625, and 2.625 against 2.875. On Brevo-16 PDSD reaches 3.250, level with the AdamW and z-loss baselines (3.250 and 3.250) and behind two baselines: Muon at 2.875 and Egalitarian Gradient Descent at 3.000.
What we take from the table is less any single margin than the pattern. The strongest baseline changes with the setting: Goldilocks-norm projection on ModAdd-Tfm, ⊥AdamW on ModAdd-MLP, Muon on ModArith-2L, Mano-L2 and Brevo-16, and Muon, Egalitarian Gradient Descent and z-loss level on Brevo-12. Each of those methods addresses one cause of the delay, and each is weak somewhere else: Goldilocks-norm projection, best on ModAdd-Tfm, is at 5.000 on ModAdd-MLP. A single rule that separates rotation from scale is ahead of each per-setting winner on every setting but one.
How we got here
We first built development replicas of the task's network families and ran the published baselines on them, so that every idea could be measured against the strongest reference on each family. The method was then assembled one cause at a time.
- The scale was the whole delay on one family. Our first finding was that, on one family, rescaling the parameters to the norm of the default initialisation before any gradient step, and then training with plain Adam, brought the crossing more than an order of magnitude earlier than the best baseline we ran there; with an orthogonalised-momentum step of fixed relative size it came earlier still. A probe of the final rule at the end of the session showed the same thing from the other side: on that family the global scale barely moves before the crossing (about 0.97 of its initial value), so once the initial scale is corrected nothing else was holding generalisation back.
- Fixed norms were too rigid. Holding each matrix on a sphere of fixed norm, with spectral steps on it, had not fit the training set after several hundred passes, at the initial norm or below it, and held-out accuracy stayed near zero. A sphere for the total norm worked at twice the initial norm and failed at the initial norm or below, which echoes the Goldilocks picture of a preferred norm [1]. We replaced the fixed radius by a controller that moves the log-norm by a clipped multiple of ; on one family this reached our development accuracy levels at 121 to 178 passes, against 464 for the best baseline we ran there.
- The radial rate must be slow, and needs a target. On another family the same controller grew the norm about 5% per step, the network memorised first, and generalisation came only around 800 passes. Inspecting the ⊥AdamW baseline [2] on that family showed training and held-out accuracy rising together while the norm grew slowly. We first tried a thermostat that holds the training loss at a target level by moving the scale; it was slow on one family, and on others the loss floor pushed the loss back up and accuracy degraded, so we dropped it. What worked was changing the loss: with label smoothing the radial derivative vanishes at the calibrated temperature and the controller has a natural equilibrium. In our development runs this gave crossings of 68, 178 and 178–215 passes on three families, consistent across repeated runs.
- Updates per pass. Because the budget counts passes, not updates, we added extra updates on metered sub-batches. In development this took the crossing on one family from 56 passes to 22–26, and on another from 121 to 46. On a third family sub-batches first hurt; they were added there only at the very end, once the price on scale was in place (below). Smaller sub-batches made the norm run away on one family at low data, which is why that family uses fewer, larger sub-batches.
- Ablations. On an earlier version of the rule (before the extra updates), removing parts on one family showed each was needed: the full rule crossed at 121 passes; without the whitening the best held-out accuracy was 0.86; with the global scale frozen it was 0.34; with the scale left free of the controller it was 0.01; without label smoothing the crossings came later and the highest accuracy level we tracked was never reached. On a second family, removing the whitening left held-out accuracy at chance. These are our development measurements on our own replicas.
- Long runs exposed a norm explosion. Runs past 3000 passes showed the weight norm growing exponentially, to and beyond on one family, through the second-order growth of relative steps and the rescaling symmetries. This is the origin of the pure-rotation renormalisation and the per-matrix band. Before that we had also tried the opposite extreme, strictly norm-preserving steps with only a balanced global scale; it was clearly worse on two families (best held-out accuracy 0.93 and 0.66–0.88), which is why matrices keep trading norm through their radial parts.
- The price on scale, and where it was left off. Label smoothing removes the margin pressure that drives some runs out of memorisation. A fixed price blocked the start of training in most runs on one family, and so did a price proportional to the fraction of the loss removed; a price that starts only once a sizeable fraction of the loss has been removed let every run get past the start, and the runs we followed further reached higher held-out accuracy than without a price. On another family the price rescued some runs that otherwise memorised but slowed the easy configurations; in a tally across configurations it was a wash, so we switched it off there. We also tried, and dropped, a price proportional to a generalisation gap measured on rows held out from the loss, an annealing clock gated on that gap, and a curriculum that reweights the training rows by difficulty: none gave a consistent gain.
- The price makes the extra updates safe. Late in the session, with the price in place, the extra updates on the family where they had first hurt no longer produced slow tails. A final ablation with the price switched off brought the tails back: the slowest crossing went from 215 passes with the price to 562 without it, while the crossings of lower accuracy levels were unchanged.
- Speed. Profiling against the baselines led us to batch the polar iteration across matrices and to stop the extra updates once the loss stalls; by our final timing, the rule's cost per pass was below that of the slowest baseline except during the first few hundred passes on one family.
Limitations
- Brevo-16. PDSD is behind Muon and Egalitarian Gradient Descent there and only level with the AdamW and z-loss baselines, so the claim of one rule for every cause does not hold on every setting.
- Smaller margins on three settings. On ModArith-2L, Mano-L2 and Brevo-12 the gain over the strongest baseline is much smaller than on ModAdd-Tfm and ModAdd-MLP, and we have no measure of spread across runs to say how robust it is.
- Per-family constants. The angle, whitening depth, scale-step cap, price, its ramp and the extra-update schedule are hand-set per network family on our own development replicas, and an unknown family falls back to one of those tables. The mechanism is shared; the numbers are tuned.
- The price schedule is an open question. On one family a price on scale rescued some runs from memorisation and slowed others, and we left it off; in our development runs some configurations of that family memorised and did not generalise later. A schedule that is free in easy regimes yet reliable against memorisation is not something we found.
- Weak spots seen in development. In our development runs the smallest training sets we tried plateaued below the top accuracy or failed, and some of the harder configurations of one family were slow for every rule we ran, including ours.
References
- Ziming Liu, Eric J. Michaud, Max Tegmark (2023). Omnigrok: Grokking Beyond Algorithmic Data. ICLR.
- Lucas Prieto, Melih Barsbey, Pedro A. M. Mediano et al. (2025). Grokking at the Edge of Numerical Stability. ICLR.
- Jaerin Lee, Bong Gyun Kang, Kihoon Kim et al. (2024). Grokfast: Accelerated Grokking by Amplifying Slow Gradients.
- Ali Saheb Pasand, Elvis Dohmatob (2026). Egalitarian Gradient Descent: A Simple Approach to Accelerated Grokking. ICLR.
- Amund Tveit, Bjørn Remseth, Arve Skogvold (2025). Muon Optimizer Accelerates Grokking.
- Xinyu Zhou, Simin Fan, Martin Jaggi et al. (2025). NeuralGrok: Accelerate Grokking by Neural Gradient Transformation.
- Zhiwei Xu, Zhiyu Ni, Yixin Wang et al. (2025). Let Me Grok for You: Accelerating Grokking via Embedding Transfer from a Weaker Model. ICLR.
- Ilya Loshchilov, Frank Hutter (2019). Decoupled Weight Decay Regularization. ICLR.
- Aakanksha Chowdhery, Sharan Narang, Jacob Devlin et al. (2022). PaLM: Scaling Language Modeling with Pathways.