En 30 secondes
A small change in validation loss may be noise rather than progress: in Suhas Kotha’s language-model experiments, runs varied by about 0.003 simply from changing random seeds. Training loss was much noisier, with jitter falling roughly as the square root of batch size. The Stanford researcher also found that longer learning-rate warmup supported larger rates and that a meaningful cooldown improved final loss, but cautions that their best durations depend on the training setup. Scaling laws predicted one method’s eventual lead, though a good fit alone cannot guarantee reliable extrapolation.
- 1Changing either seed produced nearly the full run-to-run variationVarying initialization alone or the data order alone each produced nearly as much validation-loss variation as changing both. The measured standard deviation was approximately 0.003.
- 2A 0.003 loss difference can be noise in this setupKotha contrasts differences around the observed standard deviation with an improvement around 0.02, which he considers more likely to be real.
- 3Four times the batch size roughly halves training-loss jitterThe measured jitter followed one over the square root of batch size, and changed little with learning rate. Kotha attributes most of it to variation between sampled batches.
- 4The cooldown needed about 20% of training to approach the best lossFor this warmup-stable-decay experiment, a 20% decay phase came within 0.02 loss of the best schedule. The instructors caution that the fraction varies by setting.
- 5Longer warmup made higher learning rates viableThe best rate shifted from roughly 0.001–0.002 with almost no warmup to about 0.005 with 30% warmup. The optimal fraction was much larger than the code’s 1% default in this run.
- 6Both falling learning rates and weight decay were needed to shrink the parameter normEither change slowed growth, but only their combination made the norm decline in the experiment.
- 7Small-model scaling fits predicted a reversal in the dropout rankingFits made using depths 4–9 suggested dropout would overtake the alternatives at larger sizes. Kotha warns that a good fit to observed points does not ensure future accuracy.
À retenir
- Compare improvements with measured run-to-run variation before declaring a winner; about 0.003 was the standard deviation in this setup.
- Use validation loss for a cleaner comparison, since individual training batches produce much more jitter.
- Expect training-loss jitter to fall approximately as one over the square root of batch size in these experiments.
- Tune warmup, peak learning rate and cooldown together rather than treating their fractions as universal constants.
- Test scaling-law predictions at larger sizes when possible; a close fit to the available points can still extrapolate badly.
Lire le texte remanié, chapitre par chapitre
Treat papers as hypotheses for your own setup
The instructors compare quiz answers with experiments and published work. They distinguish observations from the tentative mental models used to explain them.
We will show the experimental answer to each question, along with plots and papers that may suggest experiments for your assignments. A paper can be accurate in its own setting without describing yours, so treat it as a source of hypotheses to test.
The mental-model updates are not the experiments themselves. They are our interpretations, offered to show how observations can change your expectations. Bring your own results, including cases that disagree with ours.
Seed variation sets a noise floor for comparisons
Changing either initialization or data order produces nearly as much variation as changing both. In this experiment the validation-loss standard deviation is approximately 0.003.
Our first question asked about run-to-run variation when both random seeds change. Across repeated runs, the standard deviation of validation loss was approximately 0.003.
We also changed only the initialization seed, changed only the data seed, and checked that deterministic code reproduced the same result. Surprisingly, each individual source of randomness produced almost as much variation as changing both.
Earlier work found a similar qualitative effect, although the relative magnitudes in our setting were closer together. This is an example where the shape of a published result can carry over while its exact numbers do not.
A student asks why the two sources do not combine as independent variances might suggest. That expectation is reasonable, but empirically a single source can reproduce most of the variation in deep learning; Kotha says there is no good explanation here.
Training loss jitters more than validation loss
The training batches vary from step to step, while validation loss is much smoother. This affects how confidently small differences can be interpreted.
For training loss, the jitter was close to 0.04 across the four settings. Validation loss is evaluated less frequently, but its fluctuations are much smaller, making it a cleaner way to compare runs.
Changing the learning-rate schedule had little effect on the shape of training-loss jitter. Changing data order changed the curve somewhat, though jitter generally increased during training in these experiments.
The observed 0.003 run-to-run deviation provides a benchmark for interpreting results: a loss difference of that size is not a convincing win by itself, while a difference around 0.02 is more likely to be real. Even one small perturbation can change the training trajectory.
Batch size predicts the amount of jitter
Observed training-loss jitter scales approximately as the inverse square root of batch size and is nearly unchanged by learning-rate changes.
Larger batches showed less training-loss jitter. A curve proportional to one over the square root of batch size fit the measurements well: making the batch four times larger roughly halves the jitter.
In contrast, changing the learning rate barely changed the amount of jitter. A useful model is that different sampled examples dominate the fluctuations: the variance of a batch mean falls with batch size, so its standard deviation falls with the square root.
A student asks whether the latest optimizer step affects the comparison. Near the end of training, loss changes slowly enough that fluctuations within the measurement window appear more important than the underlying improvement.
Skipping warmup changes activation behavior
Without warmup, loss is worse in this experiment and activation norms spike early. Kotha does not claim a complete mechanism for the spike.
Skipping warmup increased loss by an average of about 0.106 across five seeds. Looking at parameter, gradient and activation norms, the clearest change was an early spike in activation norm; Kotha says he does not have a complete explanation.
For the batch-size question, the same reasoning starts with the variance of the mean: with B independent samples it scales as one over B, and its standard deviation as one over the square root of B. The approximation is useful when variation between samples dominates variation from the model.
Cooldown needs time, but its best length varies
About 20% decay gets this setup close to the best result. The instructors caution that other models and datasets need not share that fraction.
For the warmup-stable-decay schedule, about 20% of the training run had to be spent reducing the learning rate to finish within 0.02 loss of the best schedule. The tested schedules ranged from no decay to decay across almost the whole run.
Loss stays relatively high during the stable phase and falls once the learning rate begins to decay. One intuition is that high rates bounce around a valley while smaller rates let training settle closer to its floor; the course will test such intuitions later.
There is a possible confounder: the optimal peak learning rate might differ for each schedule. The comparison holds a rate fixed rather than exhaustively tuning it separately for every decay schedule.
Some cooldown is needed to capture the benefit, but 20% is not a general constant. The instructors say their small system seems unusually sensitive to warmup and long decay; other training reports use different schedules, and the best choice depends on the setting.
Warmup and the peak learning rate interact
Longer warmup permits a higher learning rate and the best fraction here exceeds the default. A longer training horizon suggests considering a fixed number of warmup steps instead.
For the next question, Kotha sweeps warmup fractions and learning rates more densely than students were expected to run. One combination with 5% warmup beat the baseline, while other higher-rate combinations landed in a worse loss range.
Longer warmup raises the learning rate the model can tolerate. With essentially no warmup, the best rate was around 0.001 to 0.002; with 30% warmup it was closer to 0.005.
In this setup the best warmup fraction was around 20–30%, much higher than the code’s 1% default. Similar fractions worked for the smaller and larger models tested at the same training horizon.
At a longer token horizon, the optimal warmup fraction became shorter. That suggests thinking of warmup as a roughly fixed number of steps rather than always as a fixed percentage, though this remains a hypothesis for these experiments.
A student asks why a fully decaying schedule need not be best. The instructor says that tuned warmup-stable-decay can sometimes do better; linear decay is also used as a compromise because it avoids tuning one additional schedule parameter.
To investigate whether warmup is tied to the optimizer’s momentum buffers, Kotha suggests changing AdamW momentum parameters and checking whether the best warmup moves. Another paper attributes warmup’s usefulness partly to greater tolerance for higher learning rates.
Why weights grow and how decay pulls them back
Parameter norms grow more slowly with a falling learning rate or weight decay. Combining both reverses growth in the experiment, while gradient norms do not double.
The parameter norm finished 3–15% below its peak only with both linear learning-rate decay and weight decay of 0.1. In the other tested configurations, the peak occurred at or near the end.
A lower learning rate slows parameter growth, as does weight decay. In this setup either factor alone slowed the increase, but the combination eventually made the norm decrease.
None of the gradient norms doubled during training; they started high in these runs. Kotha contrasts this with a published large-scale result where gradient norms increased, perhaps because the initialization or training duration differed.
Many gradient updates in this layer-normalized model are approximately orthogonal to the current weights. Without weight decay, those updates can make the parameter norm drift upward; a smaller learning rate slows the drift.
A student notes that AdamW attaches the learning rate to weight decay too. The instructor agrees about the normalization but distinguishes that regularization effect from the way the learning rate changes the upward drift in the first place.
What small models can and cannot predict
Scaling fits recover the relative ranking of several methods, including dropout’s eventual improvement. Further measurements are still needed to judge extrapolation.
The scaling-law exercise compared constant learning rate, dropout and learning-rate choices. Fits used models from depth 4 through depth 9, then predicted outcomes for larger depths up to 16.
Some extrapolations tracked the later runs well and others did not. Kotha is impressed that the fits recovered the overall ranking: dropout was worse at small parameter counts but improved fast enough to become better at larger sizes.
Refitting on every available point makes the curves look excellent, but that does not prove another extrapolation will work. Judging how far a scaling law can be trusted requires empirical skill and, where possible, held-out larger runs.
Another comparison shows that eight training epochs or omitting query-key normalization can change the benefit of increasing depth. In these settings the depth-9 model can perform worse than depth 4; Kotha says more measurements will add context.
Query-key normalization helps stability at high learning rates and in high-variance regimes. Kotha predicts that retuning the rate could improve the deeper model without it, but identifies that as a prediction rather than a tested result.
A single token can perturb the training trajectory
One changed token produces a sizable share of ordinary run-to-run variation. The next assignment tests these intuitions with simpler models.
Changing one token early in training produced an average peak training-loss gap of about 0.09 across five seeds. The gap was largest early and much smaller by the end, consistent with the perturbation being felt most strongly near the start.
The final loss varied substantially even from that single token change: at a learning rate of 0.003 it captured roughly half the standard deviation seen when changing broader sources of randomness. Prior work found a one-bit parameter change could capture nearly all variation, though this experiment found less.
The next assignment will examine relationships among hyperparameters and test the noisy quadratic model and the μP framework. Students will compare whether these simplified mental models help in the regimes they actually train.
Sur la même chaîne
1:21:11EN
1:14:57EN
1:17:43EN
1:08:38EN
1:24:37EN
56:46EN