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 now known to have several distinct causes. One account ties it to the norm of the weights: a network initialised too large memorises first and generalises only once weight decay has brought the norm down, and fixing or projecting the norm removes much of the delay [1]. Another ties it to the regime of training: the network first fits with nearly fixed initial features, as a kernel method would, and generalises only after it moves into a rich regime that learns new features [2]. A third locates it in the loss, whose cross-entropy keeps scaling the logits of an already fitted set until the softmax saturates numerically [3].
The field responds with one remedy per cause. Grokfast amplifies the slow component of the gradient [4]; Egalitarian Gradient Descent and Muon equalise or orthogonalise matrix updates [5, 6]; ⊥AdamW removes the gradient component along the weights and StableMax replaces the softmax [3]; GrokTransfer trains a weak model first and transfers its embedding [7]; NeuralGrok learns a gradient transformation [8]. Each is tuned for the cause it was designed against. The question here is harder: which single training rule, charged for every pass it makes over the training data, removes the delay across networks whose delay has different causes?
Method
Our method, complementary feature pursuit (CFP), attacks the three causes with three parts that share one premise: a network should start with features that are known to carry information about the labels, and every layer should then move at a rate measured in its own units.
Initial scale and per-layer step sizes
For each weight matrix with rows we measure its gain, the root-mean-square row norm , and take the median over matrices. All parameters are multiplied by
which brings an oversized network down to a median gain of 0.8, where its features can move, and lifts a nearly silent one so that its median squared gain is at least . When the median gain is below one half, a total gain can hide a few nearly silent layers, so each matrix additionally receives a factor , with clamped to and , which tempers the log-gain differences toward the median in proportion to that deficit.
with torch.no_grad():
gains = torch.stack([p.norm() / math.sqrt(p.numel() / p.shape[-1]) for p in matrices])
# Bound the median random-response RMS at both ends. Oversized
# weights delay feature motion, while a vanishing response can
# suppress the supervised gradient through a deep composition.
gain = gains.median()
lower = (0.5 - gain.square()).clamp_min(0.25).sqrt()
scale = torch.maximum(0.8 / gain.clamp_min(0.8),
lower / gain.clamp_min(1e-15))
# Among underpowered initializations, the total gain alone can
# conceal a few nearly silent layers. Temper log-gain differences
# toward the median, in proportion to the variance deficit.
deficit = (1.0 - 4.0 * gain.square()).clamp(0.0, 1.0)
for p in params:
factor = scale
if p.ndim >= 2:
layer_gain = p.norm() / math.sqrt(p.numel() / p.shape[-1])
relative = (gain / layer_gain.clamp_min(1e-15)).clamp(0.25, 4.0)
factor = scale * relative.pow(0.5 * deficit)
p.mul_(factor)An elementwise Adam step has no units. We give it the layer's units back: each matrix receives the base rate times its root-mean-square weight relative to the median over matrices, , so that a large random embedding moves through angle as fast as a small matrix. The base rate is a constant per network family, between 0.0006 and 0.012.
Complementary weak features, trusted only as far as they survive intervention
Before the first step we spend at most passes of the budget on up to four narrow weak models, trained full-batch on the training set through the metered handle the task provides. Stage trains a fresh weak model whose input embedding is projected, after every optimiser step, out of the subspace acquired by the earlier stages, , so that each stage must find something new. We then take the singular vectors of the centred, residualised embedding as that stage's candidate input directions.
How far to trust them is measured, not assumed. A weak readout can lower the loss from its random input features alone, by learning label frequencies and other simple predictions. On the first stage we therefore run a short pilot with the embedding held at its random draw and record how much of the loss that explains, the null ratio ; then the weights are reset and the stage proper begins.
if calibrate:
# A weak readout can learn marginal label frequencies and other simple
# predictions with random features. Measure that contribution directly.
pilot = min(180, max(1, int(0.18 * epochs)))
for _ in range(1, pilot):
last = self.trainer.aux_step(weak, opt, chunk=2048)
used += 1
self.null_ratio = min(1.0, max(0.01, float(last) / max(float(initial), 1e-18)))
with torch.no_grad():
for p, original in zip(weak.parameters(), initial_weights):
p.copy_(original)
opt = _ComplementAdam(groups, embedding, raw, basis)After training, two interventions on the trained weak model, both run as zero-learning-rate metered steps, ask whether its fit depends on what it learned. Permuting the rows of the embedding keeps its spectrum and destroys the learned correspondence, giving a null loss ; removing one right singular direction at a time gives a damage and an importance . The stage's quality is
where is the overlap between the singular subspace at mid-training and at the end, a check that the directions are stable rather than accidental. A direction's transfer strength is its normalised singular value to the power 0.6, times its importance, times . Acquisition stops when a stage's quality falls below 0.075.
# A zero-rate metered weak step measures the full loss in bounded chunks.
measure = torch.optim.SGD(weak.parameters(), lr=0.0)
if probe_count:
perm = torch.randperm(len(view), device=view.device, generator=self.permutation)
view.copy_(original[perm])
with torch.enable_grad():
null_loss = float(self.trainer.aux_step(weak, measure, chunk=2048))
view.copy_(original)
damage = []
for axis in right[:probe_count - 1]:
axis = axis.to(view.dtype)
view.copy_(original - (original @ axis)[:, None] * axis[None])
with torch.enable_grad():
ablated = float(self.trainer.aux_step(weak, measure, chunk=2048))
view.copy_(original)
damage.append(max(1e-4, math.log(max(ablated, 1e-18) / max(float(last), 1e-18))))
if len(damage) == len(singular):
damage = singular.new_tensor(damage)
importance = (damage / damage.mean()).clamp(0.05, 5.0).pow(0.35)
reference = max(float(initial) * self.null_ratio, 1e-18)
quality = max(0.0, 1.0 - float(last) / reference)
if probe_count:
quality *= math.sqrt(max(0.0, 1.0 - float(last) / max(null_loss, 1e-18)))
if middle is not None:
middle = middle - middle.mean(0, keepdim=True)
mid = torch.linalg.svd(middle, full_matrices=False)[0]
persistence = float((u.T @ mid).square().sum() / len(singular))
quality *= min(1.0, max(0.01, persistence))
strength = (singular / singular.square().mean().sqrt().clamp_min(1e-18)).pow(0.6)
strength = strength * importance * math.sqrt(max(0.015, quality))The acquired basis with strengths is blended into the network's own input weights : with rescaled to and for the mean stage quality ,
The norm of the input layer is unchanged; only its directions are pulled toward the features the weak models showed to matter, and the less the weak models explained, the less is transferred. This is the embedding-transfer idea of GrokTransfer [7], with two differences: several complementary weak models instead of one, and a transfer strength set by measured evidence.
with torch.no_grad():
importance = torch.cat(gains)
alpha = 0.56 * max(0.001, sum(qualities) / len(qualities)) ** 0.42
if layout == "pair":
blocks = (e[:, :count].T, e[:, count:2 * count].T)
elif layout in ("raw", "columns"):
blocks = (e[:, :count].T,)
else:
blocks = (e[:count],)
for w in blocks:
estimate = (basis * importance) @ (basis.T @ w)
magnitude = w.norm()
estimate = estimate * (magnitude / estimate.norm().clamp_min(1e-24))
mixed = (1.0 - alpha) * w + alpha * estimate
w.copy_(mixed * (magnitude / mixed.norm().clamp_min(1e-24)))The update: angular Adam with shrinkage that never opposes the gradient
For every matrix the gradient is projected onto the tangent space of the weight sphere, , and rescaled to the norm of , as ⊥AdamW does [3]; the update then changes directions rather than the logit scale. Every sixth step the matrix (oriented so that its shorter side indexes rows) is also shrunk along its weak singular directions by the ridge residual
which acts on a singular value with factor : hardly on strong directions, fully on weak ones. Before it is applied, any component of that would raise the training loss to first order is removed, , and the weights move by for batch size and training-set size .
The Adam moments decay in units of observations: a batch of rows counts as the fraction of a full batch, the decays are and , and bias correction uses the accumulated fraction. A short final batch therefore no longer enters the moments with the weight of a full one. Decoupled weight decay [9] of is applied per layer.
for i, p in enumerate(model.parameters()):
if p.grad is None:
continue
grad = p.grad
if p.ndim >= 2:
g = p.grad.reshape(-1)
w = p.detach().reshape(-1)
unit_weight = w / w.norm().clamp_min(1e-25)
if compress:
matrix = w.reshape(-1, p.shape[-1]).float()
transpose = matrix.shape[0] > matrix.shape[1]
if transpose:
matrix = matrix.T
gram = matrix @ matrix.T
tau = gram.diagonal().mean().clamp_min(1e-12)
gram.diagonal().add_(tau)
residual = tau * torch.linalg.solve_ex(gram, matrix)[0]
residual = (residual.T if transpose else residual).reshape(-1).to(p.dtype)
unit_grad = g / g.norm().clamp_min(1e-25)
residual = residual - (residual @ unit_grad).clamp_max(0.0) * unit_grad
p.add_(residual.reshape_as(p), alpha=-self.shrink)
tangent = g - (g @ unit_weight) * unit_weight
tangent = tangent * (g.norm() / tangent.norm().clamp_min(1e-25))
grad = tangent.reshape_as(p)
if i not in self.moments:
self.moments[i] = (torch.zeros_like(p), torch.zeros_like(p))
m, v = self.moments[i]
# Decay the sufficient statistics in units of observations. Short batches
# otherwise inject much more noise into the optimizer than complete batches.
m.lerp_(grad, 1.0 - first_decay)
v.mul_(second_decay).addcmul_(grad, grad, value=1.0 - second_decay)
rate = self.rates[i]
p.mul_(1.0 - 0.06 * rate)
p.addcdiv_(m, v.sqrt().div_(second_scale).add_(1e-8), value=-rate / first_bias)A loss that conditions on the pair of labels
The loss is times the cross-entropy over supervised positions plus times a pairwise term. For a supervised position with label and a partner with label , drawn by two cyclic offsets of one third and two thirds of the batch, we score which of the two assignments is correct,
Given the unordered pair of labels, this is the exact log-probability of the correct assignment, and any per-class bias added to the logits cancels from it. The term therefore rewards only what distinguishes inputs, never a class-frequency intercept. When the two labels agree the log odds are identically zero and the pair contributes no gradient.
ce = F.cross_entropy(flat, labels, ignore_index=-100, reduction="sum")
ce = ce / mask.sum().clamp_min(1)
positions = mask.nonzero().flatten()
size = len(positions)
if size < 2:
return ce
scores = flat[positions]
labels = labels[positions]
rows = torch.arange(size, device=scores.device)
correct = scores[rows, labels]
# Condition on the unordered pair of output classes. Class-frequency
# biases cancel from the log odds of the two possible assignments.
comparison = ce.new_zeros(())
for index in (1, 2):
other = (rows + max(1, index * size // 3)) % size
odds = correct - scores[rows, labels[other]] + correct[other] - scores[other, labels]
comparison = comparison + F.softplus(-odds).mean() * 0.5
return ce.lerp(comparison, 0.30)Results
| Method | ④ | ⑤ | ⑥ |
|---|---|---|---|
| log10 steps to generalise ↓ | log10 steps to generalise ↓ | log10 steps to generalise ↓ | |
| GPT-6.2 Astra | 2.167 | 5.000 | 2.833 |
| 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 CFP reaches the threshold earliest of all methods: 2.167 against 2.583 for the strongest baseline, Goldilocks norm [1], and 4.083 for AdamW, the rule we started from.
On the other settings CFP does not lead. On ModArith-2L its 2.833 is level with ⊥AdamW and Egalitarian Gradient Descent, earlier than AdamW's 3.000, and behind Muon [6] at 2.417. On Brevo-16 its 3.250 equals AdamW and z-loss and is behind Egalitarian Gradient Descent and Muon, the best at 2.875. On Brevo-12 its 3.500 is behind five baselines, among them AdamW at 3.000.
On ModAdd-MLP and Mano-L2 CFP did not bring generalisation forward at all. Its 5.000 on ModAdd-MLP and 4.699 on Mano-L2 are the largest values in the table on those settings, shared with several baselines including Adam without decay, against 3.750 and 4.000 for AdamW and 2.250 (⊥AdamW [3]) and 3.625 (Muon [6]) for the best baselines.
Against AdamW, CFP is earlier on ModAdd-Tfm and ModArith-2L, level on Brevo-16 and later on ModAdd-MLP, Mano-L2 and Brevo-12. Our development panel predicted a far more uniform gain than this, and the gap between the two is the main finding of this section.
How we got here
We began from the literature on the causes of grokking. The lazy-to-rich account [2] suggested that the delay is the time needed to learn features the initial network lacks, which is what led us to weak-model transfer [7]; the norm account [1] and the tangent update of ⊥AdamW [3] led to the angular update. We also read the original grokking report and work on signal propagation through deep networks, which motivated the gain diagnostic; neither is among the references we may cite.
- A rule per network family was the wrong answer. Our first prototype chose a different optimiser for each network family: a tangent-space AdamW for some, a Muon-style orthogonalised update for one, Grokfast EMA for others, and a weak-model warm start for another. It was fast on our development tasks, but it was a portfolio rather than one algorithm, and we replaced it with a single shared update. The base step size is the one per-family constant that survived.
- Shrinkage had to be stopped from fighting the gradient. Projecting the periodic compression step so that it never opposes the training gradient was, in our development runs, the first shared update to reach 90% held-out accuracy on all six configurations of our design grid. The same shrinkage then stalled two of our sequence tasks. We tried to repair steps by measuring the loss after a proposed change; a later comparison found that this controller had no repeatable advantage, and it was dropped.
- Short batches were silently over-weighted. We traced our worst development failure to a split in which every fourth batch held a single row, which Adam weighted like a full batch. Weighting the moments by the number of observations moved that run, by our measurement, from roughly 3% peak held-out accuracy to 90% at 600 charged passes.
- Full replacement of the input layer was too aggressive. Near-total replacement of the input weights by the weak features solved one of our development tasks very quickly but made another fall below 90%, which is why the transfer is a partial, norm-preserving blend.
- Trust in the weak features had to be measured. Calibrating each weak fit against its locked random features, a permutation null and single-direction ablations changed the mean log10 crossing on our 21-trial development panel from 2.064 to 2.034, with every trial still crossing 90%. Fitting each new weak factor conditionally on the earlier ones, instead of on its own, crossed in only 17 of the 21 trials, at a mean of 2.301. Releasing the weak readout instead of resetting it after the pilot hurt one of our sequence tasks, so we kept the reset.
- A sequence loss that favoured earlier answer positions lowered peak token accuracy in both of our runs; we kept the common cross-entropy as the base of the loss.
- A second cause of delay appeared when we shrank the initial weights. With every initial weight reduced to one quarter, the original one-sided gain normalisation reached 90% in two of six development trials; adding the lower bound on the median gain raised this to five of six, and the final rule reached six of six.
- The pairwise label loss came last. On our panel of shifted development problems it improved the mean log10 crossing from 2.385 to 2.339.
On our final development panel, as we measured it, the submitted rule crossed 90% held-out accuracy in all 21 trials, at a mean log10 of 2.032 passes, against 12 of 21 at 2.835 for Grokfast EMA and 1 of 21 at 2.942 for AdamW, and in 13 of 16 shifted trials. It still left a delay on some of our sequence tasks, a weakness our development runs had already shown.
Limitations
- The gain is not general. CFP is the earliest method on ModAdd-Tfm only. On ModAdd-MLP and Mano-L2 its value is the largest in the table, and on ModAdd-MLP, Mano-L2 and Brevo-12 it is later than the AdamW rule it replaced. The rule does what it was designed to do on part of the benchmark and is later than its own starting point on three settings.
- Our development panel overstated the result. It reported a uniform gain over AdamW that the measured settings do not reproduce. Its tasks were built by us, and our sequence tasks were already the weakest part of it; the outputs behind those development numbers are not available for this run.
- One constant per network family remains. The base step size is set per family. We set out to build one algorithm and replaced an early per-family portfolio for that reason, but the final rule still carries these constants.
- The rule overrides the initial scale. CFP rescales every parameter when it is constructed, before any training. That is part of the method, and it means the network that trains is not the network the driver initialised.
- Many constants are tuned, not derived. The gain targets 0.8 and 0.5, the clamps, the exponents 0.35, 0.42 and 0.6, the quality floor 0.075, the blend coefficient 0.56, the shrinkage period and the 0.3 weight of the pairwise term were all set on our development panel.
- The pairwise term is an empirical bias on sequences. Its exactness argument holds for independent labels; the labels along one sequence are dependent, so there it is a heuristic.
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.
- Zhiwei Xu, Zhiyu Ni, Yixin Wang et al. (2025). Let Me Grok for You: Accelerating Grokking via Embedding Transfer from a Weaker Model. ICLR.
- Xinyu Zhou, Simin Fan, Martin Jaggi et al. (2025). NeuralGrok: Accelerate Grokking by Neural Gradient Transformation.
- 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.