A Survey on Data Selection for Language Models

Alon Albalak, Yanai Elazar, Sang Michael Xie, Shayne Longpre, Nathan Lambert, Xinyi Wang, Niklas Muennighoff, Bairu Hou, Liangming Pan, Haewon Jeong, Colin Raffel, Shiyu Chang, Tatsunori Hashimoto, William Yang Wang

Abstract

A major factor in the recent success of large language models is the use of enormous and ever-growing text datasets for unsupervised pre-training. However, naively training a model on all available data may not be optimal (or feasible), as the quality of available text data can vary. Filtering out data can also decrease the carbon footprint and financial costs of training models by reducing the amount of training required. Data selection methods aim to determine which candidate data points to include in the training dataset and how to appropriately sample from the selected data points. This paper presents a comprehensive review of existing literature, providing a taxonomy of approaches and identifying promising avenues for future research.

Introduction: The "Data Diet" Challenge

As Large Language Models (LLMs) scale to trillions of tokens, the "more is better" philosophy is hitting a wall of diminishing returns and massive costs. The recent success of models like GPT-4 and Llama-3 relies on massive datasets scraped from the web, but the internet is a noisy place. Training naively on everything leads to several critical problems:

  • Inefficiency: Training on redundant or low-quality data wastes millions of dollars in compute.
  • Poor Performance: "Garbage in, garbage out"—noisy data can degrade a model's reasoning abilities.
  • Safety Risks: Unfiltered data often contains toxicity, bias, and personally identifiable information (PII).
  • Knowledge Concentration: Currently, the "secret sauce" of data cleaning is held by a few elite labs. This survey aims to democratize that knowledge by providing a unified framework for how data selection actually works.

The Data Selection Framework

The authors propose a unified conceptual framework where every data selection method consists of two parts: a Utility Function ($v(x)$), which assigns a score to a data point based on quality or relevance, and a Selection Mechanism, which determines how to use that score (e.g., thresholding or probabilistic sampling).

Overview of the data selection pipeline and objectives across different learning stages.

This framework applies across the entire AI lifecycle:

  • Pretraining: Moving from simple heuristics (removing short documents) to advanced Data Mixing (e.g., DoReMi), which uses proxy models to find the optimal ratio of books, code, and web text.
  • Deduplication: Using tools like MinHash to remove near-duplicates, which significantly reduces the model's tendency to "memorize" text verbatim.
  • Fine-tuning & Alignment: Selecting high-quality "textbook" data for instruction tuning or using reward models to filter preference data for RLHF.

Key Insights: Matching vs. Diversification

A critical distinction in data selection is between Distribution Matching and Distribution Diversification. While matching aims to align the training set with a specific target (like medical text or code), diversification ensures the model encounters a wide variety of concepts to prevent repetitive behavior.

Comparison between distribution matching (targeting specific data types) and distribution diversification (maximizing variety).

Other key insights from the survey include:

  • The "No Free Lunch" of Filtering: Every filter introduces bias. Removing "toxic" language can accidentally erase the voices of marginalized groups or degrade performance on sensitive topics like medical or legal discussions.
  • Deduplication is a "Free Lunch": Removing duplicates is one of the few interventions that consistently improves performance and reduces training time.
  • Semantic vs. Surface Filtering: The field is moving away from simple word counts (surface) toward using small "expert" models to judge the meaning and educational value of content (semantic).

Results and Future Directions

Empirical evidence highlights the power of strategic selection. Landmark findings show that training on 745x less data can still yield 98% of the performance on certain benchmarks if the data is perfectly selected. Furthermore, principled data mixing can speed up training by 2x or more by focusing the model's attention on the most informative domains early on.

Despite these gains, the authors identify several "noticeable holes" in current research:

  1. Scaling Down: Most research requires massive compute; we need "toy" settings to allow broader academic contribution.
  2. Better Metrics: We need "data-centric" metrics to evaluate dataset quality without the expense of training a full model.
  3. The Target Distribution: For general-purpose models, the "ideal" mix of domains (e.g., what percentage should be code?) remains an open question.
  4. Additive Selection: Future work should look at modifying data—such as using an LLM to rewrite messy web pages into clean "textbook" styles—rather than just removing it.

Summary updated

BibTeX
@article{albalak2024survey,
  author = {Alon Albalak and Yanai Elazar and Sang Michael Xie and Shayne Longpre and Nathan Lambert and Xinyi Wang and Niklas Muennighoff and Bairu Hou and Liangming Pan and Haewon Jeong and Colin Raffel and Shiyu Chang and Tatsunori Hashimoto and William Yang Wang},
  title = {{A Survey on Data Selection for Language Models}},
  journal = {Accepted by TMLR},
  year = {2024},
  url = {https://openreview.net/forum?id=XfHWcNTSHp},
}
Figure