Hyperparameter Selection › Default Recipes
Language AI HandbookAll chapters Hyperparameter Selection › Default RecipesOne section · Sections in this chapter7 / 14 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
The research community has converged on several default recipes for LLM training. These represent the distilled experience of many training runs and are reliable starting points for new models. You will still need to tune learning rate and verify on your specific setup, but using these defaults dramatically narrows the search space.
The GPT-Style Training Recipe
The configuration used in GPT-3 and refined in subsequent work has become the de facto standard for autoregressive LLM pretraining:
- Optimizer: Adam with , ,
- Learning rate: peak LR in the range depending on model size, scaled by approximately
- Learning rate schedule: cosine decay to 10% of peak LR
- Warmup: linear warmup for 1% to 4% of total training steps (up to a few thousand steps)
- Weight decay: applied to all non-bias, non-embedding parameters
- Gradient clipping: 1.0 (global gradient norm)
- Batch size: large, typically 0.5M to 4M tokens per batch
- Dropout: 0 during pretraining (all regularization via weight decay and data diversity)
Note the choice of rather than the Adam default of . This reflects the observation that large-batch LLM training benefits from a shorter memory in the second moment estimate. With , the second moment estimate is dominated by a long history of gradients, which can cause the optimizer to respond too slowly to sudden changes in gradient magnitude during training. The value gives a more responsive effective window of approximately steps rather than 1000 steps.
The decision to set dropout to zero during pretraining is deliberate. Dropout was a critical regularizer in the pre-LLM era, when models were trained on relatively small, task-specific datasets. For LLM pretraining on trillions of tokens from diverse sources, data diversity itself provides strong implicit regularization. Adding dropout during pretraining hurts sample efficiency without providing meaningful overfitting protection. Dropout is sometimes reintroduced during fine-tuning, where the dataset is smaller and overfitting becomes a real concern.
The Chinchilla Scaling Recipe
The Chinchilla paper (Hoffmann et al., 2022) contributed scaling laws and practical training defaults for compute-optimal models:
- Dataset size: train for roughly tokens where is the model size in parameters
- Learning rate: similar to GPT-style but with slightly lower weight decay ( to depending on scale)
- Cooldown: explicit cooldown phase of 10% of total steps before linear decay ends
The important takeaway from Chinchilla for hyperparameter selection is that dataset size and model size are themselves hyperparameters that interact. Under-training a large model (fewer tokens than compute-optimal) or over-training a small model both give worse performance per flop.
The Chinchilla result says both the number of parameters and the number of training tokens should scale equally with compute. Empirically, (train on 20 tokens per parameter). The compute cost of training a transformer is approximately FLOPs (roughly 6 multiply-accumulates per parameter per token). Substituting :
where:
- : optimal model size in parameters for a given compute budget
- : optimal number of training tokens, approximately
- : total compute budget in floating-point operations (FLOPs)
(The exact constant varies by source; the Chinchilla paper uses coefficients derived from empirical fits. The key insight is that scales as , meaning you should grow both model size and data together as compute increases.)
For a given compute budget, training a model with parameters is more efficient than training a larger model for fewer steps or a smaller model for more steps.
The Chinchilla compute-optimal recipe optimizes training loss at a fixed compute budget. In deployment, the cost of inference often dominates the cost of training: a model that you run millions of times at inference may justify training for longer (more tokens than Chinchilla-optimal) to push down the model size needed to achieve a target quality. This trade-off has led several organizations to train smaller models for longer than the Chinchilla recipe recommends, accepting higher training cost in exchange for lower inference cost.
LLaMA-Style Training
The LLaMA family (Touvron et al., 2023) refined the GPT recipe with several changes that have become widely adopted:
- Optimizer: AdamW (weight decay decoupled from the gradient update, as discussed in the Weight Decay chapter)
- Learning rate: for 7B, for 65B
- Schedule: cosine decay to (nearly to zero)
- Warmup: 2000 steps (roughly 0.4% of total training steps for a 500B token run)
- Weight decay:
- Gradient clipping:
- Batch size: 4M tokens for 65B model
The shift to AdamW from Adam with standard weight decay matters primarily at this scale. In standard Adam, weight decay interacts with the second moment estimate, effectively reducing decay for parameters with large gradients. AdamW decouples the two, applying weight decay uniformly regardless of gradient history. This produces more consistent regularization.
LLaMA's decision to decay to nearly zero (final LR of , which is about 3% of the peak ) rather than the GPT convention of stopping at 10% of peak represents a more aggressive cooldown. The motivation is that the final phase of cosine decay, where the learning rate is very small, allows the model to make fine adjustments without large perturbations. In practice, the difference between decaying to 5% and 10% of peak is modest, but decaying to zero or near-zero has been consistently observed to improve final performance slightly.
Learning Rate Priors by Model Size
A practical prior for learning rate based on observed compute-optimal configurations:
| Model size | Typical peak LR | Range |
|---|---|---|
| 125M parameters | ||
| 350M parameters | ||
| 1.3B parameters | ||
| 6.7B parameters | ||
| 30B parameters | ||
| 65B parameters |
The trend is clear: optimal learning rate decreases slowly with model size in log-scale, roughly halving for every 10x increase in parameters. This relationship emerges from the combination of increased gradient sensitivity and the need for stable optimization at large scale.
import numpy as np
# Model sizes and their typical optimal learning rates (from literature)
model_sizes_billions = np.array([0.125, 0.35, 1.3, 6.7, 30.0, 65.0])
optimal_lrs = np.array([6e-4, 4e-4, 3e-4, 2e-4, 1.5e-4, 1e-4])
# Fit a power law: lr = a * N^b in log-log space
log_sizes = np.log10(model_sizes_billions * 1e9) # convert to parameter count
log_lrs = np.log10(optimal_lrs)
# Linear regression in log-log space
coeffs = np.polyfit(log_sizes, log_lrs, 1)
slope, intercept = coeffs
# Predictions from the fit
predicted_lrs = 10 ** (slope * log_sizes + intercept)
# Estimate LR for hypothetical 175B model
lr_175b = 10 ** (slope * np.log10(175e9) + intercept)Power law fit: LR ≈ 7.6818e-02 × N^-0.2634 (where N is model size in parameters) Fit quality: 0.125B params: observed 6.0e-04, predicted 5.7e-04, ratio 1.06 0.350B params: observed 4.0e-04, predicted 4.3e-04, ratio 0.93 1.300B params: observed 3.0e-04, predicted 3.1e-04, ratio 0.98 6.700B params: observed 2.0e-04, predicted 2.0e-04, ratio 1.01 30.000B params: observed 1.5e-04, predicted 1.3e-04, ratio 1.12 65.000B params: observed 1.0e-04, predicted 1.1e-04, ratio 0.92 Extrapolation to 175B: estimated LR ≈ 8.40e-05
The power law relationship between model size and optimal learning rate is not a fundamental law, but an empirical regularity from training runs across many model sizes. Using it as a prior saves you from searching a completely uninformed range when starting with a new model size.


The Weight Decay Default
The choice of weight decay in GPT-style training deserves explanation. Weight decay at this scale is applied to weight matrices only (not biases, not embedding tables, not layer norm parameters). At this level:
- It provides moderate regularization without strongly suppressing parameter magnitudes
- It interacts well with the cosine schedule (parameters shrink toward zero as the learning rate decays)
- It is large enough to provide a meaningful regularization signal on large models
Lower values () are used when the dataset is very large relative to model size (less risk of overfitting). Higher values () are sometimes used for smaller models or fine-tuning scenarios.
The question of which parameters receive weight decay has a principled answer that goes beyond arbitrary convention. Biases and layer normalization parameters are scalar offsets and scales that adjust the mean and variance of activations. Applying weight decay to them would bias the model toward activations with zero mean and unit variance regardless of what the data suggests, which can impede the model's ability to represent the appropriate activation statistics for a given layer. Embedding parameters represent specific token identities; shrinking them toward zero would make all token embeddings converge and lose their distinctiveness. By restricting weight decay to weight matrices, you regularize the relational structure of the model (how inputs are transformed) without constraining its representational offsets.