Maximize Your Data's Potential: Enhancing LLM Accuracy with Two-Phase Pretraining

Steven Feng, Shrimai Prabhumoye, Kezhi Kong, Dan Su, Mostofa Patwary, Mohammad Shoeybi, Bryan CatanzaroarXiv 2024 · DOI

Abstract

Researchers from NVIDIA, Stanford, and Boston University have formalized a two-phase pretraining strategy that significantly boosts Large Language Model (LLM) accuracy by balancing data diversity and quality. By prototyping data blends on a smaller scale (1T tokens) and then scaling to massive horizons (15T tokens) and larger models (25B parameters), they demonstrate that a "diversity-first, quality-second" approach outperforms standard data ordering by up to 17%.

Introduction

While the AI community knows that "data is king," the specific "recipe" for mixing that data remains a closely guarded secret. There is a significant knowledge gap regarding data blending (how much of each source to use) and data ordering (when to show specific data to the model). Most developers rely on the "natural distribution" of tokens or random ordering. However, as training budgets expand to tens of trillions of tokens, simply throwing more data at a model isn't enough. Practitioners need to know how to select high-quality slices of the web, how many times to repeat specialized data like math or code, and whether strategies developed on small models actually hold up when scaling to billions of parameters.

Methods

The authors propose and formalize a Two-Phase Pretraining framework:

  1. Phase 1 ($P_1$): Focuses on diversity. The model is exposed to a broad mix of high-quality web crawl data, along with moderate amounts of specialized data (books, papers, etc.).
  2. Phase 2 ($P_2$): Focuses on quality and specialization. In the final ~40% of the training run, the blend shifts heavily toward high-density "reasoning" data, such as mathematics, code, and curated task-specific datasets.
Figure 1: The shift in data composition from the diversity-focused Phase 1 to the quality-focused Phase 2.

To find the optimal "recipe" without spending millions on full-scale runs, the researchers used downsampling. They prototyped various blends at a 1T token scale and used these insights to inform a massive 15T token run. They also employed a sophisticated quality classifier to tier web data into five levels, allowing them to surgically remove "noisy" data rather than just down-weighting it.

Key Results and Insights

The two-phase approach outperformed the "Natural Distribution" baseline by 17% and random ordering by 3.4% on average across all benchmarks. The shift to Phase 2 saw massive absolute gains in reasoning-heavy tasks: +14.6% in GSM8K (math) and +9.4% in coding benchmarks compared to continuing the Phase 1 blend.

Figure 5: Validation loss curve demonstrating the performance improvement (sharpening) when transitioning from Phase 1 to Phase 2.

Key Findings:

  • The 40% Rule: Dedicating the final 40% of the training duration to the high-quality Phase 2 blend yielded the best results.
  • Discarding the Tail: Completely removing low-quality web data—rather than just down-weighting it—actually improved model performance.
  • The Epoch "Sweet Spot": Repeating high-quality data is beneficial up to a point; roughly 6 epochs for high-quality web crawl and 8 epochs for math and task data are recommended.
  • Predictable Scalability: Data blends optimized on a small scale (1T tokens) generalize remarkably well to 15T tokens and larger model architectures (25B parameters).

Conclusion

This study demonstrates that a structured curriculum—starting with a diverse base and finishing with high-quality refinement—is superior to static data mixtures. While finding optimal blends requires initial prototyping compute, the resulting gains in model accuracy and reasoning capabilities are substantial. Future work may explore multi-phase curricula or the application of these strategies to alternative architectures like Mixture-of-Experts (MoE).

Summary updated

BibTeX
@misc{feng2024maximize,
  author = {Steven Feng and Shrimai Prabhumoye and Kezhi Kong and Dan Su and Mostofa Patwary and Mohammad Shoeybi and Bryan Catanzaro},
  title = {{Maximize Your Data's Potential: Enhancing LLM Accuracy with Two-Phase Pretraining}},
  year = {2024},
  eprint = {2412.15285},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.15285},
}
Figure