Everwhy Open Everwhy
Computing

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.

Open in Everwhy Continue on the web

Go deeper, level by level

  1. Language models, n-grams and perplexity: What a language model is: the chain rule and n-grams, Sparsity and smoothing, Perplexity and cross-entropy
  2. Word vectors and neural foundations: Word embeddings and the distributional hypothesis, Neural networks and backpropagation, revisited, Feed-forward neural language models
  3. Sequence models and their limits: Recurrent neural networks, LSTMs and GRUs, Encoder–decoder models and the first attention
  4. Attention and the transformer: Scaled dot-product self-attention, Multi-head attention and positional information, The transformer block
  5. Tokenization and pretraining: Tokenization: BPE, WordPiece, unigram and bytes, Pretraining objectives, Pretraining data
  6. Scaling laws and training at scale: Scaling laws, Compute-optimal training and emergence, Training at scale
  7. Adapting models: fine-tuning, instructions and preferences: Fine-tuning and parameter-efficient methods, In-context learning and instruction tuning, Learning from human preferences
  8. Decoding and evaluation: Decoding and sampling, Evaluating language models, Benchmark pitfalls
  9. Retrieval, tools and efficiency: Retrieval-augmented generation, Tool use and agents, Quantization, distillation and mixture-of-experts
  10. 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.