Language Models Improve When Pretraining Data Matches Target Tasks

David Mizrahi, Anders Boesen Lindbo Larsen, Jesse Allardice, Suzie Petryk, Yuri Gorokhov, Jeffrey Li, Alex Fang, Josh Gardner, Tom Gunter, Afshin DehghanarXiv 2025

Abstract

Every data selection method inherently has a target. In practice, these targets often emerge implicitly through benchmark-driven iteration: researchers develop selection strategies, train models, measure benchmark performance, then refine accordingly. This raises a natural question: what happens when we make this optimization explicit? To explore this, we propose benchmark-targeted ranking (BETR), a simple method that selects pretraining documents based on similarity to benchmark training examples. BETR embeds benchmark examples and a sample of pretraining documents in a shared space, scores this sample by similarity to benchmarks, then trains a lightweight classifier to predict these scores for the full corpus. We compare data selection methods by training over 500 models spanning $10^{19}$ to $10^{22}$ FLOPs and fitting scaling laws to them. From this, we find that simply aligning pretraining data to evaluation benchmarks using BETR achieves a 2.1x compute multiplier over DCLM-Baseline (4.7x over unfiltered data) and improves performance on 9 out of 10 tasks across all scales. BETR also generalizes well: when targeting a diverse set of benchmarks disjoint from our evaluation suite, it still matches or outperforms baselines. Our scaling analysis further reveals a clear trend: larger models require less aggressive filtering. Overall, our findings show that directly matching pretraining data to target tasks precisely shapes model capabilities and highlight that optimal selection strategies must adapt to model scale.

Introduction

In the development of Large Language Models (LLMs), "data quality" is a central but elusive concept. Current practices often rely on "benchmark-driven iteration," where researchers heuristically refine data selection strategies based on model performance on downstream tasks. This process is computationally expensive and relies heavily on human intuition.

We argue that data quality is fundamentally task-dependent. A document highly valuable for mathematical reasoning might be irrelevant for creative writing. By making the optimization for target tasks explicit, we can automate and improve data selection. We introduce Benchmark-Targeted Ranking (BETR), a scalable method that selects pretraining data based on its similarity to the tasks of interest.

Benchmark-Targeted Ranking (BETR)

The BETR pipeline consists of three main stages designed to align a massive pretraining corpus with specific evaluation benchmarks:

  1. Embedding: Examples from target benchmarks (e.g., MMLU, HellaSwag) and a small representative sample (~0.1%) of the pretraining pool are embedded into a shared vector space using a high-quality embedding model.
  2. Scoring: Pretraining documents in the sample are scored based on their similarity to the benchmark examples. We found that "max aggregation"—using the similarity to the single most similar benchmark example—is the most effective scoring metric.
  3. Scaling to the Full Corpus: To avoid the prohibitive cost of embedding billions of documents, we train a lightweight FastText classifier on the (document, score) pairs from the sample. This classifier is then applied to the entire corpus to predict similarity scores for all documents.
The three-step Benchmark-Targeted Ranking (BETR) pipeline.

Experimental Setup

To rigorously evaluate data selection methods, we trained over 500 models across a wide range of compute scales ($10^{19}$ to $10^{22}$ FLOPs). This allowed us to fit scaling laws and calculate "compute multipliers"—the factor by which training compute can be reduced while maintaining the same performance as a baseline.

We utilized two primary data sources: DCLM-RefinedWeb (24T tokens) and Nemotron-CC (6.3T tokens). Evaluation was conducted on two sets of benchmarks: CORE (10 standard tasks like MMLU and ARC) and NONCORE (39 diverse benchmarks used to test generalization).

Results and Discussion

Our analysis reveals that explicitly matching pretraining data to target tasks yields significant efficiency gains.

Efficiency and Performance

BETR achieved a 2.1x compute multiplier over the state-of-the-art DCLM-Baseline and up to a 4.7x multiplier compared to unfiltered data. This means a model trained with BETR can reach the same performance as a baseline using less than half the compute. Furthermore, BETR improved performance on 9 out of 10 CORE tasks across all tested scales.

Performance of BETR across different compute scales and data pools.

The Scale-Dependency of Filtering

A key finding is that the optimal filtering intensity depends on model size. Smaller models benefit from aggressive filtering (e.g., keeping only the top 3% of data), whereas larger models perform better with more diverse data (e.g., top 30%). Larger models appear more capable of extracting useful signals from noisier, less targeted data.

Generalization vs. Overfitting

While optimizing specifically for CORE benchmarks led to record-high scores on those tasks, it also resulted in "rank reversal" on the 39 NONCORE tasks. This highlights a form of Goodhart’s Law: when a measure becomes a target, it ceases to be a good measure. However, by targeting a broad and diverse set of benchmarks (the "Target-Noncore" strategy), we produced models that generalized well across both CORE and NONCORE suites, matching or exceeding the performance of general-purpose baselines.

Conclusion and Future Work

BETR demonstrates that aligning pretraining data with target tasks is a powerful lever for improving model efficiency and capability. Our results suggest that "universal quality" is a myth and that data selection must be tailored to both the target application and the model scale.

Future work should explore the application of BETR to multilingual and code datasets. Additionally, while FastText proved surprisingly effective, further research is needed to understand why simpler classifiers often outperform more complex neural models in data selection tasks. Finally, investigating how these pretraining gains translate through supervised fine-tuning and reinforcement learning from human feedback remains an important next step.

Summary updated

BibTeX
@misc{mizrahi2025language,
  author = {David Mizrahi and Anders Boesen Lindbo Larsen and Jesse Allardice and Suzie Petryk and Yuri Gorokhov and Jeffrey Li and Alex Fang and Josh Gardner and Tom Gunter and Afshin Dehghan},
  title = {{Language Models Improve When Pretraining Data Matches Target Tasks}},
  year = {2025},
  eprint = {2507.12466},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2507.12466},
}
Figure