AI & ML
Language Modeling and LLMs
Part of Language, level 5. About 29 hours of study across the topics below.
1Modeling
- Tokens and TokenizationText into pieces: BPE intuition, vocabularies, and boundary consequences. 1–2 h
- Next-Token PredictionThe task that scales: context in, distribution over next tokens out. 1–2 h
- Autoregressive FactorizationJoint probability as a product of nexts: the chain rule behind generation. 1–2 h
- The Language-Modeling ObjectiveCross-entropy on text: the loss that trains next-token predictors, plus perplexity. 1–2 h
- Context and ConditioningWhat the model gets to see: context windows as the conditioning set. 1–2 h
- N-gram Language Models and SmoothingCounting-based next-word prediction, the sparsity problem, and smoothing that reserves mass for unseen events. 1–2 h
- PerplexityThe standard intrinsic measure of a language model: exponentiated average negative log-likelihood per token. 1–2 h
- Subword Tokenization: Byte-Pair EncodingLearning a vocabulary by merging frequent symbol pairs: the tokenizer most LLMs use and its side effects. 1–2 h
2Decoding
- Greedy DecodingAlways the argmax: the virtues and degeneracies of never gambling. 1–2 h
- TemperatureSharpen or flatten: the dial that reshapes sampling randomness. 1–2 h
- Top-k and Top-p SamplingPruning the tail: truncation rules that keep sampling honest and lively. 1–2 h
- Repetition and StructureDegeneration and its tethers: repetition penalties and structured generation. 1–2 h
- Structured Output and Constrained DecodingForcing generations to follow a grammar or schema by masking invalid tokens at each step. 1–2 h
3Scale
- Scaling IntuitionLoss falls with scale: what grows, what improves, and the caveats. 1–2 h
- PretrainingSelf-supervision at scale: data, objective, and what pretraining does and does not teach. 1–2 h
- Context WindowsLong context, real costs: memory, attention growth, and using the window well. 1–2 h
- Scaling Laws and Compute-Optimal TrainingLoss as a power law in parameters, data, and compute; how to split a compute budget between model size and tokens. 1–2 h
- Long-Context ModelingExtending context windows through position interpolation and efficient attention, and the lost-in-the-middle problem. 1–2 h
- Pretraining Data: Sourcing, Filtering, and MixturesWhere pretraining text comes from and how deduplication, quality filtering, and domain mixture shape the model. 1–2 h
4Use
5Post Training
- Supervised Fine-TuningInstruction data shapes behavior: SFT as fine-tuning for following directions. 1–2 h
- Preference OptimizationLearning from comparisons: reward models, RLHF, and the DPO idea. 1–2 h
- Alignment ConceptsHelpful, honest, harmless: what alignment asks for and where it provably strains. 1–2 h
- Reward Models from Human PreferencesLearning a scalar score from pairwise human comparisons with a Bradley-Terry loss. 1–2 h
- Synthetic Data and AI FeedbackModels generating training data and critiques for other models, and the risks of feedback loops. 1–2 h
- RLHF: Policy Optimization with a KL PenaltyOptimising a language model against a reward model while a KL term keeps it close to the reference model. 1–2 h
- Direct Preference OptimizationSkipping the explicit reward model: a classification loss on preference pairs derived from the KL-regularised objective. 1–2 h
- Reasoning Models and Test-Time ComputeSpending more computation at inference, through long reasoning traces, sampling and verification, and RL on verifiable rewards. 1–2 h
