Introduction
When unique text runs out, a language model is trained on the same tokens again and again. A sparse mixture of experts is especially exposed to this: its total parameter count is much larger than its active parameter count, so the same pool has to be absorbed by far more parameters than a single token ever uses. The question of this task is how to train a fixed mixture-of-experts decoder on a fixed, limited pool so that what it learns transfers to held-out text. Everything about training is open: the objective, regularisation inside the network, the optimizer and its schedules, the batch plan, how reads are spread over the pool's sources, and what is done to the weights between steps or at the end. The total training compute may not exceed the default recipe's, so any method that spends extra forward passes per token must train on fewer tokens.
The usual answer to repetition is regularisation inside the network. Mixture-of-experts work offers expert dropout and router jitter [1] and gating dropout [2]; the published baselines of this task add residual dropout, masking of expert or feed-forward outputs, random token replacement, masked-input views, chained self-distillation and weight averaging, and two whole recipes, a regularised one from work on pre-training when compute is plentiful [3] and one tuned for repeated-data pretraining [4]; strong weight decay, drawn from work on data-constrained training [5], is another. Most of these mechanisms are applied uniformly through training, and those that add forward passes pay for them with a shorter token plan.
We take a different view of where the overfitting comes from. Under the default recipe the learning rate decays linearly through training, and as it falls the model memorises the pool: in our proxy experiments the training loss kept falling far below the held-out loss in the last epochs while the held-out loss stopped improving. That suggests the lever is the schedule itself rather than a regulariser added on top of it.
Method
Our recipe changes only the optimizer hook. The loss is the starter's single cross-entropy pass with no training hooks, the batch plan is the starter's full plan, and the default optimizer (a Newton-Schulz update for the weight matrices and Adam-type updates for the output head, embedding, router, gates and norms, in two learning-rate groups) keeps its parameter groups and hyperparameters. We wrap it with three additions: a warmup-stable-decay schedule, a tail average of the weights, and a decoupled decay on the token embedding.
class Trainer(nn.Module):
def __init__(self, cfg, backbone):
super().__init__()
self.backbone = backbone
self.dec = HK.HookedDecoder(backbone, Hooks())
def loss(self, tokens, loss_weight, seq, ctx):
h = self.dec.states(tokens, seq, ctx)
return HK.lm_loss(self.backbone, h, HK.next_labels(tokens), loss_weight)
def hidden(self, tokens, seq):
return R.stack(self.backbone, R.embed(self.backbone, tokens), seq)Everything is measured in epochs of the unique pool
A recipe that has to work for decoders of different sizes and different numbers of repetitions cannot use constants in steps. We express every timescale except the 2% warmup in epochs of the unique pool and convert it with the run's own context. With planned optimizer steps, unique sequences in the pool and sequences per step, the number of steps per epoch is
where is the number of planned epochs. If the pool size is not available we fall back to with the planned number of repetitions, and failing that to .
WARM_FRAC = 0.02
DECAY_EPOCHS = 2.0
EMA_HORIZON_EPOCHS = 1.0
EMA_BLEND = 0.5
EMB_DECAY_EPOCHS = 0.75
def _run_shape(ctx):
"""(num_steps, steps_per_epoch, planned_epochs) from the context."""
n = max(1, int(ctx.num_steps))
uniq = float(ctx.extra.get("unique_sequences") or 0)
rep = float(ctx.extra.get("repeat") or 0)
if uniq > 0 and ctx.batch_size > 0:
spe = uniq / ctx.batch_size
elif rep > 0:
spe = n / rep
else:
spe = float(n)
spe = min(max(spe, 1.0), float(n))
return n, spe, max(n / spe, 1.0)
def _wsd(peak, n, decay_frac):
w = max(1, int(WARM_FRAC * n))
d = max(1, int(round(decay_frac * n)))
def lr(count):
if count < w:
return peak * count / w
if count < n - d:
return peak
return peak * max(n - count, 0) / d
return lrThe schedule is the regulariser
The default schedule warms up and then decays the learning rate linearly through the run. We replace it, for both learning-rate groups, by a warmup-stable-decay schedule of the kind introduced for training without a fixed duration [6, 7]: a linear warmup over steps, the default peak held constant, and a linear anneal to zero over the last steps,
The anneal therefore lasts two epochs of the pool, within the bounds of 5% and 30% of the run. The
peak is the default recipe's own heuristic peak (lr_scale = 1.0); we tried larger peaks and they
helped only at the smaller of our proxy scales (Section 4).
The reasoning is that at a high, constant learning rate the noise of the iterates prevents the model from fitting the repeated pool closely, so the training loss plateaus instead of collapsing, while the iterates wander around a good region of weight space. The terminal anneal then collapses that wandering into one point. With a linear decay the learning rate is already low through the last passes over the pool, which is when memorisation sets in; with this schedule every pass in the plan is spent at the high rate except the short warmup and the last two epochs.
A tail average of the weights
The anneal is one way to average the stable-phase orbit; a weight average is another, and we use both. We keep an exponential moving average of all optimizer-managed parameters with a horizon of one epoch,
started at step , so that it covers roughly the last three epochs: the end of the stable phase and the anneal. The first step with copies the weights; every later step updates . At the end of training the saved weights are an even blend of the final iterate and the average,
lr_scale = 1.0
decay_frac = min(max(DECAY_EPOCHS / epochs, 0.05), 0.30)
self.inner.lr = _wsd(self.inner.cfg.learning_rate * lr_scale, n, decay_frac)
self.inner.adam_lr = _wsd(self.inner.cfg.adam_lr * lr_scale, n, decay_frac)
horizon = min(max(EMA_HORIZON_EPOCHS * spe, 1.0), max(n / 2.0, 1.0))
self.ema_decay = min(max(1.0 - 1.0 / horizon, 0.0), 0.99995)
self.ema_start = int(max(0.0, n - 3.0 * horizon))
self.shadow = None
self._embed = [pi.param for g in groups.values() for pi in g if pi.kind == "embedding"]
alr_peak = self.inner.cfg.adam_lr * lr_scale
wd = 1.0 / max(alr_peak * spe * EMB_DECAY_EPOCHS, 1e-9)
self.emb_wd = min(max(wd, 0.02), 5.0)The embedding forgets stale updates
The third component is a decoupled weight decay applied only to the token embedding. After each optimizer step, with the Adam learning rate the schedule assigns at that step, every embedding parameter is multiplied by
and only when . Unclipped, this choice of makes the cumulative decay over steps at peak learning rate : an embedding update is forgotten with an -folding time of three quarters of an epoch. Because the decay is multiplied by the scheduled rate, it is gentle during warmup and vanishes at the end of the anneal. The intent, as our docstring states it, is not to shrink the function: the argument is that the embedding's row scale is removed by the normalisation that follows it, so the decay instead bounds how long an embedding keeps integrating gradients from the same repeated contexts. We decay nothing else. The default optimizer, as we read it, keeps the norm of each matrix it updates fixed, so a decay on those matrices would not act as one, and a decay on the output head was disastrous in our development runs (Section 4).
@torch.no_grad()
def step(self, step):
alr = self.inner.adam_lr(self.inner.count)
info = self.inner.step(step)
if self._embed and alr > 0:
f = max(0.0, 1.0 - alr * self.emb_wd)
for p in self._embed:
p.mul_(f)
done = step + 1
if done > self.ema_start:
if self.shadow is None:
self.shadow = [p.detach().clone() for p in self.params()]
else:
d = self.ema_decay
for s, p in zip(self.shadow, self.params()):
s.mul_(d).add_(p, alpha=1.0 - d)
return info @torch.no_grad()
def finalize(self):
if self.shadow is not None:
for s, p in zip(self.shadow, self.params()):
p.mul_(1.0 - EMA_BLEND).add_(s, alpha=EMA_BLEND)Nothing in the forward pass changes, so the recipe trains on the full token plan at exactly the default recipe's compute, and adds no trainable parameters: the average is a frozen copy kept by the optimizer.
Results
| Method | ① |
|---|---|
| Paloma macro loss ↓ | |
| Muse Wonder Full | 3.386 |
| Augmentation combination | 3.581 |
| Augmentation combination, WSD | 3.700 |
| q0 | 3.522 |
| q0, WSD | 3.559 |
| WSD schedule | 3.449 |
| Residual dropout | 3.525 |
| Residual dropout, WSD | 3.550 |
| Weight-EMA blend | 3.597 |
| Weight-EMA blend, WSD | 3.516 |
| Expert dropout | 3.520 |
| Expert dropout, WSD | 3.568 |
| Expert-output masking | 3.570 |
| Expert-output masking, WSD | 3.529 |
| FFN-output masking | 3.560 |
| FFN-output masking, WSD | 3.538 |
| Gating dropout | 3.594 |
| Gating dropout, WSD | 3.559 |
| Masked-input regularization | 3.531 |
| Masked-input regularization, WSD | 3.500 |
| Default training recipe | 4.018 |
| Kim et al. | 3.611 |
| Min | 3.424 |
| Router jitter | 3.586 |
| Router jitter, WSD | 3.521 |
| Lovelace et al. | 3.759 |
| Random token replacement | 3.545 |
| Random token replacement, WSD | 3.597 |
- ① d768 · 2.039B parameters · about 553M unique tokens · 8,192-token sequences · held-out Paloma macro loss
On d768 our recipe reaches a held-out loss of 3.386, below every published baseline. The strongest of them is Rep-tuned [4] at 3.424; the default recipe with a warmup-stable-decay schedule reaches 3.449, and the default recipe itself 4.018. Most of the distance from the default recipe is therefore covered by a change of schedule alone; the remaining step from 3.449 to 3.386 is what our version of the schedule, with its anneal length and warmup set in our own way, and our two additions, the tail average and the embedding decay, buy together.
The published baselines tell the same story as our development runs. The two strongest are the two recipes built around a warmup-stable-decay schedule, the repetition-tuned recipe and the schedule-only default. Every baseline published as a regulariser combined with that schedule is worse than the schedule alone: the best of them, masked-input regularisation with the schedule, reaches 3.500, and residual dropout with the schedule 3.550. The regularisers and the weight-EMA blend on the default schedule sit between 3.520 (expert dropout) and 3.597 (the weight-EMA blend), and strong weight decay reaches 3.759.
Our margin over the strongest baseline, 3.386 against 3.424, is a single mean on a single setting; we have no measure of its spread from the evaluation.
How we got here
Our first plan was a different method. Reading the baselines, we saw that most of them cut the token plan to pay for their regularisers and apply them uniformly over training, and we set out to test read-adaptive regularisation instead: dropout, expert-output masking or token replacement ramped up with the number of times a sequence had already been read, so that the clean first reads are not wasted. To test ideas quickly we built two proxy models, at two scales, with the same ratio of unique tokens to parameters as the task, and a held-out loss on text the proxies never trained on. All figures below are our own development measurements on those proxies, or in full runs of the task's trainer on a corpus we built ourselves; they are relative comparisons and not the evaluation.
- Uniform regularisers did nothing. At the smaller proxy scale, under the default schedule, residual dropout, expert dropout, expert- and feed-forward-output masking, router jitter and gating dropout gave held-out losses from 5.178 to 5.216 against 5.196 for the default at the same plan. The baselines that add a view, a teacher or a weight average and shorten the plan were worse than the default at its full plan (chained distillation 5.607, masked-input regularisation 5.539, weight-EMA blending 5.534, against 5.211).
- The schedule was the first-order lever. The schedule-only baseline reached 4.988 against that 5.211, and its final anneal alone took 0.225 off the held-out loss over its last epoch, while the repetition-tuned baseline, whose warmup at that proxy size swallowed its decay phase, reached 5.433. A sweep of schedule shapes showed that the gain comes from the stable peak followed by a short anneal, not from ending at zero: a linear decay to zero gave 5.228 and a cosine to zero 5.181, against 4.934 for a stable peak with a 10% anneal (5% gave 4.970, 20% 4.955 and 40% 5.048). At the larger proxy scale the effect was magnified: the default schedule ended at a held-out loss of 5.006 with the training loss at 1.743, the schedule change at 4.288 with the training loss at 3.187. That pair of numbers is the memorisation picture behind our method.
- Averaging and the embedding decay added smaller, consistent gains. At the smaller scale a tail average blended half-and-half took the loss from 4.918 to 4.874, slightly better than replacing the weights with it (4.886). On top of that, an embedding decay improved held-out loss steadily with its strength up to a plateau (from 4.874 without it to 4.856 at the weakest setting tried and 4.806 to 4.811 near the optimum, rising again for stronger decay). At the larger scale removing the decay cost 4.257 against 4.136 and removing the average 4.173 against 4.136. We then fixed the embedding timescale at 0.75 epochs as a compromise between the plateau at the smaller scale and the optimum near 0.6 to 0.8 epochs at the larger one.
- Read-adaptive regularisation did not survive the new schedule. Ramped expert-activation dropout, feed-forward dropout and router jitter were no better than the schedule, average and embedding decay alone at the smaller scale (4.851, 4.835 and 4.810 against 4.808), and ramped token replacement was worse (4.843). At the larger scale, on the same base (4.136), expert-activation and feed-forward dropout and token replacement were worse (4.179, 4.161 and 4.170) and router jitter was level (4.134). That is why the forward pass stayed clean, and the method we had planned to propose was dropped.
- Many other mechanisms were neutral or worse on top of the schedule. Focal token reweighting, router z-loss, dropout switched off during the anneal, rescaling experts or the head at the end, embedding noise, uniform cycle soups (5.037 and 4.898 against 4.808), lookahead feedback (4.813 to 4.863), and self-distillation from an anneal snapshot (4.871 and 4.973 against a 4.820 control), where the student anchored to a weaker mid-run teacher.
- The peak learning rate does not transfer across scales. At the smaller proxy scale scaling the peak by 1.3 or 1.6 helped (4.918 and 4.922 against 4.934), and our first version used 1.3; at the larger scale 1.0 was best (4.160 against 4.214 at 1.3 and 4.364 at 2.0). A second version reduced the scale with the number of steps per epoch; in full runs of the task's trainer a flat 1.0 was better (4.596 against 4.610), and we kept the default peak.
- The anneal length was set in epochs and lengthened in steps. The best anneal was about 0.8 epochs at the smaller proxy scale and 1.6 at the larger, so we first expressed it as 1.25 epochs. In full trainer runs the components each earned their place: removing the embedding decay cost 4.651 and removing the average 4.637 against 4.610, and shortening the anneal to 0.8 epochs 4.640, while 1.6 epochs gave 4.591. A further lengthening to 2.0 epochs gave 4.582 (2.4 epochs, 4.581, was a plateau) and also improved a second, larger model size from 3.917 to 3.909, so the final recipe anneals over two epochs.
- Later attempts lost to the recipe they were tested on. Against the 1.6-epoch version (4.589) in the trainer, a second Adam moment coefficient of 0.98 gave 4.706 and a decay on the output head 11.76; a 4% warmup looked marginally better once (4.583) and did not replicate on a second seed. Against the final recipe (4.585): freezing parameter groups during the anneal (4.588 to 4.791; freezing the embedding and head was the worst), a multi-token auxiliary loss (4.660 to 4.831) and an embedding-prediction auxiliary (4.601), batch ramps up or down (4.633 and 4.680) and adaptive gradient clipping (4.599). Changes to the embedding's learning rate in either direction each appeared to gain about 0.005, which we took as our noise floor rather than a result.
In the trainer, on three model sizes, our final recipe beat the schedule-only default each time (4.585 against 4.732, 3.909 against 4.003, and 3.507 against 3.578), and on the proxies it stayed ahead of the default recipe when the pool was repeated more or fewer times at fixed compute (5.261 against 6.769 and 4.712 against 4.801). We also confirmed that the recipe adds no trainable parameters and that its counted training compute equals the default recipe's.
Limitations
- One setting. The evaluation reports a single setting, so the claim that our constants transfer across model sizes rests on our own development runs, not on the published results.
- The margin over the strongest baseline is modest and unmeasured in spread. We are ahead of Rep-tuned [4] by the difference between 3.424 and 3.386, without a measure of seed variation from the evaluation. Our own noise floor in development was about 0.005.
- The components are known; the contribution is their calibration. A warmup-stable-decay schedule, a tail weight average and a decoupled decay are each standard. What we add is the claim that, on repeated data, the schedule should carry the regularisation, and a parameterisation of the anneal, the averaging horizon and the embedding decay in epochs of the unique pool. The specific values (a two-epoch anneal, a one-epoch averaging horizon, an even blend, a 0.75-epoch embedding timescale, a 2% warmup) were tuned on our proxies and in our trainer runs, and the anneal length was adopted from trainer runs that the larger proxy did not confirm (4.146 against 4.141 for the previous version).
- The embedding argument is an assumption. That decaying the embedding does not shrink the function holds exactly only if its scale reaches the rest of the network solely through a normalisation. We did not verify this in the decoder; we only measured that the decay helps.
- We used little of the editable surface. The recipe leaves the loss, the training hooks, the batch plan and the allocation of reads across the pool's sources as in the starter. Our evidence is that, on top of the schedule, every in-network regulariser we tried was neutral or harmful, but a regulariser designed for this schedule, rather than tested on it, remains open.
References
- William Fedus, Barret Zoph, Noam Shazeer (2021). Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity. JMLR.
- Rui Liu, Young Jin Kim, Alexandre Muzio et al. (2022). Gating Dropout: Communication-efficient Regularization for Sparsely Activated Transformers. ICML.
- Konwoo Kim, Suhas Kotha, Percy Liang et al. (2026). Pre-training under infinite compute. ICLR.
- Sewon Min (2026). Scaling Repeated-Data Pretraining: Batch Size, Regularization, and GPU-Time Tradeoffs.
- Justin Lovelace, Christian Belardi, Srivatsa Kundurthy et al. (2026). Prescriptive Scaling Laws for Data Constrained Training. COLM.
- Shengding Hu, Yuge Tu, Xu Han et al. (2024). MiniCPM: Unveiling the Potential of Small Language Models with Scalable Training Strategies.
- Alexander Hägele, Elie Bakouch, Atli Kosson et al. (2024). Scaling Laws and Compute-Optimal Training Beyond Fixed Training Durations. NeurIPS.