← All drillsLanguage Modeling from First Principles
What you'll be able to do- ✓Build a predictive-text engine from scratch — the next-word suggestions behind a phone keyboard
- ✓Count word n-grams and turn them into next-word probabilities with maximum likelihood
- ✓Generate text by sampling from your n-gram model
- ✓Fix the zero-probability problem with add-k (Laplace) smoothing
- ✓Measure a language model honestly with cross-entropy and perplexity
Build the autocomplete that finishes your sentences — the next-word predictor behind Gboard, Apple QuickType, and SwiftKey — from word counts up, with no neural network.
⌁ The original language model — n-gram predictors power phone-keyboard suggestions, search-query completion, and spelling correction, and they are the statistical foundation every neural LLM is built on.
Start this internshipCreate an account to unlock the 8 sections, the workbench, and AskThili.
BeginSections
1. Language Modeling from First Principles — a Predictive-Text Engine
🔒 locked2. Lesson 1 - What a language model is
🔒 locked3. Lesson 2 - Count the n-grams
🔒 locked4. Lesson 3 - Counts to probabilities (MLE)
🔒 locked5. Lesson 4 - Make it write
🔒 locked6. Lesson 5 - The zero-probability problem
🔒 locked7. Lesson 6 - How good is it? Cross-entropy & perplexity
🔒 locked8. Lesson 7 - Ship your predictive-text engine
🔒 lockedDig deeper
📄Prediction and Entropy of Printed English (Shannon, 1951) — the origin of language modeling
paper🔗Speech and Language Processing (Jurafsky & Martin), Ch. 3 — N-gram Language Models
articlePart of these learning paths
I'm a developer and I want to fine-tune small LLMs for my own use case
View path →