Language models scale reliably with over-training and on downstream tasks

Samir Yitzhak Gadre, Georgios Smyrnis, Vaishaal Shankar, Suchin Gururangan, Mitchell Wortsman, Rulin Shao, Jean Mercat, Alex Fang, Jeffrey Li, Sedrick Keh, Rui Xin, Marianna Nezhurina, Igor Vasiljevic, Jenia Jitsev, Luca Soldaini, Alexandros G. Dimakis, Gabriel Ilharco, Pang Wei Koh, Shuran Song, Thomas Kollar, Yair Carmon, Achal Dave, Reinhard Heckel, Niklas Muennighoff, Ludwig Schmidt

Introduction

Training large language models is expensive. Moreover, training high-quality models requires a complex recipe of algorithmic techniques and training data. To reduce the cost of finding successful training recipes, researchers first evaluate ideas with small experiments and then extrapolate their efficacy to larger scales. With reliable extrapolation, it is possible to quickly iterate at small scale and still pick the method that will perform best for the final large training run. Indeed, this workflow has become commonplace for training state-of-the-art language models such as Chinchilla 70B , PaLM 540B , and GPT-4 .

Despite their importance for model development, published scaling laws differ from the goals of training state-of-the-art models in important ways. For instance, scaling studies usually focus on the compute-optimal training regime (“Chinchilla optimality” ), while widely used models are now often over-trained to reduce inference costs. Another potential mismatch between scaling laws and eventual applications of the models is that most scaling laws quantify model performance by perplexity in next-token prediction instead of accuracy on widely used benchmark datasets. As a result, it is unclear whether following scaling laws leads to truly better models, or merely to models with lower perplexity in the compute-optimal training regime.

In this paper, we address both topics: scaling in the over-trained regime and downstream performance prediction, with an extensive set of experiments.

Motivated by the practice of training beyond compute-optimal, we first investigate whether scaling follows reliable trends in the over-trained regime. We find that for a set of model configurations with a constant ratio of training tokens to parameters, the models’ reducible loss L′L^{\prime} follows consistent power laws (L′=λ⋅C−αCL^{\prime}=\lambda\cdot C^{-\alpha_{C}}) in the amount of training compute CC. As one increases the ratio of tokens to parameters, corresponding to more over-training, the scaling exponent αC\alpha_{C} remains about the same, while the scalar λ\lambda changes. We consider the extent to which our observations are explainable and find a promising approach by reparameterizing forms for scaling laws.

To establish if and when scaling is predictable in the over-trained regime, we experiment with a testbed of 104 models, trained from scratch on three different datasets: RedPajama , C4 , and RefinedWeb . We find that scaling laws fit on small models, trained closer to compute-optimal, can accurately predict the performance of larger models that undergo more over-training. Figure 1 (left) illustrates our main over-training result, where we invest 2.4e192.4e19 FLOPs to extrapolate the C4 validation performance of a 1.4B parameter model trained on 900B tokens, which requires 300×300\times more compute to train.

In addition to over-training, we also investigate if scaling laws can predict the performance of a model on downstream tasks. We establish a power law relationship between language modeling perplexity and the average top-1 error on a suite of downstream tasks. While it can be difficult to predict the error on individual tasks, we find that aggregate performance can be accurately predicted from a model’s perplexity among models trained on the same training data. Figure 1 (right) presents our main downstream error prediction result, where we invest 2.7e202.7e20 FLOPs to predict the average top-1 error over a set of downstream tasks to within 1 percentage point for a 6.9B compute-optimal model, which requires 20×20\times more compute to train.

To facilitate further research on reliable scaling, we provide all results of our experiments at https://github.com/mlfoundations/scaling.

Scaling and over-training

In this section, we describe empirical observations and their potential mathematical descriptions. First, we provide key definitions (Section 2.1). We next present a phenomenon wherein training a collection of models for increasing token multipliers—ratios of tokens to parameters—follows similar scaling trends (Section 2.2). We then show that these patterns are consistent with previously proposed power-law scaling when reparameterizing in terms of training compute and token multipliers (Section 2.3). Towards connecting loss scaling and downstream performance, we revisit our collection of models, plot their average top-1 error vs. validation loss, and notice that error decays exponentially with lower loss (Section 2.4). To describe these observations, we propose a scaling law for downstream error as a function of loss (Section 2.5).

We examine scaling laws that predict the loss LL of a model as a function of the compute CC in FLOPs used to train the model. If one increases the number of parameters NN in a model or the number of tokens DD that a model is trained on, compute requirements naturally increase. Hence, CC is assumed to be a function of N,DN,D. Following Kaplan et al. , we use the approximation C=6NDC=6ND, which Hoffmann et al. independently verify. We consider scaling laws,

where EE is an irreducible loss and L′L^{\prime} is the reducible loss. EE captures the Bayes error or minimum possible loss achievable on the validation domain. The L′(C)L^{\prime}(C) term captures what can possibly be learned about the validation domain by training on a source domain. L′(C)L^{\prime}(C) should go to zero with increased training data and model capacity. L′(C)L^{\prime}(C) is often assumed to follow a power law: L′(C)=λ⋅C−αCL^{\prime}(C)=\lambda\cdot C^{-\alpha_{C}} (i.a., Hestness et al. , OpenAI ). It is also often helpful to consider a power law in a log⁡\log-log⁡\log plot, where it appears as a line with slope −αC-\alpha_{C} and yy-intercept log⁡(λ)\log{(\lambda)}.

Token multipliers.

We define a token multiplier M=D/NM=D/N as the ratio of training tokens to model parameters. We introduce MM for notational convenience as it allows us to consider fixed relationships between DD and NN even as a model gets bigger (i.e., as NN becomes larger).

Compute-optimal training.

Hoffmann et al. establish compute-optimal training, where, for any compute budget HH, the allocation of parameters and tokens that minimize training or validation loss is given by,

To solve for the optimal N∗,D∗N^{*},D^{*}, one can sweep N,DN,D for each HH, retaining the best configurations. Hoffmann et al. find that as HH increases, N∗N^{*} and D∗D^{*} scale roughly evenly. Assuming equal scaling, there is a fixed compute-optimal token multiplier M∗=D∗/N∗M^{*}=D^{*}/N^{*} per training distribution.

Over-training.

We define over-training as the practice of allocating compute sub-optimally, so smaller models train on a disproportionately large number of tokens (i.e., M>M∗M>M^{*}). While loss should be higher than in the compute-optimal allocation for a given training budget, the resulting models have fewer parameters and thus are cheaper at inference.

2 Observation: Over-trained models follow consistent trends

We begin our scaling investigation by training models with 0.011B to 0.411B parameters for token multipliers MM between 20 and 640, where M=20M=20 points lie roughly on the compute-optimal frontier, and M>20M>20 corresponds to over-training. We defer experimental details to Section 3 to focus on our observations. In Figure 2, we plot loss against compute on a log⁡\log-log⁡\log scale for the models trained on three datasets and evaluated on the C4 eval set. We notice a phenomenon of “parallel lines” when fitting power laws to the reducible loss, which suggests a near-constant scaling exponent even with increased over-training. This indicates that scaling in the over-trained regime may be predictable given training runs closer to compute-optimal.

3 Deriving scaling laws for over-trained behavior

In search of an analytic expression for the observations in Figure 2, we turn to the scaling literature. A common functional form for the risk of a model, as proposed in prior work is,

Recall from Section 2.1, NN is the number of parameters, DD the number of training tokens and EE the irreducible loss. The constants E,A,α,B,βE,A,\alpha,B,\beta are fit from data. By fitting this parametric form, Hoffmann et al. find that scaling exponents α\alpha and β\beta are close, suggesting that one should scale N,DN,D equally as compute increases. Hence, we assume α=β\alpha=\beta. With this assumption, we reparameterize Equation (3) in terms of compute C=6NDC=6ND and a token multiplier M=D/NM=D/N. We get the following form,

where αC=α/2\alpha_{C}=\alpha/2, a=A(1/6)−αCa=A(1/6)^{-\alpha_{C}}, b=B(1/6)−αCb=B(1/6)^{-\alpha_{C}} gives the relation to Equation (3). For a complete derivation, see Appendix B.

Equation (4) has the following interpretation: (i) The scaling exponent αC\alpha_{C} is not dependent on MM. Thus, we always expect lines with the same slope in the log⁡\log-log⁡\log plot—as in Figure 2. (ii) The term aMαC+bM−αCaM^{\alpha_{C}}+bM^{-\alpha_{C}} determines the offsets between curves with different token multipliers. Hence, we expect non-overlapping, parallel lines in the log⁡\log-log⁡\log plot for the range of MM we consider—also consistent with Figure 2.

Recall that we make the assumption α=β\alpha=\beta, which implies equal scaling of parameters and tokens as more compute is available. However, as explained in Appendix B, even if α≠β\alpha\neq\beta, we get a parameterization that implies the power-law exponent remains constant with over-training.

4 Observation: Loss tracks average top-1 error

Scaling is typically studied in the context of loss , which Schaeffer et al. note is smoother than metrics like accuracy. However, practitioners ultimately care about downstream, in-the-wild task performance. To better connect scaling laws and over-training to task prediction, we revisit the suite of models plotted in Figure 2. In Figure 3, we plot average downstream top-1 errors over evaluations sourced from LLM-Foundry against the C4 eval loss. We defer details of the setup to Section 3 to focus here on a few key observations. The average errors appear to follow exponential decay as loss decreases. Additionally, the particular relationship between loss and error is dataset-dependent. For instance, models trained on C4 result in the lowest C4 eval loss, but this does not translate to downstream gains compared to models trained on RedPajama or RefinedWeb.

5 Proposing a scaling law for average top-1 error

Based on the exponential decay we observe in Figure 3, we propose the following relationship between downstream average top-1 error Err and loss LL,

where ϵ,k,γ\epsilon,k,\gamma are fit from data. Equation (5) also has an appealing interpretation in terms of model perplexity PP(L)=exp⁡(L)PP(L)=\exp{(L}),

Namely, Err follows a power law in PPPP with maximum error ϵ\epsilon, where intuitively ϵ\epsilon should be close to the random chance performance.

Equation (5) in conjunction with (4) suggests a two-step method to predict Err as a function of compute and the amount of over-training. For choices of training and validation distributions, (i) fit a scaling law to Equation (4) using ((C,M),L)((C,M),L) pairs to yield (C,M)↦L(C,M)\mapsto L. (ii) Fit a scaling law to Equation (5) using (L,Err)(L,\textsf{Err}) pairs to get L↦ErrL\mapsto\textsf{Err}.

Experimental setup

Towards testing the analytic predictions in Equations (4), (5), we discuss our experimental setup. We first present language modeling details (Section 3.1). Next, we discuss our strategy for deciding which models to include in our scaling investigation and our procedure for fitting scaling trends (Section 3.2). We then present metrics to validate how well scaling laws predict loss and downstream performance (Section 3.3).

We train transformers , based on auto-regressive, decoder-only, pre-normalization architectures like GPT-2 and LLaMA . We adopt OpenLM as our core modeling library, which utilizes PyTorch , xformers , triton , FlashAttention , FSDP , and bfloat16 automatic mixed precision. Like LLaMA, we omit bias terms, but replace RMSNorm with LayerNorm , which has readily available fused implementations. Following Wortsman et al. , we apply qk-LayerNorm , which adds robustness to otherwise poor hyperparameter choices (e.g., for learning rate). We use SwiGLU activations and depth-scaled initialization . We use a sequence length of 2048, rotary positional embeddings , and the GPT-NeoX-20B tokenizer , which yields a vocabulary size of 50k. We do not use weight tying .

Objectives and optimization.

We train with a standard causal language modeling objective (i.e., next token prediction) with an additive z-loss (coefficient 1ee-4), which mitigates output logit norm growth instabilities. We use the AdamW optimizer (PyTorch defaults except beta2 = 0.95), with independent weight decay (coefficient 1ee-4). For the learning rate schedule, we use linear warmup and cosine decay. We cool down to a low learning rate (3ee-5).

Training datasets.

To ensure our conclusions are not particular to a training distribution, we train models on C4 , RedPajama , and RefinedWeb . They are open-source and have 138B, 1.15T, and 600B tokens respectively. We sample without replacement and employ sequence packing without attention masking. We separate documents in our training corpora with end-of-text tokens.

2 Creating scaling laws for validation loss and downstream error prediction

To create a testbed of models for our scaling experiments, we grid search over a total of 435 models, trained from scratch, in the 0.01B to 0.5B parameter range as seen in Figure 4 (left). We train on the OpenLM data mix , which largely consists of tokens from RedPajama and The Pile . We train on 20 tokens per parameter (M=20M=20), which we find in early experiments gives models near the compute-optimal frontier for the data mix. This is similar to findings presented in Hoffmann et al. ’s Table 3, which suggests that roughly 20 tokens per parameter are optimal in their experimental setup. Our validation set, OpenLM eval, contains tokens from recent arXiv papers, the OpenLM codebase itself, and news articles. To find maximally performant models on validation data, we tune model width, number of layers, number of attention heads, warmup steps, and batch size. We find in early experiments that qk-LayerNorm makes models less sensitive to learning rate, which is a phenomenon Wortsman et al. report in their Figure 1. Hence, we fix the learning rate for our sweeps. We also perform smaller grid searches over 1.4B and 6.9B parameter model configurations at M=20M=20, retaining the best configurations.

In Figure 4 (center), we plot the efficient frontier of minimum loss configurations. While there appears to be a general trend, configurations between 5.2×10165.2\times 10^{16} and 5.2×10175.2\times 10^{17} FLOPs lie below the frontier established by other models. We hypothesize these models over-perform as they are trained for more optimization steps than their neighbors based on our power-of-two batch sizes. We provide support for this hypothesis in Appendix E, but opt to remove these models from our investigation.

In Figure 4 (right), we fit trends to the remaining models and to a subset of four models. We notice that the trends hit both the 1.4B and 6.9B models suggesting that our small-scale configurations are reasonable for extrapolation to larger parameter and compute regimes. We retain the four model configuration subsets as a representative sample.

We do not tune hyperparameters for other token multipliers (i.e., M≠20M\neq 20), other training or evaluation distributions, or on downstream task validation sets. For more details, see Appendix C. We present our final hyperparameters in Table 1 given their importance.

Fitting scaling laws.

We fit Equation (4) to approximate E,a,b,αCE,a,b,\alpha_{C} using curve-fitting in SciPy (i.e., Levenberg-Marquardt to minimize non-linear least squares). We try several initializations and retain the best fit. We repeat this process to fit Equation (5) to approximate ϵ,k,γ\epsilon,k,\gamma. Unless otherwise specified, we fit to the N,MN,M pairs in Table 2. In total, we invest ∼\sim100 A100 hours to train the models required for fitting an accurate scaling law for loss prediction and ∼\sim1000 A100 hours for a corresponding scaling law for downstream error prediction. Our configurations allow us to test for extrapolation to the N=1.4B,M=640N=1.4\text{B},M=640 (900B token) and the N=6.9B,M=20N=6.9\text{B},M=20 (138B token) regimes.

3 Evaluation setup

Unless otherwise stated, C4 eval is our default validation loss dataset. For downstream tasks, we adopt 46 tasks from LLM-foundry , which includes standard tasks with both zero-shot and few-shot evaluations. We also consider a 17-task subset where, for each evaluation, at least one 0.154B scale model—trained with as many as 99B tokens—gets 10 percentage points above chance accuracy: ARC-Easy , BIG-bench: CS algorithms , BIG-bench: Dyck languages , BIG-bench: Novel Concepts , BIG-bench: Operators , BIG-bench: QA WikiData , BoolQ , Commonsense QA , COPA , CoQA , HellaSwag (zero-shot) , HellaSwag (10-shot) , LAMBADA , PIQA , PubMed QA Labeled , SQuAD , and WinoGrand . This subset allows us to investigate a regime where performance for small models can be non-trivial. For more details on evaluation datasets see Appendix D. For ablations on our choices of loss and downstream evaluations see Appendix E.

Metrics.

We consider three main metrics: (i) Validation loss, which is the cross entropy between a model’s output and the one-hot ground truth, averaged over all tokens in a sequence and over all sequences in a dataset. (ii) Average top-1 error, which is a uniform average over 46 downstream evaluations sourced from LLM-foundry . We also look at the mean top-1 error for the subset of 17 evaluations identified in the paragraph above. For a complete list of downstream evaluation datasets, see Appendix D. To measure how good a prediction ζ(C,M)\zeta(C,M) is, we measure (iii) Relative prediction error: ∣ζ(C,M)−ζGT∣/ζGT|\zeta(C,M)-\zeta_{GT}|/\zeta_{GT}, where ζ\zeta is the loss LL or the average top-1 error Err.

Testbed.

We train models on C4, RedPajama, and RefinedWeb with the number of parameters N∈{0.011B,0.079B,0.154B,0.411B}N\in\{0.011\text{B},0.079\text{B},0.154\text{B},0.411\text{B}\} and token multipliers M∈{5,10,20,40,80,160,320,640}M\in\{5,10,20,40,80,160,320,640\}. We omit runs that require more tokens than are present in a dataset (i.e., N=0.411B,M=640N=0.411\text{B},M=640 for C4). We additionally train N=1.4N=1.4B models at M=20M=20 and at the largest token multiplier possible without repeating tokens (i.e., 80 for C4, 640 for RedPajama, and 320 for RefinedWeb). We train N=6.9B,M=20N=6.9\text{B},M=20 for each dataset. In total this results in 104 models. We evaluate each model on C4 eval for validation loss and on the 46 downstream tasks for top-1 error.

Results

Unless otherwise stated, we fit Equations (4), (5) to the configurations in Table 2 and use C4 eval for loss computation.

We highlight our main over-training results in Figure 1 (left). Namely, we are able to extrapolate both in the number of parameters NN and the token multiplier MM to closely predict the C4 eval performance of a 1.4B parameter model trained on 900B RedPajama tokens (N=1.4B,M=640N=1.4\text{B},M=640). Our prediction, which takes 300×\times less compute to construct than the final 1.4B run, is accurate to within 0.7% relative error. Additionally, for the N=6.9B,M=20N=6.9\text{B},M=20 run, near compute-optimal, the relative error is also 0.7%.

These results support several key takeaways. (i) scaling can be predictable even when one increases the model size and the amount of over-training compared to the training runs used to fit a scaling law. (ii) Scaling can be predictable even in the presence of a distribution shift (e.g., RedPajama training and C4 evaluation). (iii) The form presented in Equation (4) is useful in practice for fitting and predicting over-trained scaling behavior. (iv) Fitting to Equation (4) does not sacrifice prediction accuracy near compute-optimal.

While Figure 1 explores a specific case of making predictions in the over-trained regime, we would like to understand the error profile of our predictions across datasets, token multipliers, and number of parameters. Hence, in Figure 5 we show relative error between ground truth loss and predicted loss on C4 eval for models in our testbed. We notice uniformly low prediction error suggesting that predictions are accurate in many settings.

Average top-1 error is predictable.

Figure 1 (right) presents our results in estimating scaling laws for downstream error. Similar to Figure 1 (left), we are able to extrapolate in N,MN,M and predict the average downstream error across our evaluation suite. Concretely, we use the models indicated in Table 2 to fit Equation (5), and predict the average top-1 error over the 17 tasks identified in Section 3.3. Our fit allows us to predict the downstream performance of a 6.9B parameter model trained on 138B tokens to within 0.05%0.05\% relative error and of a 1.4B model trained on 900B tokens to within 3.6%3.6\% relative error, using 20×20\times less compute.

Table 3 additionally shows the relative error of our downstream performance predictions for models trained on C4, RedPajama, and RefinedWeb, indicating that our scaling law fits are applicable to other datasets. We note that while average accuracy across benchmarks is predictable, predicting accuracy on individual downstream tasks is significantly more noisy. We report relative error of all our predictions in Figures 11, 12 in the Appendix. We also find that if we remove the 1.4B model for the Equation (5) fit, relative error jumps, for instance, from 0.05% to 10.64% on the 17-task split for the 6.9B, 138B token RedPajama prediction.

Small-scale experiments can predict model rank order.

We expect to be able to rank models based on their predicted performance, which is useful when deciding what to train. To verify, we rank 9 testbed models with N≥1.4BN\geq 1.4\text{B} by ground-truth top-1 error and by estimated top-1 error. We find high rank correlations: 0.93 and 0.88 for the 46 and 17-task splits respectively.

Under-training, out-of-distribution scaling, and compute-reliability trade-offs.

In addition to our main results presented above, we include additional results in Appendix E, which we summarize here. First, we notice that when token multipliers become too small (i.e., M=5M=5) scaling becomes unreliable and lies off the trend. Additionally, several multipliers (10, 20, 40, and 80) garner points that are roughly on the compute optimal frontier (Figure 9). To probe the limits of reliable scaling, we attempt to break our scaling laws in out-of-distribution settings. We find that models trained on C4—English filtered—and evaluated on next token prediction on code domains have a high relative error in many cases. Perhaps surprisingly, evaluating the same models on German next token prediction again gives reliable loss scaling (Figure 10). We additionally examine the compute necessary to create accurate scaling laws, finding a positive correlation between investing more compute in a scaling law and its predictivity. We find that scaling laws can be constructed more cheaply for loss prediction than for downstream error prediction (Figures 15, 16).

Related work

We review the most closely related work in this section. For additional related work, see Appendix F.

Early works on scaling artificial neural networks observe predictable power-law scaling in the training set size and number of model parameters . Alabdulmohsin et al. center the importance of looking at the extrapolation regime of a scaling law. Yang et al. prescribe architectural and hyperparameter changes when scaling model width to realize performant models; Yang et al. make analogous recommendations when scaling model depth. Unlike the aforementioned work, our investigation focuses on the link between over-training models and predicting their downstream performance on accuracy metrics.

Hoffmann et al. investigate how the number of model parameters NN and training tokens DD should be chosen to minimize loss LL given a compute budget CC. Hoffmann et al. find that when scaling up CC, both NN and DD should be scaled equally up to a multiplicative constant (i.e., N∝C∼0.5N\propto C^{\sim 0.5} and D∝C∼0.5D\propto C^{\sim 0.5}) to realize compute-optimality. Appendix C of the Chinchilla paper additionally suggests that these findings hold across many datasets. However, Hoffmann et al. do not account for inference costs, provide scaling laws for training beyond compute-optimal, or for downstream error prediction—all of which are central to our work.

Sardana & Frankle proposed modifications to the Chinchilla formulation to incorporate inference costs into the definition of compute-optimal and solve for various fixed inference budgets. Their key finding, which is critical for our work, is that when taking into account a large enough inference budget, it is optimal to train smaller models for longer when compared to the original Chinchilla recommendations. Our work presupposes that over-training can be beneficial. Instead of solving for inference-optimal schemes, we support empirically a predictive theory of scaling in the over-trained regime. Additionally, we provide experiments across many validation and training sets.

Over-training in popular models.

There has been a rise in over-trained models and accompanying massive datasets . To contextualize the extent to which we over-train, we provide token multipliers for popular models in Table 4. For example, Chinchilla 70B is trained with a token multiplier of 20, while LLaMA-2 7B uses a token multiplier of 290. In our investigation, we look at token multipliers from 5 to 640 to ensure coverage of popular models and relevance for future models that may be trained on even more tokens.

Limitations, future work, and conclusion

We identify limitations, which provide motivation for future work.

Hyperparameters. While our configurations are surprisingly amenable to reliable scaling across many training and testing distributions without further tuning, there is a need to further develop scaling laws that incorporate hyperparameters.

Scaling up. Validating the trends in this paper for even larger runs is a valuable direction.

Scaling down. Additionally, actualizing predictable scaling with even cheaper runs is important to make this area of research more accessible, especially for downstream error prediction.

Failure cases. While we present preliminary analysis of when scaling is unreliable, future work should develop an analytic theory explaining when scaling breaks down.

Post-training. It is common to employ supervised fine-tuning and reinforcement learning after pre-training, which we do not consider. Quantifying to what degree over-training the base model provides benefits after post-training is an open area of research.

Individual downstream task prediction. While we find that averaging over many task error metrics can make for a predictable metric, per-task predictions are left to future work.

In-the-wild performance. Downstream task performance is a proxy for the in-the-wild user experience. Analyzing scaling trends in the context of this experience is timely.

Dataset curation. Our work only deals with existing training datasets. Exploring dataset curation for improved model scaling is another promising direction.

Conclusion.

We (i) show that the loss scaling behavior of models trained past compute-optimal, in the over-trained regime, is predictable and (ii) predict, via a proposed scaling law, the downstream average task performance of more expensive runs using smaller-scale proxies. We hope our work will inspire others to further examine the relationship between model training and downstream generalization. We also hope our testbed will make scaling research more accessible to researchers and practitioners alike.

Acknowledgements

SYG is supported by an NSF Graduate Research Fellowship, GS by the Onassis Foundation - Scholarship ID: F ZS 056-1/2022-2023, and MN by the Federal Ministry of Education and Research of Germany under grant no. 01IS22094B WEST-AI. We thank Stability AI and Toyota Research Institute (TRI) for access to compute resources. This research has been supported by NSF Grants AF 1901292, CNS 2148141, Tripods CCF 1934932, IFML CCF 2019844, and research gifts by Western Digital, Amazon, WNCG IAP, UT Austin Machine Learning Lab (MLL), Cisco, and the Stanly P. Finch Centennial Professorship in Engineering. We also thank Kushal Arora, Alper Canberk, Mia Chiquier, Sachit Menon, Chuer Pan, Purva Tendulkar, and Mandi Zhao for valuable feedback.

References

Appendix A Contributions

Model training and experiment babysitting.

Achal Dave (notably, the 1.4B parameter, 900B token run), Samir Yitzhak Gadre

Dataloading.

Training tokens.

Achal Dave, Alex Fang, Samir Yitzhak Gadre, Suchin Gururangan, Jeffrey Li, Vaishaal Shankar (lead), Mitchell Wortsman

Evaluation tokens.

Achal Dave, Samir Yitzhak Gadre, Reinhard Heckel, Vaishaal Shankar (lead), Rulin Shao

Loss/perplexity evaluation.

Downstream evaluation.

Project-specific infrastructure, plots, and analysis.

OpenLM [37] open-source infrastructure.

Achal Dave (core contributor), Alex Fang, Samir Yitzhak Gadre (core contributor), Suchin Gururangan (core contributor), Jenia Jitsev, Sedrick Keh, Jeffrey Li, Jean Mercat, Marianna Nezhurina, Vaishaal Shankar (core contributor), Georgios Smyrnis (core contributor), Igor Vasiljevic, Mitchell Wortsman (core contributor), Rui Xin

Theory.

Yair Carmon (original idea that “parallel lines” should show up in scaling plots), Samir Yitzhak Gadre (various derivations, empirical verification, related validation loss to average top-1 error as in Equation (5)), Reinhard Heckel (derived a scaling form based on Chinchilla Approach 3 , which appears in Equation (4)), Mitchell Wortsman (provided intuition about irreducible loss and why it is critical), Niklas Muennighoff (derived a scaling form based on Chinchilla Approach 3, similar to Equation (4)).

Writing.

Yair Carmon, Achal Dave, Reinhard Heckel, Samir Yitzhak Gadre (lead), Niklas Muennighoff, Ludwig Schmidt

Compute.

Achal Dave, Jenia Jitsev, Thomas Kollar, Ludwig Schmidt, Vaishaal Shankar

Advising.

Yair Carmon (co-lead), Achal Dave (co-lead), Alexandros G. Dimakis, Reinhard Heckel (co-lead), Gabriel Ilharco, Jenia Jitsev, Thomas Kollar, Niklas Muennighoff (co-lead), Ludwig Schmidt (co-lead), Shuran Song

Appendix B Scaling-law derivations

We first show that reparameterizing Equation (3) in terms of the compute CC and token multiplier MM for α=β\alpha=\beta yields Equation (4). Combining C=6NDC=6ND and M=D/NM=D/N yields N=C/(6M)N=\sqrt{C/(6M)} and D=CM/6D=\sqrt{CM/6}. Inserting these into Equation (3) yields,

This is equal to Equation (4), making the substitutions αC=α/2\alpha_{C}=\alpha/2, a=A(1/6)−αCa=A(1/6)^{-\alpha_{C}}, b=B(1/6)−αCb=B(1/6)^{-\alpha_{C}}, as noted in the main body.

Recall that we made the assumption α=β\alpha=\beta, which implies equal scaling of parameters and tokens to realize compute-optimal models. While this assumption is empirically justified , even if α≠β\alpha\neq\beta, we get a parameterization that implies the power law exponent in Equation (4) remains constant with over-training, while the power law scalar changes.

To find a compute-optimal training setting, Hoffmann et al. propose to minimize the right-hand side of Equation (3) subject to the compute constraint C=6NDC=6ND. This yields, N∗=γ1α+β(C/6)βα+βN^{\ast}=\gamma^{\frac{1}{\alpha+\beta}}(C/6)^{\frac{\beta}{\alpha+\beta}} and D∗=γ−1α+β(C/6)αα+βD^{\ast}=\gamma^{-\frac{1}{\alpha+\beta}}(C/6)^{\frac{\alpha}{\alpha+\beta}}, where γ=αAβB\gamma=\frac{\alpha A}{\beta B}, for notational convenience. The associated risk is,

We now deviate from compute-optimal training by modifying the model size and tokens by multiplication with a constant m\sqrt{m}, according to

This modification keeps the compute constant (i.e., 6NmDm=6N∗D∗6N_{m}D_{m}=6N^{\ast}D^{\ast}). The risk, then, becomes

We again expect the same power law exponent and changing power law scalar. Note that mm in Equation (8) is similar to MM in Equation (4). Specifically, mm is a multiple of the Chinchilla-optimal token multiplier M∗=D∗/N∗M^{\ast}=D^{\ast}/N^{\ast}, which is no longer fixed as a compute budget changes for α≠β\alpha\neq\beta.

Appendix C Additional grid search details

Recall in Section 3.2, we run a grid search over many configurations. We present the architectures we sweep over in Table 5.

Appendix D Evaluation dataset details

All 46 downstream evaluations are based on MosaicML’s LLM-foundry evaluation suite . We specifically consider the datasets given in Table 6.

Appendix E Additional results

As mentioned in Section 3.2 and Figure 4, we notice that models between 0.011B to 0.079B (i.e., 5.2×10165.2\times 10^{16} to 5.2×10175.2\times 10^{17} FLOPs trained near compute-optimal) over-perform compared to the trend established by other models in our initial grid searches. This results in a bump in the scaling plot. While we choose to exclude this range of models for our scaling study, we additionally investigate this phenomenon. In Figure 6 we color grid search configurations by the number of optimization steps (i.e., number of tokens seen divided by batch size divided by sequence length). For context, Figure 1 (left) in Kaplan et al. also shows a bump; however, there the performance is worse than the general trend instead of better as in our work. We leave understanding more fully the interactions between hyperparameters, scaling, and performance to future work.

Scaling is largely predictable in-distribution (ID).

Prior work focuses on understanding scaling using ID loss, often using training loss directly . Hence, we also consider Paloma loss evaluation sets, which are designed to probe performance in specific domains. We use Paloma’s C4 , RedPajama , and Falcon-RefinedWeb splits to probe for ID validation loss. As seen in Figure 7, relative error is mostly low. Relative error is largest for the N=1.4B,M=640N=1.4\text{B},M=640 RedPajama run at 15.4%. Examining this case specifically, we find that the model performs better than the scaling law prediction. We hypothesize that as a model sees more tokens there is an increased likelihood of near-duplicate sequences ID, resulting in performance that is better than predicted.

Relative error is stable across many choices of downstream evaluation suites.

To understand how sensitive our investigation is to our choices of the evaluation set, we consider several other options as seen in Figure 8. We find that our prediction errors are fairly (i) low and (2) consistent for many choices of downstream evaluation sets.

Scaling can break down when under-training.

We find that when a token multiple is too small (i.e., under-training regime), scaling appears unreliable. In Figure 9 we see for M=5M=5 the scaling trend is different. We hypothesize that tuning hyperparameters (e.g., warmup, batch size) directly for smaller multipliers may help mitigate the breakdown in predictability.

Scaling can be unpredictable out-of-distribution (OOD).

Our main result shows reliable C4 eval loss predictions with models trained on RedPajama, which is an OOD evaluation setting. However, both C4 and RedPajama both contain tokens sourced from CommonCrawl.

To further probe OOD performance, we measure the relative error of scaling laws fit to models trained on C4 and evaluated on Paloma’s 100 programming languages , Paloma’s Penn Tree Bank (PTB) split , and a German version of C4 . Recall that the C4 training set we use has been filtered for English text. Hence we expect (i) the proportion of code is minimal, (ii) the “” substrings in PTB raw text do not appear frequently, and (iii) German is not prevalent. We notice that extrapolation relative error tends to be high for large M,NM,N on programming languages and PTB (Figure 10 (left, center)). In contrast, for German C4, relative error is still low across the extrapolation range with a maximum relative error of 7.6% at the N=N=1.4B, M=80M=80 scale (Figure 10 (right)). We hypothesize that further modifications to scaling laws are necessary to predict when scaling should be reliable as a function of the training and evaluation distributions.

Small-scale experiments can predict average downstream top-1 error.

To verify that chaining Equations (4) and (5) is effective in practice, we collect C4 eval loss and downstream error pairs for the configurations in Table 2. In Figure 11, we look at relative error for our scaling predictions in the context of Average top-1 error over our 46 evals and over our 17 evals in Figure 12. We again notice reliable scaling in interpolation and extrapolation regimes, suggesting the validity of our procedure to predict downstream average top-1 error.

Loss evaluation ablations for downstream trends.

Figure 13 presents the correlation between downstream error vs. loss evaluated on different validation sets (C4, RedPajama, and RefinedWeb). Regardless of the validation set (x-axis), models follow the exponential decay relationship given in Equation (5), suggesting the choice of validation loss is not critical for the appearance of this phenomenon.

Investing more compute in a scaling law makes it more predictive.

Thus far we have looked at standard configurations from Table 2 to construct our scaling laws, mainly to demonstrate extrapolation to larger N,MN,M. However, for practitioners, the main constraint is often training compute. Hence, we wish to understand the trade-offs between the amount of compute invested in creating a scaling law and the relative error of the resulting law in the over-trained regime. In Figure 14 (left), we see that as one increases the amount of compute, it is possible to get better fits with lower relative error. In Figure 14 (right), we see a similar trend as one increases the number of data points used to fit a scaling law. Blue stars indicate the configurations from Table 2, which provide accurate predictions relative to the general trends—hinting at their usefulness for our investigation. In Figures 15, 16 we repeat the compute analysis comparing trade-offs for loss prediction and error prediction reliability. We find that less compute is generally necessary to construct a loss scaling law that achieves the same relative error as that of an error prediction scaling law.

Appendix F Additional related work

Language models can be grouped into encoder-only , encoder-decoder , and decoder-only architectures . Most current implementations are based on the transformer . However, there has been a recent resurgence in scaling language models based on non-transformer architectures . Further, there has been substantial work on adapting pre-trained language models to better follow instructions . However, following prior work and given their overall prevalence, we limit ourselves to GPT-style, decoder-only transformers that have solely been pre-trained.

Scaling laws.

Kaplan et al. investigate scaling trends in GPT language models. Bahri et al. investigate different scaling regimes theoretically, and Sharma & Kaplan relate scaling coefficients to data manifold dimensions. Tay et al. elucidate the connection between model architecture and scaling trends, while Hernandez et al. , Tay et al. develop scaling laws for transfer learning. Ivgi et al. also consider transfer learning scaling laws and highlight the importance of hyperparameter selection in the low-compute regime. Ghorbani et al. , Gordon et al. , Bansal et al. develop scaling laws for neural machine translation. Caballero et al. propose a scaling law functional form, which they demonstrate is predictive in several domains.

Scaling beyond language modeling.

There is a large body of work on scaling neural networks beyond language modeling, for example in computer vision , multimodal learning , and image reconstruction .