How does a system trained only to predict the next word end up answering questions?
Large Language Models · about 16 minutes a level
A master's-level course on how large language models work and how to use them well. You start from language modelling with n-grams and perplexity, word embeddings and a recap of neural networks, then study recurrent models and why attention replaced them, the transformer in full mathematical detail, tokenization, pretraining objectives and scaling laws, fine-tuning, instruction tuning and preference-based training, decoding and sampling, evaluation and its pitfalls, retrieval-augmented generation and tool use, efficiency methods, and the limitations, risks and responsible use of these systems.
Go deeper, level by level
- Language models, n-grams and perplexity: What a language model is: the chain rule and n-grams, Sparsity and smoothing, Perplexity and cross-entropy
- Word vectors and neural foundations: Word embeddings and the distributional hypothesis, Neural networks and backpropagation, revisited, Feed-forward neural language models
- Sequence models and their limits: Recurrent neural networks, LSTMs and GRUs, Encoder–decoder models and the first attention
- Attention and the transformer: Scaled dot-product self-attention, Multi-head attention and positional information, The transformer block
- Tokenization and pretraining: Tokenization: BPE, WordPiece, unigram and bytes, Pretraining objectives, Pretraining data
- Scaling laws and training at scale: Scaling laws, Compute-optimal training and emergence, Training at scale
- Adapting models: fine-tuning, instructions and preferences: Fine-tuning and parameter-efficient methods, In-context learning and instruction tuning, Learning from human preferences
- Decoding and evaluation: Decoding and sampling, Evaluating language models, Benchmark pitfalls
- Retrieval, tools and efficiency: Retrieval-augmented generation, Tool use and agents, Quantization, distillation and mixture-of-experts
- Limitations and responsible use: Hallucination, factuality and calibration, Bias, memorisation and privacy, Responsible use and open questions
Every lesson shows its sources and how sure we are, and is checked by Everwhy.