LLM Pretraining Data Explained: What Does AI Learn From? | LLM Course #23
Where does an LLM's training text come from, and how is it cleaned? In Lecture 23 of the LLM Masterclass we look at web crawls like Common Crawl, filtering and quality classifiers, deduplication, data mixes, and why big models are trained on trillions of tokens. Then we build ChotuGPT's own small corpus: clean it, deduplicate it, split it into train and validation, and turn it into token ids. 💻 Code for this lecture (branch lecture-23): https://github.com/programmingline/chotugpt/tree/lecture-23 Lecture 23 of 32 — LLM Masterclass · Module 5: Training an LLM ⚠️ ChotuGPT is a simplified teaching model. Its corpus is a small synthetic diary written for this course (with junk mixed in on purpose); all ChotuGPT counts on screen are the script's real output. In this lecture: • Common Crawl: web pages collected since 2008, free to use; the December 2025 crawl alone has about 2.16 billion pages • Other sources: books, Wikipedia, scientific papers, code • Cleaning: strip HTML tags, drop scraps and symbol noise, keep wanted languages, quality classifiers • GPT-3's Common Crawl data: 45 TB of compressed plaintext before filtering, 570 GB after • Deduplication: one 61-word sentence repeated 60,000+ times in C4; dedup → memorised text 10× less often • Data mix: GPT-3 used 60% Common Crawl, 22% WebText2, 8% + 8% books, 3% Wikipedia • Token counts: GPT-3 300 billion, Llama 2 2 trillion, Llama 3 15+ trillion • ChotuGPT's corpus: 2,446 raw lines → 2,184 after cleaning and dedup • 90 / 10 train / validation split: 96,737 train tokens and 10,881 val tokens (3.14 chars per token) • Code: data/make_corpus.py and chotugpt/data.py (strip_tags, drop_short, is_noise, deduplicate, prepare) Chapters: 00:00 Lecture 22 quiz answer 00:14 Pretraining data 00:25 Where the text comes from 00:48 Cleaning and filtering 01:21 Half the work 01:28 Deduplication 01:57 Data mix and token counts 02:25 ChotuGPT's corpus 03:04 Train / validation split 03:34 make_corpus.py and data.py 04:07 Quiz 04:29 Recap & next lecture ✅ Lecture 22 quiz answer: B, random gibberish. Its weights are random, so every next token is close to a uniform guess. ❓ Quiz: Why do we remove duplicate text from training data? A) Repeats waste compute and make the model memorise B) To add more languages C) To make the files bigger. Comment your answer. I reveal it in Lecture 24! 👍 Like, subscribe and comment your quiz answer. ⏮ Previous: Lecture 22 — One forward pass, end to end ⏭ Next: Lecture 24 — The training loop Sources: Common Crawl, overview (https://commoncrawl.org/overview) and "December 2025 Crawl Archive Now Available" (2.16 billion pages, 364 TiB uncompressed). T. Brown et al., "Language Models are Few-Shot Learners", NeurIPS 2020 (GPT-3: section 2.2, Table 2.2, 300 billion training tokens). K. Lee et al., "Deduplicating Training Data Makes Language Models Better", ACL 2022 (arXiv 2107.06499). H. Touvron et al., "Llama 2: Open Foundation and Fine-Tuned Chat Models", 2023 (2 trillion tokens, up-sampling factual sources). Meta, "Introducing Meta Llama 3", April 2024 (over 15 trillion tokens). #LLM #CommonCrawl #MachineLearning…more
Where does an LLM's training text come from, and how is it cleaned? In Lecture 23 of the LLM Masterclass we look at web crawls like Common Crawl, filtering and quality classifiers, deduplication, data mixes, and why big models are trained on trillions of tokens. Then we build ChotuGPT's own small corpus: clean it, deduplicate it, split it into train and validation, and turn it into token ids. 💻 Code for this lecture (branch lecture-23): https://github.com/programmingline/chotugpt/tree/lecture-23 Lecture 23 of 32 — LLM Masterclass · Module 5: Training an LLM ⚠️ ChotuGPT is a simplified teaching model. Its corpus is a small synthetic diary written for this course (with junk mixed in on purpose); all ChotuGPT counts on screen are the script's real output. In this lecture: • Common Crawl: web pages collected since 2008, free to use; the December 2025 crawl alone has about 2.16 billion pages • Other sources: books, Wikipedia, scientific papers, code • Cleaning: strip HTML tags, drop scraps and symbol noise, keep wanted languages, quality classifiers • GPT-3's Common Crawl data: 45 TB of compressed plaintext before filtering, 570 GB after • Deduplication: one 61-word sentence repeated 60,000+ times in C4; dedup → memorised text 10× less often • Data mix: GPT-3 used 60% Common Crawl, 22% WebText2, 8% + 8% books, 3% Wikipedia • Token counts: GPT-3 300 billion, Llama 2 2 trillion, Llama 3 15+ trillion • ChotuGPT's corpus: 2,446 raw lines → 2,184 after cleaning and dedup • 90 / 10 train / validation split: 96,737 train tokens and 10,881 val tokens (3.14 chars per token) • Code: data/make_corpus.py and chotugpt/data.py (strip_tags, drop_short, is_noise, deduplicate, prepare) Chapters: 00:00 Lecture 22 quiz answer 00:14 Pretraining data 00:25 Where the text comes from 00:48 Cleaning and filtering 01:21 Half the work 01:28 Deduplication 01:57 Data mix and token counts 02:25 ChotuGPT's corpus 03:04 Train / validation split 03:34 make_corpus.py and data.py 04:07 Quiz 04:29 Recap & next lecture ✅ Lecture 22 quiz answer: B, random gibberish. Its weights are random, so every next token is close to a uniform guess. ❓ Quiz: Why do we remove duplicate text from training data? A) Repeats waste compute and make the model memorise B) To add more languages C) To make the files bigger. Comment your answer. I reveal it in Lecture 24! 👍 Like, subscribe and comment your quiz answer. ⏮ Previous: Lecture 22 — One forward pass, end to end ⏭ Next: Lecture 24 — The training loop Sources: Common Crawl, overview (https://commoncrawl.org/overview) and "December 2025 Crawl Archive Now Available" (2.16 billion pages, 364 TiB uncompressed). T. Brown et al., "Language Models are Few-Shot Learners", NeurIPS 2020 (GPT-3: section 2.2, Table 2.2, 300 billion training tokens). K. Lee et al., "Deduplicating Training Data Makes Language Models Better", ACL 2022 (arXiv 2107.06499). H. Touvron et al., "Llama 2: Open Foundation and Fine-Tuned Chat Models", 2023 (2 trillion tokens, up-sampling factual sources). Meta, "Introducing Meta Llama 3", April 2024 (over 15 trillion tokens). #LLM #CommonCrawl #MachineLearning