TL;DR
This paper introduces "Step Law," a universal scaling law for hyperparameter optimization in Large Language Model (LLM) pre-training. By training over 3,700 LLMs, they discovered that optimal learning rates and batch sizes can be predicted with high accuracy using simple power-law relationships dependent on model and dataset size, significantly simplifying the hyperparameter tuning process.
What Problem Does This Paper Address?
Training state-of-the-art LLMs requires immense computational resources, making hyperparameter optimization a critical bottleneck. While previous research has explored scaling laws for learning rates and batch sizes, these often fail to generalize across different model architectures (like dense vs. Mixture-of-Experts), data recipes, or dataset sizes. This lack of a unified, principled framework necessitates expensive and time-consuming grid searches or relies on brittle, specialized rules. The authors aim to bridge this gap by developing a universal, robust, and empirically validated scaling law that works across these diverse dimensions.
Methods
The core of this work is an extensive empirical investigation. The authors trained over 3,700 LLMs from scratch, accumulating 100 trillion tokens and nearly a million GPU hours. They systematically explored the hyperparameter landscape (learning rate and batch size) for various model sizes and dataset sizes. A key discovery was the convexity of the loss landscape, meaning there's a broad, stable optimum region for hyperparameters, which simplifies search. Based on this, they derived the "Step Law," which defines optimal learning rate ($\eta$) as a power-law function of model size ($N$) and dataset size ($D$), and optimal batch size ($B$) as a power-law function primarily of dataset size ($D$), largely independent of $N$. They formally defined these relationships and validated them across numerous configurations.
Datasets
The paper describes training LLMs on a dataset comprising web text, math, and code, with proportions aligned with Llama. They also mention using three distinct data recipes for robustness testing:
- Baseline: The original composition.
- Bilingual Corpus: Augmented with Chinese data.
- Code Integration: Reduced English content, increased code-the-stack.
- Code-Dominant: Further decreased English content, increased code-the-stack significantly.
No new benchmarks were introduced; instead, they focused on evaluating their scaling law's performance across existing data compositions.
Key Insights and Ideas
- Loss Landscape Convexity: The hyperparameter landscape for LLM pre-training is not a chaotic mess but exhibits a consistent convex (bowl-shaped) property. This means there's a broad, stable optimum, making hyperparameter tuning less sensitive to minor deviations and significantly reducing search complexity.
- Universal "Step Law": The authors discovered a single, unified power-law relationship for optimal learning rate and batch size that holds across different model architectures (dense and MoE), data recipes, and dataset sizes. This is a major step towards a generalizable framework.
- Batch Size Independence from Model Size: Surprisingly, the optimal batch size appears to be primarily dictated by the dataset size ($D$) and shows little to no dependence on the model size ($N$). This simplifies tuning as one dimension can be largely ignored.
- Robustness Across Architectures and Data: The Step Law demonstrates remarkable invariance. It works well for both dense transformers and sparse Mixture-of-Experts (MoE) models, and its predictions remain accurate even with significant shifts in data distribution (e.g., heavily code-based datasets).
Key Results
- The Step Law predicts optimal hyperparameters that result in a test-set loss only 0.094% higher than the global optimum found via exhaustive search, significantly outperforming prior methods.
- The empirical study involved training 3,700 LLMs across 100 trillion tokens, consuming nearly one million NVIDIA H800 GPU hours.
- The optimal learning rate follows $\eta(N, D) = 1.79N^{-0.713} D^{0.307}$.
- The optimal batch size follows $B(D) = 0.58D^{0.571}$.
- For MoE models, the Step Law achieved a relative prediction error within 0.5%, significantly better than other methods which had errors over four times larger.
- For varied data recipes, the Step Law achieved high predictive accuracy with relative errors within 0.25% of the global minimum.
Limitations and Future Work
- Data-Driven Findings: The authors acknowledge that their findings are primarily data-driven. They suggest that future work should focus on developing a more theoretical understanding of these power-law relationships, potentially deriving them from first principles. This would enhance their predictive power and generalizability beyond the empirically validated domain.
- Computational Cost: While the Step Law simplifies tuning, the initial discovery and validation required an unprecedentedly large empirical study. The paper provides code and checkpoints to mitigate this for the community.
Summary updated