TLDR: I pretrained several small language models, ranging from roughly 7.5M to 40M parameters, on TinyStories to explore how validation loss changes with model size, tokens processed, and training compute. These experiments provide a starting point for comparing my results with Scaling Laws for Neural Language Models, and for investigating how to allocate a limited training budget.

TinyStories is a dataset of short stories generated using GPT-3.5 and GPT-4, designed to support research into small language models.

The experiments with repeated transformer layers are covered separately in Looped Transformers are NOT all you need.

Pretraining recipe

I pre-trained each of the models on the same TinyStories dataset. Each training batch contains windows of tokens, giving tokens per batch. Whether this is close to the critical batch size, , remains a question for further experiments.

I did not run a separate hyperparameter search for each model size, so these experiments do not establish the optimal combination of residual-stream dimension, attention heads, or layers. Kaplan et al. found that model shape had a relatively small effect across the range they tested, but that does not establish that these choices are unimportant for this setup.

For all models, I used an AdamW gradient optimizer with a cosine-decay learning rate scheduler.

Pre-training results

Pasted image 20261126190908.png

Figure 1.0 : Validation loss v.s. tokens processed during pre-training.

We find that the general structure follows the intuitive parametrization developed in (Scaling Laws for Neural Language Models). The relationship between validation loss and tokens processed can be expressed as a power law. Larger models are more sample efficient than smaller ones, enabling them to extrapolate the general properties of the dataset better despite processing the same number of tokens.

Pasted image 20261126190918.png

Figure 1.1 : Validation loss v.s. pre-training compute

This graph presents much more interesting results. Up to a certain intersection point, smaller models tend to perform better than larger model at fixed compute. Given a non-embedding parameter size , the number of pre-training tokens processed , we can estimate compute through the following approximation.
We can also express compute in terms of batch size and optimizer steps. With a constant token batch size and optimizer steps, the number of tokens processed is , so . Here, counts tokens processed, including repeated passes over the dataset, rather than only unique tokens.

Smaller models perform better than larger models up to a certain point of compute because at constant compute, optimizer steps must decrease proportionately to compensate for increased model parameter sizes. In other words, if we hold constant whilst increasing parameter size, must proportionately decrease, which implies the must proportionately decrease assuming the batch size is kept constant. This means at certain compute bounds, smaller models are able to process more tokens, enabling them to yield lower validation losses than larger models. This trend continues until a specified value of compute, after which the sample efficiency of larger models (as observed in Figure 1.0) enables them to surpass the performance of the smaller models despite being processing less tokens.

This leads to interesting findings for designing optimal compute-bound models. Below certain levels of compute, it is more worthwhile to train smaller models on more tokens than it is to forcibly train larger models on disproportionately less tokens.