Data Sourcing & Curation

Layer 1 · Intuition

Data Sourcing & Curation

Every capability an LLM has traces back to some document it read. Where those documents come from is most of the real engineering work.

6 min read40 XP

Listen to this lesson

Podcast-style walkthrough · ~6 min

No recording yet · generated on first play

Web crawl (filtered)CommonCrawl and similar, heavily cleaned
CodeGitHub and similar repositories
Books & long-formhigher quality, coherent long documents
Reference/academicWikipedia, papers, structured knowledge
Synthetic/curatedmodel-generated or hand-built, small but potent
A rough, illustrative token mixture for a modern pretraining corpus — exact ratios are closely-guarded and vary by lab.

"Trained on the internet" is the popular shorthand, and it's misleadingly casual — the raw internet is mostly spam, boilerplate, duplicated content, and low-quality text, and feeding it to a model unfiltered produces a measurably worse model than feeding it a smaller, carefully cleaned subset. Data curation is not a cleanup step tacked onto pretraining; it is one of the two or three highest-leverage levers a lab has, alongside model architecture and compute budget.

Where the raw text comes from

  • CommonCrawl — a public, continuously updated snapshot of the web, petabytes of raw HTML. The starting point for nearly every large pretraining corpus, and also the source of nearly all its garbage.
  • Code repositories — GitHub and similar sources. Including code in the mixture measurably improves a model's structured reasoning even on tasks that have nothing to do with programming.
  • Books and long-form text — coherent, well-edited, and long — a different distribution from short web pages, valuable for teaching sustained argument and narrative structure.
  • Reference and academic sources — Wikipedia, papers, textbooks. Dense in verified facts relative to their length, though a tiny slice of total tokens.
  • Synthetic data — text generated by another model, deliberately, to fill a gap the natural web doesn't cover well (e.g. clean step-by-step math reasoning).

The core problem: quantity and quality trade off, constantly

CommonCrawl alone contains many trillions of tokens — more raw text than any model needs. The bottleneck was never *volume*; it has always been *how much of that volume is worth learning from*. A page that's mostly navigation menus, a spam farm auto-generating thousands of near-identical pages, a forum thread that's 90% quoted replies — none of it is 'wrong' exactly, but training on it in proportion to its raw frequency wastes compute on tokens that teach the model very little, or actively teach it bad habits (mimicking SEO spam patterns, for instance).

  1. Raw crawl

    petabytes of HTML, mostly noise

  2. Extract & clean

    strip boilerplate, keep readable text

  3. Filter for quality

    heuristics + trained classifiers

  4. Deduplicate

    remove exact and near-duplicate text

  5. Decontaminate

    remove benchmark test data

  6. Mix by domain

    weight web/code/books deliberately

The pipeline that turns 'the internet' into a pretraining-ready corpus — this whole star is about the middle four steps.

Licensing and provenance, increasingly load-bearing

Beyond quality, labs increasingly have to answer *where did this text legally come from* — copyright litigation, licensing agreements with publishers, and opt-out mechanisms (like robots.txt-style crawler exclusions) all shape what a corpus can legally contain. This used to be an afterthought; for any lab shipping a commercial product today, it is a first-class constraint on the data pipeline, not a footnote.

Check your understanding

4 questions · answer all to submit

  1. 1.Why is 'trained on the internet' a misleading description of how modern pretraining data is actually assembled?

  2. 2.Why does including code in a pretraining mixture improve a model's performance even on tasks unrelated to programming?

  3. 3.Why can training on unfiltered, duplicate-heavy web text actively hurt a model rather than just wasting some compute?

  4. 4.Why has data licensing and provenance become a first-class constraint on pretraining pipelines rather than an afterthought?