Not All Tokens Are What You Need for Pretraining

Zhenghao Lin, Zhibin Gou, Yeyun Gong, Xiao Liu, yelong shen, Ruochen Xu, Chen Lin, Yujiu Yang, Jian Jiao, Nan Duan, Weizhu Chen

TL;DR

RHO-1 introduces Selective Language Modeling (SLM), a training objective that identifies and focuses on the most "useful" tokens in a dataset rather than treating all tokens equally. By using a reference model to filter out noise and prioritize high-impact data, RHO-1 achieves state-of-the-art performance in mathematics and general reasoning while being up to 10x more data-efficient than traditional models.

What Problem Does This Paper Address?

Standard Large Language Model (LLM) pretraining relies on Causal Language Modeling (CLM), where the model is trained to predict every single "next token" in a massive corpus. The underlying assumption is that every token is equally important for learning.

The authors challenge this norm, arguing that web-scale corpora are riddled with "noisy" tokens—gibberish, boilerplate code, or highly ambiguous text—that provide little signal or even actively confuse the model. Furthermore, many tokens are "easy" (already learned) or "hard" (inherently unpredictable). Applying a uniform loss to everything leads to computational waste and suboptimal performance. The gap they address is the lack of a fine-grained, token-level selection mechanism during pretraining.

Methods: Selective Language Modeling (SLM)

The researchers propose Selective Language Modeling (SLM), a three-step pipeline designed to focus the model's attention on the most valuable data.

Comparison of Causal Language Modeling and Selective Language Modeling
  1. Reference Model Training: They first train a small "Reference Model" (RM) on a curated, high-quality dataset that represents the desired output distribution (e.g., high-quality math papers or clean web text).
  2. Token Scoring: This RM is used to score every token in a much larger, noisier pretraining corpus.
  3. Selective Training: The target language model is trained only on tokens that show a high "excess loss." This is defined as the difference between the target model's current loss and the reference model's loss.

Essentially, the model focuses on tokens that the reference model deems "important" but that the target model hasn't mastered yet. This allows the model to ignore both "already learned" tokens and "unlearnable noise."

Datasets

  • Pretraining Corpora: The authors used OpenWebMath (14B unique tokens) for math-specific training and a mix of SlimPajama, StarCoderData, and OpenWebMath (totaling 80B tokens) for general-purpose training.
  • Reference Data: To train the reference models, they used a 0.5B token blend of synthetic and curated math data, and a 1.9B token general-domain corpus (including Tulu-v2 and OpenHermes-2.5).
  • Evaluation Benchmarks: A suite of 15 tasks including GSM8k, MATH, SVAMP, MMLU-STEM, SAT, HumanEval (code), and various general reasoning tasks like Arc-Challenge and HellaSwag.

Key Insights and Ideas

  • The Four Categories of Tokens: Through initial analysis, the authors categorized tokens based on their loss trajectories:
  • H→L (High to Low): Tokens that show significant learning (only ~26% of the corpus).
  • L→L (Low to Low): "Easy" tokens already known by the model (~51%).
  • H→H (High to High): "Hard" or noisy tokens that resist convergence (~11%).
  • L→H (Low to High): Tokens where the model actually gets worse over time (~12%).
  • Efficiency is King: SLM allows a model to reach the same performance level as a standard baseline while using 5x to 10x fewer tokens.
  • Noise Filtering: SLM naturally ignores "unintelligible gibberish" and "chaotic corpora" (like timetables or random symbols) because the reference model assigns them low utility scores.
  • Excess Loss vs. Raw Loss: Training on "excess loss" is superior to training on raw loss because it prevents the model from wasting capacity on noisy tokens that are "hard" but ultimately useless for downstream tasks.

Key Results

By selectively training on useful tokens, RHO-1 demonstrates massive efficiency and performance gains across different model scales.

Average few-shot accuracy on 1B and 7B language models showing RHO-1's efficiency
  • State-of-the-Art Math Performance: RHO-1-7B achieved 51.8% on the MATH dataset after fine-tuning. Remarkably, it matched the performance of DeepSeekMath-7B while using only 3% of the pretraining tokens (15B vs 500B).
  • Rapid Convergence: In math tasks, RHO-1 achieved the baseline's final accuracy up to 10x faster (for 1B models) and 5x faster (for 7B models).
  • General Domain Gains: When trained on 80B general tokens, RHO-1 saw an average 6.8% improvement across 15 diverse benchmarks, with gains exceeding 10% in specialized areas like code and math.
  • 1B Model Breakthrough: RHO-1-1B is the first 1B-parameter model to exceed 40% accuracy on the MATH dataset (reaching 40.6%), nearing the performance of early GPT-4 versions.

Limitations and Future Work

  • Reference Model Dependency: The effectiveness of SLM depends heavily on the quality of the reference model and its training data. If the reference data is biased, the target model will inherit those biases.
  • Scalability: While the authors tested up to 7B parameters, they acknowledge that budget constraints prevented testing on "very large" models (e.g., 70B+). They hypothesize that larger models might naturally develop some of this "inductive bias," but SLM could still provide efficiency gains.
  • Loss of Generalization: Training exclusively on selected tokens causes the loss on unselected tokens to rise. While no negative impact on downstream tasks was found, the long-term effects on "world knowledge" outside the selection criteria require more study.
  • Future Directions: The team suggests exploring self-referencing (where a model scores its own data for the next stage of training) and applying SLM to multimodal data (images/video), which typically has a much higher noise-to-information ratio than text.

Summary updated

BibTeX
@inproceedings{lin2024not,
  author = {Zhenghao Lin and Zhibin Gou and Yeyun Gong and Xiao Liu and yelong shen and Ruochen Xu and Chen Lin and Yujiu Yang and Jian Jiao and Nan Duan and Weizhu Chen},
  title = {{Not All Tokens Are What You Need for Pretraining}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=0NMzBwqaAJ},
}
Figure