A Pretrainer's Guide to Training Data: Measuring the Effects of Data Age, Domain Coverage, Quality, & Toxicity

Shayne Longpre, Gregory Yauney, Emily Reif, Katherine Lee, Adam Roberts, Barret Zoph, Denny Zhou, Jason Wei, Kevin Robinson, David Mimno, Daphne Ippolito · OpenReview

Abstract

Pretraining is the preliminary and fundamental step in developing capable language models (LM). Despite this, pretraining data design is critically under-documented and often guided by empirically unsupported intuitions. To address this, we pretrain 28 1.5B parameter decoder-only models, training on data curated (1) at different times, (2) with varying toxicity and quality filters, and (3) with different domain compositions. First, we quantify the effect of pretraining data age. A temporal shift between evaluation data and pretraining data leads to performance degradation, which is not overcome by finetuning. Second, we explore the effect of quality and toxicity filters, showing a trade-off between performance on standard benchmarks and risk of toxic generations. Our findings indicate there does not exist a one-size-fits-all solution to filtering training data. We also find that the effects of different types of filtering are not predictable from text domain characteristics. Lastly, we empirically validate that the inclusion of heterogeneous data sources, like books and web, is broadly beneficial and warrants greater prioritization. These findings constitute the largest set of experiments to validate, quantify, and expose many undocumented intuitions about text pretraining, which we hope will help support more informed data-centric decisions in LM development.

Introduction

While the AI community often focuses on model architectures and parameter counts, the "secret sauce" of pretraining data remains largely undocumented. In the development of Large Language Models (LLMs), data curation is frequently treated as an artisanal craft guided by intuition rather than empirical evidence. Most major labs document what they did (e.g., "we filtered for quality") but rarely why or what the specific impact of those choices was. This "documentation debt" makes it difficult for researchers to understand the trade-offs inherent in data selection.

This study systematically evaluates 28 different 1.5B-parameter models to address three specific unknowns:

  1. Temporal Misalignment: The impact of the age of training data relative to evaluation tasks.
  2. The Filtering Paradox: The effects of "high quality" and "low toxicity" filters on model performance and safety.
  3. Domain Importance: The relative contribution of various data sources (Wikipedia, Books, Web, Code) to downstream performance.

Methodology

To investigate these factors, researchers conducted a massive controlled experiment, training 28 decoder-only models (1.5B parameters each) using the T5X codebase. The architecture was held constant while the training data was varied along three axes:

  • Time: Snapshots of the C4 dataset were created from 2013, 2016, 2019, and 2022.
  • Filters: Varying thresholds of quality classifiers (similar to PaLM) and toxicity classifiers (Jigsaw’s Perspective API) were applied.
  • Domains: Ablation studies were performed on The Pile, systematically excluding specific domains like PubMed, GitHub, or Wikipedia.
Overview of the experimental pipeline: selecting pretraining data, pretraining the model, and evaluating changes in performance across downstream tasks.

The primary training datasets were C4 and The Pile (an 800GB dataset with 22 diverse sources). Evaluation involved a battery of benchmarks including MRQA and UnifiedQA for general knowledge, RealToxicityPrompts for safety, and five datasets with temporal annotations to measure the impact of "stale" information.

Key Insights and Results

The Impact of Data Age

Models have a measurable "expiration date." Performance degrades significantly when there is a temporal gap between pretraining data and evaluation data. For the 1.5B parameter model, every year of misalignment resulted in a Temporal Degradation score of 0.41. Surprisingly, even extensive finetuning on newer data cannot fully compensate for a "stale" pretraining foundation.

The Quality and Toxicity Filtering Trade-off

Filtering for "high quality" (text resembling Wikipedia or Books) actually increases a model's propensity to generate toxic content. This "Quality Filter Trap" occurs because high-quality human writing, such as literature, often contains more profanity and complex adult themes than the "low-quality" gibberish or spam found on the web.

Analysis of toxicity and quality across different domains in The Pile and C4, illustrating how high-quality data often correlates with higher toxicity markers.

Conversely, aggressive toxicity filtering makes a model "safer" but significantly impairs its ability to identify toxicity and degrades its general reasoning abilities. Quality filtering improved performance on most QA tasks by 1–6%, despite reducing the total training data by over 10%. However, no single filter threshold worked best for all tasks; a filter beneficial for science tasks often hindered performance on social media data.

Domain Heterogeneity

For general-purpose models, diverse "Web" data and "Books" are the most valuable. Removing the "Common Crawl" domain from The Pile resulted in the largest average performance drop (-4.8 points), demonstrating that the "messy" web remains a vital source of world knowledge. While specialized domains like Code are important for specific tasks, their removal has a smaller impact on general QA compared to broad web data.

Conclusion and Future Work

This research highlights that pretraining data curation involves unavoidable trade-offs. While 1.5B parameters is a significant scale for a research study, future work should investigate if these effects—particularly temporal misalignment—scale with larger models. Additionally, as this study focused on English-language data, exploring these curation rules in multilingual contexts remains a critical next step, especially where definitions of "quality" and "toxicity" are more complex.

Summary updated

BibTeX
@inproceedings{longpre2024pretrainer,
  author = {Shayne Longpre and Gregory Yauney and Emily Reif and Katherine Lee and Adam Roberts and Barret Zoph and Denny Zhou and Jason Wei and Kevin Robinson and David Mimno and Daphne Ippolito},
  title = {{A Pretrainer's Guide to Training Data: Measuring the Effects of Data Age, Domain Coverage, Quality, \& Toxicity}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2024},
  url = {https://openreview.net/forum?id=qibS8qH6KC},
}
Figure