Introduction
A network trained on a small training set can fit it almost at once and then stay near chance on held-out data for a long time before it generalises. This delay, grokking, is what the task asks us to remove: we may change the update, the loss it differentiates and any extra use of the training data, and the measure is the log10 of the first training step at which held-out accuracy reaches a threshold.
The difficulty is that the delay does not have a single cause. Omnigrok traced it to the weight norm: networks initialised with a large norm memorise first and generalise only once weight decay has brought the norm down to a "Goldilocks" range [1]. A closely related account describes the delay as the transition from lazy, kernel-like training to rich feature learning [2]. Another line of work locates it in the loss: once the training data is fitted, the gradient of cross-entropy aligns with the weights, so the update scales the logits without rotating features, until floating-point softmax collapse removes the gradient altogether [3]. Yet another locates it in the spectrum of the update, where slow, generalising directions are drowned out by fast memorising ones; this is what gradient filtering [4], equalised gradient descent [5] and orthogonalised updates [6] act on. Published methods typically fix one of these causes, and a method that fixes one can leave another untouched or make it worse: on a network whose delay is caused by noise in small mini-batches, a fully orthogonalised update can amplify that noise along with the signal.
We therefore asked for one rule that removes each of these causes where it occurs and does nothing where it does not, and that decides which regime it is in from quantities it can measure during training.
Method
Our method, SMCA, keeps the shape of Adam with decoupled weight decay [7], which is the starter rule, and changes the loss, the initial scale, the gradient that enters Adam, the direction that leaves it, and when weight decay acts. It makes no extra passes over the training data and trains no auxiliary model.
A loss that keeps fitted rows active
For every family except the one whose squared-error loss is fixed by the protocol, we replace cross-entropy by a margin-equilibrium cross-entropy computed in float64. With logits , their centred version and target ,
averaged over the positions that carry a target. The first two terms are ordinary cross-entropy, since it is invariant to the shift. The penalty bounds the logits: once a row is fitted, pushing its margin further costs more in the penalty than it saves in cross-entropy, so the radial growth that ends in softmax collapse stops at a finite margin, and the row keeps contributing a gradient that can rotate features. The second penalty term also holds the mean logit near zero. Computing in float64 removes the underflow of that the softmax-collapse analysis identifies [3]. The penalty plays a role related to the z-loss of PaLM [8], which penalises the squared log-partition function; ours penalises the logits themselves. When a batch has no target positions, the loss returns a zero that is still connected to the graph, so the backward pass runs.
logits = outputs.reshape(-1, outputs.shape[-1])
tgt = targets.reshape(-1)
keep = tgt != -100
if not bool(keep.any()):
return outputs.sum() * 0.0
z = logits[keep].to(torch.float64)
y = tgt[keep]
zc = z - z.mean(dim=-1, keepdim=True)
ce = torch.logsumexp(zc, dim=-1) - zc.gather(1, y[:, None]).squeeze(1)
reg = 0.5 * self.LOGIT_REG * (zc.pow(2).sum(dim=-1) + z.pow(2).mean(dim=-1))
return (ce + reg).mean()A one-off rescaling of the initial weights
Before training, the rule rescales the initialisation once. For networks without normalisation layers the whole parameter vector is multiplied by a per-family constant; for networks with normalisation layers, only the matrices inside the residual blocks are. Embedding tables whose entries have a standard deviation above 0.3 are divided by . For one MLP family the network is rescaled so that its squared norm is a fixed fraction of the expected squared norm of the default uniform initialisation, for the weights, which is the Omnigrok prescription of starting inside the Goldilocks range rather than waiting for weight decay to reach it [1]. The per-family constants range from 0.6 to 1.0, and a constant of 1.0 means that the family is not rescaled.
elif init_s != 1.0:
for name, p in model.named_parameters():
if not has_norm:
p.mul_(init_s)
elif name.startswith(("blocks.", "layers.")) and p.ndim >= 2:
p.mul_(init_s)
for name, p in model.named_parameters():
if ("embed" in name or "tok_embeddings" in name) and p.ndim == 2:
if float(p.float().std()) > 0.3:
p.mul_(1.0 / math.sqrt(p.shape[-1]))Tangential, length-preserving gradients
On networks whose output scales with the weight norm, the radial part of the gradient is what grows the logits without changing features. For each matrix with gradient we remove it and restore the length:
This is the projection of ⊥AdamW [3], with the difference that we keep the gradient's length, so that the projection changes only its direction. Embedding tables are projected row by row. The projection is switched off for vectors, for the readout of networks with normalisation layers, and for every parameter of networks with RMS-style normalisation inside the blocks, where internal norms do not set the logit scale. Weight decay applies to every parameter except biases, including the gains of normalisation layers, and the readout of networks with normalisation layers other than RMS-style ones is decayed at a quarter of the rate.
Stage 1: spectral conditioning before Adam, gated by coherence
Matrices of equal shape are stacked and processed together. Our spectral operator is a damped Newton-Schulz iteration with the quintic coefficients used for orthogonalised updates [6], with two changes: the input is divided by times its Frobenius norm, with , and only one to three iterations are run, so the singular values are pulled toward one but not set to one; and the output is rescaled to the input's Frobenius norm. With and ,
@staticmethod
def _ns_rms(U, steps, damp):
if steps <= 0:
return U
a, b, c = (3.4445, -4.7750, 2.0315)
orig_T = U.size(-2) > U.size(-1)
Xf = U.float()
if orig_T:
Xf = Xf.mT
u_nrm = Xf.norm(dim=(-2, -1), keepdim=True).clamp_min(1e-30)
X = Xf / (damp * u_nrm)
if X.size(-2) >= 256 and X.is_cuda:
X = X.bfloat16()
for _ in range(steps):
A = X @ X.mT
B = b * A + c * (A @ A)
X = a * X + B @ X
X = X.float()
if orig_T:
X = X.mT
return X * (u_nrm / X.norm(dim=(-2, -1), keepdim=True).clamp_min(1e-30))The question is when to apply it. On full-batch, nearly deterministic gradients, conditioning the raw gradient before Adam is what spreads the step over the weak generalising directions; on noisy mini-batch gradients the same cubic map rectifies zero-mean noise, , and biases the step. We decide from a measured quantity. For white gradient noise, the bias-corrected Adam ratio has the expected square
so the excess of the measured mean square over that floor estimates how coherent the gradient is from step to step. Per group of stacked matrices we keep
with starting at 1. The gradient that enters Adam is the tangential gradient blended with one damped iteration of it, , rescaled to the norm of ; for the input is alone, and for it is alone. Both Adam moments are then accumulated from this same tensor, so that, as we argued in our notes, the ratio stays bounded entrywise.
with torch.no_grad():
for gi, ((r, c), items) in enumerate(self.op_groups):
alpha_pre = min(1.0, max(0.0, 3.5 * self.coh[gi]))
gs = []
for p, _, _, tang, _, split3 in items:
g = p.grad
if tang > 0.0:
wf, gf = p.reshape(-1), g.reshape(-1)
gn = gf.norm()
if gn > 0:
go = gf - (tang * (torch.dot(wf, gf) / (torch.dot(wf, wf) + 1e-30))) * wf
g = (go * (gn / (go.norm() + 1e-30))).reshape_as(g)
gs.append(g.reshape(3 if split3 else 1, r, c))
G_raw = torch.cat(gs, dim=0).float()
if alpha_pre > 0.02:
Qg = self._ns_rms(G_raw, 1, 1.2)
if alpha_pre < 0.98:
g_nrm = G_raw.norm(dim=(-2, -1), keepdim=True).clamp_min(1e-30)
G_in = (1.0 - alpha_pre) * G_raw + alpha_pre * Qg
G_in = G_in * (g_nrm / G_in.norm(dim=(-2, -1), keepdim=True).clamp_min(1e-30))
else:
G_in = Qg
else:
G_in = G_rawStage 2: a polar direction after Adam, and momentum-polar in the noisy regime
After Adam we form a second, spectrally conditioned direction . When the gradient is coherent (), is applied to the Adam ratio . Otherwise we also condition the averaged momentum, rescaled to , because averaging has already removed much of the noise that the ratio still carries, and blend . In this noisy regime the step is also lengthened when the update is small:
where scales the lengthening down once falls below a quarter of the noise floor, and to zero as the update vanishes after convergence. The direction we apply is the even blend , rescaled to , with learning rate .
Uf = torch.cat(us, dim=0).float()
u_nrm = Uf.norm(dim=(-2, -1), keepdim=True).clamp_min(1e-30)
u_sq_mean = float(Uf.pow(2).mean())
if t >= 2 and c_noise < 0.999:
gamma_now = max(0.0, min(1.0, (u_sq_mean - c_noise) / (1.0 - c_noise)))
self.coh[gi] = 0.88 * self.coh[gi] + 0.12 * gamma_now
if alpha_pre >= 0.98:
P = self._ns_rms(Uf, 2, 1.3)
lr_op = lr
else:
Mf = torch.cat(ms, dim=0).float()
Qm = self._ns_rms(Mf, 3, 1.15)
Qm_u = Qm * (u_nrm / Qm.norm(dim=(-2, -1), keepdim=True).clamp_min(1e-30))
if alpha_pre > 0.02:
Qu = self._ns_rms(Uf, 2, 1.3)
P = alpha_pre * Qu + (1.0 - alpha_pre) * Qm_u
else:
P = Qm_u
u_rms_grp = max(u_sq_mean ** 0.5, 1e-8)
active = min(1.0, u_sq_mean / max(0.25 * c_noise, 1e-8))
raw_tau = min(self.TAU_MAX, max(0.0, self.U_REF / u_rms_grp - 1.0))
tau_op = 1.0 + (1.0 - alpha_pre) * active * raw_tau
lr_op = lr * tau_op
D = 0.5 * Uf + 0.5 * P
D = D * (u_nrm / D.norm(dim=(-2, -1), keepdim=True).clamp_min(1e-30))Weight decay that knows when to act
The last step is the decoupled update
where the factor is used only when . Two gates act on the decay. The equilibrium gate turns decay off once the update has converged, so a network that has generalised is not then shrunk away from its solution. The gate protects layers that have not yet received a gradient signal: in a deep network supervised only at its output, lower layers can have an almost zero second moment for a long stretch of early training, and full decay would shrink them toward zero before any signal reaches them. Decay is multiplied by the same as the step, so that it keeps pace with the lengthened step. Embeddings, the readouts of the attention-based networks and all vectors are updated by Adam, on the tangential gradient where the projection is on, with the same two gates, at the base learning rate.
D = 0.5 * Uf + 0.5 * P
D = D * (u_nrm / D.norm(dim=(-2, -1), keepdim=True).clamp_min(1e-30))
eq_grp = min(1.0, 1000.0 * u_sq_mean)
idx = 0
for item_i, (p, _, _, _, wd, split3) in enumerate(items):
cnt = 3 if split3 else 1
d_slice = D[idx:idx + cnt]
idx += cnt
if wd > 0.0:
vb = v_boots[item_i]
if vb is not None:
p.mul_(1.0 - (lr_op * wd * eq_grp) * vb)
else:
p.mul_(1.0 - lr_op * wd * eq_grp)
p.add_(d_slice.reshape(p.shape).to(p.dtype), alpha=-lr_op)The learning rate, decay rate, Adam betas, warm-up length and initial rescaling are per-family constants, which the task's interface allows; everything else, including the switch between regimes, is decided per step and per group of matrices from measured statistics.
Results
| Method | ④ | ⑤ | ⑥ |
|---|---|---|---|
| log10 steps to generalise ↓ | log10 steps to generalise ↓ | log10 steps to generalise ↓ | |
| Gemini 4 Carbon | 2.417 | 2.250 | 2.667 |
| 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)
On ModAdd-Tfm SMCA generalises earlier than every published baseline: a log10 generalisation step of 2.417 against 2.583 for the strongest baseline, Goldilocks norm [1]. On ModAdd-MLP it reaches 2.250, the same value as ⊥AdamW (2.250), the best baseline there; on Brevo-12 it reaches 2.875, level with Muon, Egalitarian Gradient Descent and z-loss (2.875).
On ModArith-2L, Mano-L2 and Brevo-16, Muon generalises earlier: 2.417, 3.625 and 2.875, against our 2.667, 3.875 and 3.000. On Mano-L2 Egalitarian Gradient Descent and z-loss (3.750) are also ahead of us, and on Brevo-16 Egalitarian Gradient Descent is level with us (3.000).
What the table shows most clearly is breadth. SMCA generalises earlier than the starter rule, AdamW, on every setting. Each baseline that beats it somewhere is clearly behind it elsewhere: Muon, which is the strongest baseline on ModArith-2L, Mano-L2 and Brevo-16, reaches 4.167 on ModAdd-MLP, where we reach 2.250, and ⊥AdamW, which we only match on ModAdd-MLP, reaches 4.699 on Mano-L2. No published baseline is at or below SMCA on every setting.
How we got here
We began by reading the starter, the fixed driver and the reference methods, and by running most of the baselines on a small development suite of our own. In those development runs no baseline was fast on all of them, and several were slow or failed on some, which is what set the goal of one rule that covers the different causes rather than a better version of any one baseline. The literature we read at this stage included the papers behind the baselines, a steepest-descent view of training under spectral norms, and work on grokking under norms other than the Euclidean one; the last two are not among the works we can cite here.
The method then grew in versions, and most of what is in it was added to repair a measured failure.
- The loss came first and mattered at once. Adding the margin-equilibrium cross-entropy to our first spectral rule was, in our development runs, the single change that cut the generalisation step on one problem from 3162 to 464 steps.
- Full orthogonalisation amplified memorisation. A Muon-style five-step orthogonalisation sets every singular value to one, and in our development runs this raised the incoherent, memorising tail of the gradient on an MLP problem and slowed generalisation there. One or two damped iterations, which only condition the spectrum, did not, and that is the operator we kept.
- Conditioning the Adam ratio alone broke low-rank gradients. On full-batch gradients the ratio is close to a sign matrix, which turns a low-rank gradient into a full-rank one; two Newton-Schulz iterations on it then inflated the spurious modes, and memorisation on one development problem went from 147 to 2610 steps. Conditioning the gradient before Adam, with both moments accumulated from the conditioned tensor, fixed that, and the Stage-1 and Stage-2 split comes from here.
- Conditioning before Adam failed on mini-batches. On a development problem trained with small mini-batches, Stage-1 conditioning stalled accuracy below 40%, and removing it and conditioning the averaged quantities instead unlocked generalisation. This is why Stage 1 is gated by the coherence estimate rather than always on, and why the momentum-polar branch exists.
- Normalisation gains offered a way around weight decay. With decay applied only to matrices, a deep normalised network shrank its matrices and grew its normalisation gains, kept its total weight norm high and memorised. Decaying every parameter except biases closed that route.
- Several schedules for weight decay did not survive. A decay strength tied to how well the training data was fitted deadlocked a deep network that could not fit its training data until its norm had already come down. A stronger decay to match a longer step overshot when the update was small. A gate on the second moment alone protected silent layers but also switched decay off where the initial rescaling made gradients small. The final rule keeps the convergence gate and blends the silent-layer gate in only in the noisy regime.
- Smaller dead ends. Nesterov momentum in the momentum-polar branch made a converged network oscillate after it had generalised, so we use the plain averaged momentum. An earlier version rescaled the blended direction to an upper bound on its norm, which inflated the step; the final version rescales it to . Warm-starting the embedding from a small auxiliary model, in the spirit of GrokTransfer [10], sped up one problem but slowed two others, and we dropped it.
In a component ablation of an earlier version of the method, averaged over four of our development problems, we measured a mean log10 generalisation step of 2.0612 for the full rule, against 2.8739 without the tangential projection, 2.6665 without the initial rescaling, 2.1894 without Stage-1 conditioning, 2.1862 without the margin-equilibrium loss and 2.1472 without the Stage-2 polar direction. Each of these five parts contributed, and the projection and the rescaling contributed most. These are our development measurements on its own problems, not results on the task's settings.
Limitations
- Muon is ahead on ModArith-2L, Mano-L2 and Brevo-16. On ModArith-2L, Mano-L2 and Brevo-16 a single published optimiser generalises earlier than our rule; the breadth of SMCA comes at a cost on the settings where orthogonalised updates alone are already enough.
- The rule has many hand-set constants. The coherence weight , the smoothing , the convergence gate , the silent-layer threshold , the damping factors and iteration counts of the three Newton-Schulz uses, the target and the cap of the step lengthening were all set from development runs. The diagnoses behind them were each made on one or a few development runs, and our notes call some of them theorems; they are hypotheses that fitted those runs.
- The per-family constants carry part of the result. Learning rate, decay rate, betas, warm-up and the initial rescaling are set per network family. Our docstring describes the initial rescaling as a depth-preserving law, ; the submitted code uses fixed per-family constants close to that law for the shallow transformers and does not rescale the deepest networks at all; in our development runs the law's value there made gradients so small that a gate on the second moment switched the decay off.
- The coherence estimate assumes white noise. The floor is exact only for uncorrelated gradient noise, and it is averaged over a whole group of stacked matrices, so one group can sit in the wrong regime when its matrices differ.
- The update costs more than Adam. Up to six Newton-Schulz iterations per group of matrices per step, and float64 logits, add wall-clock time that a plain optimiser does not pay.
- We used none of the metered extras. The interface allows extra passes over the training data and an auxiliary weak model; SMCA uses neither, so any gain those could bring is left on the table.
References
- Ziming Liu, Eric J. Michaud, Max Tegmark (2023). Omnigrok: Grokking Beyond Algorithmic Data. ICLR.
- Tanishq Kumar, Blake Bordelon, Samuel J. Gershman et al. (2023). Grokking as the Transition from Lazy to Rich Training Dynamics.
- 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.
- 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.
- 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.