Concepts / Hyperparameters and Training Configuration

Hyperparameters and Training Configuration

Hyperparameters are the settings that are chosen by users before training, and they govern how that learning happens.

  • Programming

Starting From a Compute Budget

Imagine you are about to train a language model and you have a fixed amount of compute to spend. Compute is the computation you pay for when a model learns from text, and for large models it is often the constraint that actually limits a project. The hardware needed is expensive and hard to set up, so teams usually frame the practical question as: given this much compute, what is the best performance I can get?

Definition

A compute-optimal model delivers the best performance achievable for a fixed compute budget. Because the budget is the fixed quantity, teams usually start from the budget and work outward to decide the model's size and how much data it learns from.

This article follows that outward path. It starts with the two linked decisions every team faces on a fixed budget, then walks through the Chinchilla scaling rule that connects them, then separates the values a model learns from the settings a person chooses, and finally covers the situations in which the rule must be adjusted.

Two Linked Decisions on One Budget

On a fixed budget you face two decisions at once. The first is how large the model should be, meaning how many parameters it has. The second is how much text the model should learn from, meaning how many training tokens it sees. The two are linked because model performance depends on both, and both push up the amount of compute required.

The two failure modes pull in opposite directions. If the model is too large, the compute runs out before it has seen enough data. If the model is too small, the compute is used inefficiently. The diagram below compares these two allocations under the same budget.

Larger modelMany parametersBalanced modelSize grows with dataFewer training tokensBudget spent on sizeAbout 20 tokens perparameterChinchilla ratioCompute runs outBefore enough data is seenCompute usedefficientlyBest result for the budget
Under the same fixed budget, a larger model leaves fewer training tokens to learn from, while the compute-optimal split balances model size against token count.

The Chinchilla Ratio

The Chinchilla scaling law gives a rule for choosing model size and dataset size once the compute budget is fixed. It came from a 2022 study by DeepMind, which trained 400 language models. Those models ranged from about 70 million parameters to over 16 billion parameters, and they were trained on between 5 and 500 billion tokens. By comparing these runs, the researchers found a consistent relationship: for compute-optimal training, the number of training tokens should be roughly 20 times the number of model parameters.

Formula, step by step
  1. 1
    N stands for the number of model parameters.
  2. 2
    D stands for the number of training tokens.
  3. 3
    The constant 20 is the approximate ratio found across the study's compute-optimal runs.
  4. 4
    The relationship is a ratio, so N and D must grow together rather than one being fixed while the other changes.
Definition

The Chinchilla scaling rule states that, for compute-optimal dense models, the number of training tokens should be roughly 20 times the number of parameters. Model size and token count should be scaled equally: doubling the parameters means doubling the training tokens.

The same study also estimated, for each compute budget, the training loss you should expect at the best settings, assuming training is carried out correctly. This makes the rule useful for planning. It tells you not only how to split a budget, but roughly what result that split should produce.

Estimating Tokens for a Model Size

Worked example

How many tokens does a 1 billion parameter model need?

A team plans a compute-optimal dense model with $10^{9}$ parameters. Using the Chinchilla rule, estimate the number of training tokens.

  1. 1
    Identify N

    The model has $N = 10^{9}$ parameters.

  2. 2
    Apply the ratio

    The rule gives $D \approx 20N$, so $D \approx 20 \times 10^{9}$.

  3. 3
    Simplify

    $20 \times 10^{9} = 2 \times 10^{10}$, which is 20 billion tokens.

  4. 4
    Check the scaling

    If the team doubled the model to $2 \times 10^{9}$ parameters, the rule would require $40 \times 10^{9}$ tokens, so both quantities doubled together.

Result

A compute-optimal 1 billion parameter dense model should be trained on roughly 20 billion tokens.

What do you think happens?

If the model doubles from 1 billion to 2 billion parameters, how many training tokens does the Chinchilla rule imply?

Reveal answer
Answer:

About 40 billion tokens.

The rule is a fixed ratio of roughly 20 tokens per parameter, so 2 billion parameters call for about 20 times 2 billion, which is 40 billion tokens. The token count doubles along with the parameter count.

Parameters Versus Hyperparameters

A training configuration contains two different kinds of values, and mixing them up causes confusion. Parameters are the values the model learns during training. Hyperparameters are the settings that are chosen by users before training, and they govern how that learning happens. The diagram below shows how the two sit within a training configuration.

TrainingconfigurationParametersLearned during trainingModel size and dataSet by the compute-optimalsplitHyperparametersChosen by users beforehandincludesincludesshapes the run
A training configuration holds parameters, which are learned during training, and hyperparameters, which are chosen beforehand by users.

The distinction matters for the budget discussion. The Chinchilla rule decides how size and data should be balanced, but the hyperparameters still have to be chosen for the run. The performance of a model depends heavily on them, so a correct size and data split alone does not guarantee a good result.

Why Tuning Gets Harder at Scale

With small models, it is common to train several times with different hyperparameter settings and keep the best run. The loop below shows that cycle: choose settings, train, evaluate, then adjust and repeat.

Choose settingsHyperparameters picked bythe userTrain a full runVery expensive for largemodelsEvaluate the resultCompare against other runsAdjust settingsRepeat if budget allowstrainevaluatedecidetry again
Each pass chooses settings, trains a full run, and evaluates the result. For large models, each full run is so costly that few passes are possible.

For large models the same cycle becomes rarely feasible. A single training run is already very expensive, so a team may get only one serious attempt at the right hyperparameters. The hyperparameters also interact with one another, so the number of combinations grows very quickly, and a team cannot simply test each one in isolation.

One research direction tries to work around this. Scaling extrapolation, also called hyperparameter transferring, studies smaller models and extends the pattern upward to predict good settings for a large model. One 2022 study by Microsoft and OpenAI reported that hyperparameters could be transferred from a 40 million parameter model to a 6.7 billion parameter model. The approach is still niche, because few groups have the resources to study large training runs. Emergent abilities that appear only at scale can also make extrapolation less reliable.

When the Rule Needs Adjusting

The Chinchilla rule is a starting point with stated assumptions. It was developed for dense models trained mostly on human-generated data, and it assumes that acquiring training data is much cheaper than the compute used to train on it. It does not automatically carry over to sparse architectures such as mixture-of-experts models, nor to training on synthetic data. Adapting the calculation to those settings is an active research area.

  • The model is dense and trained mostly on human-generated data, so the 20-to-1 ratio is a starting point.
  • Acquiring data is much cheaper than the compute used to train on it.
  • Inference cost is not a major concern for the deployed model.
  • The team is optimizing for training quality alone.

Two conditions push the decision away from the pure training-compute answer. The first is inference demand. For a model that will be deployed, the quality reached at training time is only one factor. Some widely adopted models, the Llama family being a prominent example, deliberately use smaller models than the compute-optimal calculation would select for their budget. Their authors could have trained larger models that score better, but smaller models are easier to work with and cheaper to run for inference, and that practical advantage helped them gain broad adoption.

To account for this, Sardana and colleagues modified the Chinchilla calculation so that it estimates the best parameter count and pre-training data size while including expected inference demand. The lesson is that the optimal size depends on what you are optimizing for: training quality alone, or training plus the ongoing cost of serving the model.

The second condition is expensive data. When data itself is costly to obtain, the optimal split changes, and the same study proposes a separate calculation for that case. The original ratio should not be applied unchanged when data is the scarce resource.

Mistakes With the Ratio and Tuning

  • Common mistake

    Scaling only the model size and keeping the token count fixed

    What it looks like

    A team doubles the parameters of a model but keeps training on the same amount of text.

    Why it fails

    The ratio is between two quantities that must grow together, so changing only one moves the run away from the compute-optimal point.

    Do this instead

    When N doubles, plan for D to roughly double as well, keeping the ratio near 20 tokens per parameter.

  • Common mistake

    Treating the 20-to-1 ratio as a universal law

    What it looks like

    Applying the same ratio to a sparse mixture-of-experts model or to synthetic training data.

    Why it fails

    The scaling law was developed for dense models trained mostly on human-generated data.

    Do this instead

    Use the ratio as a starting point for dense models and look for adapted calculations in other settings.

  • Common mistake

    Ignoring inference cost when the model will be deployed

    Why it fails

    The optimal size depends on whether you optimize for training quality alone or for training plus ongoing serving cost.

    Do this instead

    Include expected inference demand in the sizing decision, as the modified calculation by Sardana and colleagues does.

  • Common mistake

    Assuming small loss differences are unimportant

    What it looks like

    A drop in cross-entropy loss from about 3.4 to 2.8 nats requires roughly ten times more training data.

    Why it fails

    Small-looking changes in loss values can matter a great deal for downstream applications.

    Do this instead

    Estimate the real cost of a small gain before deciding that it is not worth pursuing.

  • Common mistake

    Repeating large training runs casually as if they were cheap, when a single run of a large model is already very expensive

Practice Sizing a Budget

MEDIUM

A team is training a dense model that will mostly be used for research experiments, so inference cost is not a major concern and the training data is cheap. Their planned model has $3 \times 10^{9}$ parameters. Estimate the number of training tokens the Chinchilla rule suggests, then explain what would go wrong if they trained on only 6 billion tokens while keeping the same model size.

Hints
  • Apply D approximately equal to 20 times N, with N equal to $3 \times 10^{9}$.
  • Compare the resulting token count with the 6 billion tokens the team plans to use, and ask whether the two quantities still grow together.
  • Remember that scaling only one quantity moves the run away from the compute-optimal point.

Key Takeaways

  • A compute-optimal model delivers the best performance achievable for a fixed compute budget, so teams usually start from the budget and work outward.
  • The Chinchilla scaling rule suggests roughly 20 training tokens per parameter for compute-optimal dense models, and model size and token count should grow together.
  • Parameters are learned during training, while hyperparameters are chosen by users beforehand, and tuning hyperparameters is hard for large models because each full run is costly and hyperparameters interact.
  • The rule assumes dense models, mostly human-generated data, and cheap data relative to compute; it must be adjusted when inference cost matters or data is expensive.

Related concepts

More concepts starting with H