Power Lines: Scaling Laws for Weight Decay and Batch Size in LLM Pre-training
Shane Bergsma, Nolan Dey, Gurpreet Gosal, Gavia Gray, Daria Soboleva, Joel Hestness
TL;DR
The paper addresses how hyperparameters should be scaled during large-language-model pre-training by proposing a unified AdamW-based framework that connects the optimal weight decay and batch-size strategies to model size, data size, and compute. It reveals a power-law relation between the AdamW timescale and tokens-per-parameter, enabling prediction of λ_opt across N, D, and B, and shows that B_opt and B_crit scale with data size D independently of N, with a practical method to estimate Pareto-optimal N-D-B configurations for time vs compute. The findings offer actionable guidance for hardware-aware HP tuning and training planning, suggesting that λ tuning is often more robust than η tuning when scaling batch size and that modest overtraining can improve time and parallelism outcomes. Together, these results help practitioners balance wall-clock time and compute costs in real-world LLM pre-training while informing remote hardware and scheduling decisions.
Abstract
Efficient LLM pre-training requires well-tuned hyperparameters (HPs), including learning rate $η$ and weight decay $λ$. We study scaling laws for HPs: formulas for how to scale HPs as we scale model size N, dataset size D, and batch size B. Recent work suggests the AdamW timescale, $τ= B/(ηλD)$, should remain constant across training settings, and we verify the implication that optimal $λ$ scales linearly with B, for a fixed N and D. However, as N and D scale, we show optimal $τ$ obeys a precise power law in the tokens-per-parameter ratio, D/N. This law thus provides a method to accurately predict $λ$opt in advance of large-scale training. We also study scaling laws for optimal batch size Bopt (the B enabling lowest loss at a given N,D) and critical batch size Bcrit (the B beyond which further data parallelism becomes ineffective). In contrast to prior work, we find both Bopt and Bcrit scale as power laws in D, independent of model size, N. Finally, we analyze how these findings inform the real-world selection of Pareto-optimal N and D under dual training time and compute objectives. All experiments were run on Cerebras CS-3 systems.
