Data Mixture

Pretraining Data Mixture and Curation is the strategic selection and weighting of training data domains that critically determines the capabilities, biases, and performance characteristics of large language models — where the composition of web text, books, code, scientific papers, dialogue, and multilingual content in the training mixture has a larger impact on model quality than architecture differences, making data curation one of the most important and closely guarded aspects of frontier LLM development.

Why Data Mixture Matters

  • Same architecture + same compute + different data mixture → dramatically different models.
  • Code data improves reasoning (even for non-code tasks).
  • Math data enables quantitative reasoning.
  • Book data improves long-range coherence.
  • Web data provides breadth but includes noise.

Data Source Characteristics

SourceVolumeQualityWhat It Teaches
Common Crawl (web)100T+ tokensLow-mediumBreadth, world knowledge
Wikipedia~4B tokensHighFactual knowledge, structure
Books (BookCorpus, etc.)~5B tokensHighLong-form coherence, reasoning
GitHub/StackOverflow~100B tokensMedium-highCode, structured thinking
ArXiv/PubMed~30B tokensHighScientific reasoning
Reddit/forums~50B tokensMediumDialogue, opinions
Curated instruction data~1B tokensVery highTask following

Known Model Mixtures

ModelWebCodeBooksWikiOther
Llama 167%4.5%4.5%4.5%19.5% (CC-cleaned)
Llama 2~80%~10%~4%~3%~3%
Llama 3~50%~25%~10%~5%~10%
GPT-360%0%16%3%21%
Phi-1.50%0%0%0%100% synthetic

Data Filtering Pipeline

[Raw Common Crawl: ~300TB compressed]
     ↓
[Language identification] → Keep target languages
     ↓
[URL and domain filtering] → Remove known low-quality sites
     ↓
[Deduplication] → MinHash + exact dedup → removes 40-60%
     ↓
[Quality classifier] → FastText trained on curated vs. random → remove bottom 50%
     ↓
[Content filtering] → Remove toxic, PII, CSAM
     ↓
[Domain classification] → Tag and weight by domain
     ↓
[Final mixture: ~5-15T high-quality tokens]

Data Mixing Strategies

StrategyApproachUsed By
ProportionalSample proportional to domain sizeEarly models
Upsampled qualityOversample high-quality domains (Wikipedia, books)GPT-3, Llama 1
DoReMiOptimize domain weights via proxy modelGoogle
Data mixing lawsPredict performance from mixture via scaling lawsResearch frontier
CurriculumStart with easy/clean data, add harder data laterSome proprietary models

Deduplication Impact

  • Training on duplicated data: Memorization increases, generalization decreases.
  • Exact dedup: Remove identical documents → easy, removes ~20%.
  • Near-dedup (MinHash): Remove ~similar documents → removes additional 20-40%.
  • Effect: Deduplication equivalent to 2-3× more unique training data.

Data Quality vs. Quantity

ApproachDataModelResult
Llama 2 (70B)2T tokens (web-heavy)70BStrong general
Phi-2 (2.7B)1.4T tokens (curated + synthetic)2.7B≈ Llama 2 7B quality
FineWeb-EduWeb filtered for educational contentVariousSignificant improvement

Pretraining data curation is the most impactful yet least understood lever in LLM development — while architectural innovations yield marginal gains, the choice of which data to train on and in what proportions fundamentally determines a model's capabilities, with frontier labs investing millions of dollars and years of effort into data pipelines that are among their most carefully protected competitive advantages.

Take data mixture further

Ask the copilot about this term, or have our engineers assess it against your process.