Reference
Concepts
All chapters
1–10 of 219 concepts
Choose a chapter to revise its ideas, or search for a concept.
Chapter 1
What Is Artificial Intelligence?
- AI WintersMust know
AI winters were periods when inflated expectations collided with limited results, and funding and interest in AI collapsed for years.
Understand - Expert SystemsMust know
Expert systems captured a human specialist's knowledge as hundreds or thousands of if–then rules, and were AI's first big commercial success.
Understand - From Rules to LearningMust know
Traditional programs turn rules and inputs into answers; machine learning turns inputs and answers into the rules — learning the knowledge from examples instead of having it written in.
Know well - Logic and RulesMust know
Rule-based AI stores knowledge as if–then rules and derives conclusions by chaining them together, forward from facts or backward from goals.
Understand - SearchMust know
Search solves a problem by exploring sequences of possible actions from a start state until one reaches the goal — and a good heuristic decides which possibilities to explore first.
Know well - Symbolic AIMust know
Symbolic AI represents knowledge as explicit symbols and rules written by people, and produces intelligent behaviour by manipulating them — through logic and search.
Know well - The Knowledge-Acquisition BottleneckMust know
The knowledge-acquisition bottleneck is the discovery that the hardest part of rule-based AI is getting the knowledge in: much of what experts know is tacit, full of exceptions, and too vast to write down.
Know well - The Turing TestMust know
The Turing test replaces the vague question 'Can machines think?' with a concrete one: can a machine's conversation be told apart from a human's?
Understand - Knowledge RepresentationShould know
Knowledge representation is the problem of writing down what a system knows — objects, categories, relations, defaults — in a form a machine can reason with.
Understand - PlanningShould know
Planning means finding a sequence of actions that turns the current situation into a goal situation, using a model of what each action requires and changes.
Understand
Chapter 2
The Math Toolkit
- Conditional Probability and Bayes' TheoremMust know
Conditional probability asks how likely something is given what you already know, and Bayes' theorem tells you how to flip it — from P(evidence | cause) to P(cause | evidence).
Know well - Cross-Entropy LossMust know
Cross-entropy loss is the negative log of the probability a model assigned to the correct answer — near zero when the model is confidently right, large when it is confidently wrong.
Implement - Derivatives and GradientsMust know
A derivative measures how much a function's output changes when you nudge its input, and the gradient collects those rates for every input at once — pointing in the direction of steepest increase.
Know well - Dot ProductMust know
The dot product multiplies two vectors entry by entry and adds the results, giving one number that is large when the vectors point the same way.
Implement - EntropyMust know
Entropy measures how uncertain a distribution is — the average surprise of its outcomes — and it sets the lower limit on how compactly you can encode them.
Know well - Expected Value and VarianceMust know
The expected value is the probability-weighted average outcome, and the variance measures how far outcomes typically spread around it.
Know well - Gradient DescentMust know
Gradient descent minimizes a loss by repeatedly nudging every parameter a small step in the direction that decreases the loss fastest — the negative gradient.
Implement - KL DivergenceMust know
KL divergence measures how much one probability distribution differs from another — the extra surprise you pay for using the wrong distribution.
Understand - Loss FunctionsMust know
A loss function turns 'how wrong is the model?' into a single number, so that learning becomes the problem of making that number small.
Know well - Matrix MultiplicationMust know
Multiplying a vector by a matrix transforms it — every output number is a dot product of one matrix row with the input — and that is exactly what a neural-network layer does.
Implement - Momentum and AdamMust know
Momentum smooths gradient steps by keeping a running average of past gradients, and Adam adds a per-parameter step size based on how large each parameter's gradients have been.
Understand - PerplexityMust know
Perplexity is the exponential of the average cross-entropy per token — roughly, the number of options a language model is effectively choosing between at each step.
Know well - Probability and DistributionsMust know
A probability distribution assigns a likelihood to every possible outcome — and nearly every modern model's output is a distribution rather than a single answer.
Know well - Probability of SequencesMust know
The probability of a whole sequence equals the product of each element's probability given everything before it — the identity that turns 'model language' into 'predict the next token'.
Know well - Sampling and UncertaintyMust know
Every measured number — an accuracy, a benchmark score, a loss — is computed from a sample, so it carries uncertainty, and a difference smaller than that uncertainty isn't evidence of anything.
Understand - SoftmaxMust know
Softmax turns any list of scores into a probability distribution — positive numbers that sum to 1 — giving exponentially more weight to larger scores.
Implement - Stochastic Gradient Descent (SGD)Must know
Stochastic gradient descent estimates the gradient from a small random batch of examples instead of the whole dataset, trading a little noise for enormous speed.
Know well - Tensors and ShapesMust know
In deep learning a tensor is just an n-dimensional array of numbers, and keeping track of its shape — batch × sequence × features — is most of the practical work of reading and writing models.
Know well - The Chain RuleMust know
The chain rule says the rate of change through a chain of functions is the product of the rates of change of each link — which is exactly how gradients flow backward through the layers of a network.
Know well - VectorsMust know
A vector is an ordered list of numbers, and in machine learning it is how every object — a house, a word, an image — becomes something a model can compute with.
Know well
Chapter 3
Machine Learning
- Data LeakageMust know
Data leakage is when training or evaluation data contains information that won't be available when the model is actually used — making results look far better than they really are.
Know well - Distribution ShiftMust know
Distribution shift is when the data a model meets in use differs from the data it was trained on, so its measured performance no longer applies.
Understand - Evaluation Metrics for ClassifiersMust know
Accuracy alone can mislead; precision (how many flagged items were right), recall (how many true items were caught) and the confusion matrix show what kind of mistakes a classifier makes.
Know well - Features, Labels and TasksMust know
A supervised learning problem is a table: each row is an example described by features, and the label is what the model must predict — a category (classification) or a number (regression).
Know well - Generalization, Overfitting and UnderfittingMust know
The goal of learning is generalization — good performance on data the model has never seen — and a model that memorizes its training data (overfits) or is too simple to capture the pattern (underfits) fails at it.
Know well - Hand-Crafted Features vs Learned FeaturesMust know
Classical ML learns only the final mapping from features to labels — people design the features — while deep learning learns the features too, directly from raw data.
Know well - Linear RegressionMust know
Linear regression predicts a number as a weighted sum of the features plus a constant, choosing the weights that minimize the average squared error on the training data.
Implement - Logistic RegressionMust know
Logistic regression is a linear classifier: it computes a weighted sum of the features and squashes it through a sigmoid to get a probability, trained by minimizing cross-entropy.
Implement - RegularizationMust know
Regularization is anything that discourages a model from fitting the training data too closely — most commonly a penalty on large weights — so that it generalizes better.
Know well - Supervised, Unsupervised and Self-Supervised LearningMust know
Learning paradigms differ in where the training signal comes from: human-provided labels (supervised), structure in the data alone (unsupervised), or labels manufactured from the data itself (self-supervised).
Know well - Decision Trees and Random ForestsShould know
A decision tree predicts by asking a sequence of yes/no questions about the features; a random forest averages many randomized trees to get a much more accurate and stable model.
Understand - k-Means ClusteringShould know
k-means groups unlabelled points into k clusters by alternating two steps: assign each point to its nearest centre, then move each centre to the mean of its points.
Know well - Naive BayesShould know
Naive Bayes classifies by applying Bayes' theorem with the simplifying ('naive') assumption that features are independent given the class — crude, but fast and often surprisingly effective for text.
Understand - Principal Component Analysis (PCA)Should know
PCA finds the few directions along which data varies the most, so high-dimensional data can be summarized, compressed or plotted with little loss.
Understand - Support Vector MachinesShould know
A support vector machine chooses the separating boundary with the widest possible margin to the nearest points, and with the kernel trick it can draw curved boundaries by implicitly working in a higher-dimensional feature space.
Understand
Chapter 4
Neural Networks
- Activation FunctionsMust know
An activation function is the nonlinearity applied after each neuron's weighted sum; without it, any stack of layers would collapse into a single linear map.
Know well - BackpropagationMust know
Backpropagation computes how much every weight in a network contributed to the error, by passing the error backward from the output layer by layer using the chain rule.
Implement - Computational Graphs and AutodiffMust know
A computational graph records every elementary operation of a calculation, so that software can compute exact derivatives of the output with respect to every input automatically.
Know well - From MLPs to Transformers: The Architecture StoryMust know
Neural network architectures evolved by building the structure of the data into the network — convolutions for images, recurrence for sequences — until attention offered a more general way to connect everything.
Understand - Multilayer Perceptron (MLP)Must know
A multilayer perceptron stacks layers of neurons — input, one or more hidden layers, output — so that each layer builds new features out of the previous layer's outputs.
Know well - Representation LearningMust know
Representation learning means the network learns its own features: each layer transforms the data into a new representation, from simple patterns in early layers to abstract concepts in later ones.
Know well - The Artificial NeuronMust know
An artificial neuron computes a weighted sum of its inputs, adds a bias, and passes the result through a nonlinear activation function — a dot product plus a bend.
Implement - The Forward PassMust know
The forward pass is computing a network's output from its input: layer by layer, multiply by weights, add biases, apply activations.
Implement - The PerceptronMust know
The perceptron (1958) is a single artificial neuron that outputs 1 if a weighted sum of its inputs exceeds a threshold, with a simple rule for learning the weights from mistakes.
Know well - Vanishing and Exploding GradientsMust know
In a deep network the gradient reaching early layers is a product of many per-layer factors, so it tends to shrink toward zero or blow up exponentially with depth — making early layers learn far too slowly or unstably.
Know well - Batch NormalizationShould know
Batch normalization rescales each layer's activations to zero mean and unit variance using statistics from the current mini-batch, making deep networks train faster and more stably.
Understand - DropoutShould know
Dropout randomly switches off a fraction of neurons at each training step, so the network can't rely on any single unit and must learn redundant, more general features.
Know well - Weight InitializationShould know
Initialization sets the random starting weights at a scale that keeps signals and gradients roughly the same size from layer to layer, so deep networks can start learning at all.
Understand
Chapter 5
Vision, Speech & Reinforcement Learning
- ConvolutionMust know
A convolution slides one small grid of weights (a filter) across the input, taking a weighted sum at every position to produce a feature map.
Know well - Convolutional Neural NetworksMust know
A CNN stacks convolution, nonlinearity and pooling layers so that early layers detect edges and later layers combine them into parts and objects.
Know well - Deep RL, from Atari to AlphaGo to RLHFMust know
Deep reinforcement learning uses neural networks as the policy and value functions, which let RL scale from toy tables to Atari, Go and, eventually, the fine-tuning of language models.
Understand - Exploration vs ExploitationMust know
An agent must balance exploiting the best action it knows with exploring actions that might turn out better; too little exploration locks it into a mediocre habit.
Understand - ImageNet, AlexNet and ResNetMust know
A large labelled dataset (ImageNet), GPU training (AlexNet) and residual connections (ResNet) turned CNNs from a niche method into the default for vision between 2009 and 2015.
Understand - Images as TensorsMust know
A digital image is a grid of pixels, each holding a few numbers, so a colour photo is a height × width × 3 tensor.
Understand - MDPs, Policies and ValueMust know
A Markov decision process formalises an RL problem as states, actions, transitions, rewards and a discount; a policy says what to do, and a value function says how good a situation is under it.
Understand - Policy GradientsMust know
Policy-gradient methods adjust the parameters of a policy directly, making actions that led to higher-than-expected reward more probable and the rest less probable.
Know well - Q-LearningMust know
Q-learning learns how good each action is in each state by repeatedly nudging its estimate toward the reward received plus the discounted value of the best next action.
Know well - Reinforcement LearningMust know
Reinforcement learning trains an agent to choose actions that maximise the total reward it collects over time, learning from the consequences of its own behaviour instead of from labelled answers.
Know well - Actor–Critic MethodsShould know
Actor–critic methods train two parts together: an actor (the policy) that chooses actions and a critic (a value estimate) that judges them, giving the actor a lower-noise learning signal.
Understand - Audio and SpectrogramsShould know
A spectrogram turns a waveform into a time × frequency picture by measuring the frequency content of short, overlapping windows of sound.
Understand - Detection and SegmentationShould know
Detection finds and boxes every object in an image; segmentation labels every pixel.
Understand - Pooling and DownsamplingShould know
Pooling shrinks a feature map by summarising each small block, usually by its maximum, so later layers see a wider area at lower cost.
Understand - Speech Recognition and SynthesisShould know
Speech recognition maps a sequence of audio frames to a sequence of words; the field moved from hand-built pipelines to CTC-trained networks to large encoder–decoder Transformers such as Whisper.
Understand - Vision Transformer (ViT)Should know
A Vision Transformer cuts an image into 16×16 patches, turns each into a token vector, and runs a standard Transformer over the sequence.
Understand
Chapter 6
Language Before Transformers
- AttentionMust know
Attention lets a model build each output from a weighted mix of all the inputs, with the weights computed on the fly from how relevant each input is.
Know well - EmbeddingsMust know
An embedding is a learned vector for an item — a word, token, document or image — positioned so that items used in similar ways end up close together.
Know well - Language ModelingMust know
A language model assigns a probability to each possible next text unit given the units before it.
Know well - LSTMs and GRUsMust know
LSTMs and GRUs add learned gates to a recurrent network so it can keep, discard and update information more deliberately.
Understand - N-Gram ModelsMust know
An n-gram model predicts the next word by counting what followed the previous n−1 words in a corpus.
Know well - One-Hot EncodingMust know
A one-hot vector represents a vocabulary item with a 1 in its own position and 0 everywhere else.
Know well - Recurrent Neural NetworksMust know
An RNN reads a sequence one step at a time, updating a hidden state that carries information from earlier steps.
Know well - Sequence-to-Sequence ModelsMust know
A sequence-to-sequence model uses an encoder to read one sequence and a decoder to produce another, possibly of a different length.
Know well - Text as DataMust know
A language model receives a sequence of discrete text units and must map each unit to a vocabulary ID before any neural computation can begin.
Know well - The Fixed-Vector BottleneckMust know
Early encoder-decoder models compressed every detail of the source sequence into one fixed-size vector before decoding.
Know well - Word2VecMust know
Word2vec trains compact word vectors with simple local-context prediction tasks rather than a full neural language model.
Understand - GloVeShould know
GloVe learns word vectors from global word co-occurrence statistics, providing another route to distributional geometry.
Understand - Neural Language ModelShould know
A neural language model learns word vectors and a probability function together, so similar contexts can support one another.
Understand - Neural Machine TranslationShould know
Neural machine translation trains an encoder and decoder to map a source-language sequence to a target-language sequence.
Understand
Chapter 7
Transformers
- Causal MaskingMust know
A causal mask stops each position from attending to later positions, so a model trained to predict the next token can't simply look at it.
Know well - Encoder, Decoder & Encoder–DecoderMust know
The same Transformer block is wired three ways: encoder-only models (BERT) read in both directions to understand text, decoder-only models (GPT) predict the next token to generate it, and encoder–decoder models (T5) map one sequence to another.
Know well - Feed-Forward Sublayer (MLP)Must know
The feed-forward sublayer is a small two-layer neural network applied to each token separately, transforming the information that attention has gathered.
Know well - Layer NormalizationMust know
Layer normalization rescales each token's vector to zero mean and unit variance (then applies a learned scale and shift), keeping activations in a stable range.
Understand - Multi-Head AttentionMust know
Multi-head attention runs several smaller attention operations in parallel, each with its own learned queries, keys and values, so a layer can track several kinds of relationship at once.
Know well - Positional EncodingMust know
Positional encodings add information about each token's position, because attention on its own treats a sentence as an unordered set.
Know well - Residual ConnectionsMust know
A residual connection adds a layer's input to its output (x + f(x)), so each layer learns a correction instead of a complete replacement.
Know well - Self-AttentionMust know
Self-attention lets every token in a sequence look at every other token, decide how relevant each one is, and update itself with a weighted mix of what it finds.
Implement - The Transformer BlockMust know
A Transformer block is attention followed by a feed-forward network, each wrapped in normalization and a residual connection — and a Transformer is just many identical blocks stacked.
Implement
Chapter 8
The Rise of Large Language Models
- Autoregressive Next-Token PredictionMust know
A GPT-style model reads the tokens so far and outputs a probability for every possible next token; generating text means picking one, appending it, and repeating.
Know well - Decoding: Greedy, Temperature, Top-k, Top-pMust know
A language model outputs a probability for every next token; a decoding strategy decides which one to use, trading predictability against variety.
Know well - From Base Model to ChatGPTMust know
A pretrained base model continues text; post-training methods such as instruction tuning and preference optimization shape it into an assistant that follows requests more reliably.
Understand - GPT-1 → GPT-2 → GPT-3Must know
Between 2018 and 2020 OpenAI kept the same recipe (a decoder-only Transformer trained on next-token prediction) and scaled it about a thousandfold, and the way the models were used changed from fine-tuning to zero-shot to few-shot prompting.
Understand - In-Context LearningMust know
In-context learning is a model performing a new task from instructions or a few examples placed in its prompt, with no change to its weights.
Know well - Parameters, Tokens and Context WindowsMust know
Three numbers describe a language model's scale: how many learned parameters it has, how many tokens it was trained on, and how many tokens it can attend to at once (its context window).
Know well - Pretrain, Then Fine-TuneMust know
Train one model on a huge amount of unlabelled text first, then adapt it to each task with a small labelled dataset; around 2018 this replaced training every NLP model from scratch.
Understand - Pretraining at ScaleMust know
Pretraining runs next-token prediction over a very large, diverse text corpus, producing a base model that has absorbed patterns of language, facts and reasoning styles from its data.
Know well - Scaling Laws (Preview)Must know
A language model's loss falls smoothly and predictably, as a power law, as its parameters, training data and compute grow, which turned 'make it bigger' into a plannable engineering decision.
Understand - TokenizationMust know
A tokenizer splits text into subword pieces from a fixed vocabulary and maps each piece to an integer ID; the model only ever sees those IDs.
Know well - Why Next-Token Prediction Goes So FarMust know
To predict the next token of diverse human text well, a model is pushed to capture whatever regularities produced that text, which is why a simple objective yields broad abilities, and also why those abilities have characteristic limits.
Understand - Emergent Abilities and the DebateShould know
Some abilities appear to jump from near chance to competent as models grow; whether these jumps are real phase changes or artefacts of all-or-nothing metrics is debated.
Understand
Chapter 9
How an LLM Is Actually Built
- Building a Pretraining DatasetMust know
A pretraining dataset is built by a pipeline that extracts text from web crawls and other sources, then removes most of it, through language identification, quality filters, safety filters and deduplication, before trillions of tokens remain.
Know well - Compute-Optimal Training (Kaplan vs Chinchilla)Must know
For a fixed compute budget, the lowest loss comes from growing parameters and training tokens together, about 20 tokens per parameter by the Chinchilla analysis, but labs deliberately train smaller models on far more tokens when the model will serve many users.
Know well - Data Mixtures, Repetition and Synthetic DataMust know
A training set is a weighted mixture of sources (web, code, books, papers, maths), and the weights, the number of times each source is repeated, and any model-generated data are deliberate design choices.
Understand - Data Parallelism and All-ReduceMust know
Data parallelism runs a copy of the model on every GPU, gives each a different slice of the batch, and averages their gradients with an all-reduce before every update, so all copies stay identical.
Know well - Deduplication and MinHashMust know
Deduplication removes repeated and near-identical documents from training data, usually by comparing sets of overlapping word sequences with MinHash signatures, so that copies are neither memorised nor overweighted.
Know well - Learning-Rate Schedules, Warmup and ClippingMust know
The learning rate is ramped up from near zero during a short warmup, then decayed (usually along a cosine curve) to a small fraction of its peak, while gradient clipping caps any single step that would be too large.
Know well - Mixed-Precision Training (FP16 and BF16)Must know
Mixed-precision training does most arithmetic in 16-bit floating point, which is faster and halves activation memory, while keeping a 32-bit master copy of the weights so tiny updates are not lost.
Understand - Tensor and Pipeline ParallelismMust know
Model parallelism splits the model itself: tensor parallelism divides each layer's matrices across GPUs, pipeline parallelism gives each GPU a block of consecutive layers, and large runs combine both with data parallelism.
Understand - The Compute Budget (C ≈ 6ND)Must know
Training a dense Transformer with N parameters on D tokens costs about 6ND floating-point operations, which, divided by what a GPU actually sustains, turns a model plan into GPU-days and money.
Know well - The Pretraining LoopMust know
Pretraining repeats one step about a million times: take a batch of millions of tokens, compute the average next-token loss, backpropagate, and let the optimizer nudge every weight, usually seeing each piece of data about once.
Know well - Where Training Memory GoesMust know
Training needs memory for the weights, their gradients, the optimizer's states (about 16 bytes per parameter in total with mixed-precision Adam) and the activations saved for the backward pass, which grow with sequence length and batch size.
Know well - Benchmark ContaminationShould know
Contamination happens when benchmark test questions (or their answers) end up in a model's training data, so its score partly measures memory rather than ability.
Understand - Designing the TokenizerShould know
Building a tokenizer means choosing an algorithm (BPE, WordPiece or unigram), training data, a vocabulary size, rules for numbers and unknown characters, and a set of special tokens, and every choice is frozen into the model for good.
Know well - Loss Spikes, Failures and CheckpointsShould know
Long training runs break: the loss can suddenly spike or diverge, and among thousands of GPUs something fails every few hours, so runs save checkpoints often and are built to roll back and resume.
Understand - Sharded Training (ZeRO and FSDP)Should know
Sharded training keeps data parallelism's simplicity but stores only a slice of the optimizer states, gradients and weights on each GPU, gathering each layer's full weights just in time to use them.
Understand
Chapter 10
From Base Model to Assistant
- Chat TemplatesMust know
A chat template serializes roles and messages into the token sequence a particular model expects.
Understand - Direct Preference OptimizationMust know
DPO trains a language model directly on preferred and rejected responses using their log-probability changes relative to a reference model.
Implement - Evaluating Post-TrainingMust know
Evaluate a post-trained assistant on held-out task success, factuality, uncertainty, safety and retained capability, separately from its training reward.
Know well - Instruction and Demonstration DataMust know
Demonstration data pairs tasks or conversations with target responses, teaching the behavior that supervised fine-tuning should reproduce.
Know well - Learning from ComparisonsMust know
Preference data records which of two responses a judge favors for the same prompt under a stated rubric.
Know well - Reinforcement Learning from Human FeedbackMust know
RLHF improves a policy using a reward learned from human feedback, often with a penalty for departing from a reference model.
Know well - Reward ModelsMust know
A reward model learns a scalar score that predicts which response a judge will prefer for a prompt.
Implement - Safety Tuning and RefusalMust know
Safety tuning uses examples and feedback to shape when an assistant should answer, decline or offer a safer alternative.
Understand - Supervised Fine-TuningMust know
Supervised fine-tuning continues a pretrained model's training on demonstrations of the responses it should produce.
Implement - Constitutional AI and AI FeedbackShould know
Explicit principles can guide model critiques and revisions and help generate preference feedback for later training.
Understand - Generate, Rank, Then TrainShould know
Generate several responses, select candidates with a judge, and use the selected responses as supervised demonstrations.
Understand - PPO for Language ModelsShould know
PPO uses a clipped policy objective to limit the incentive for large changes relative to the policy that collected a rollout.
Know well
Chapter 11
Inside Modern LLMs
- LoRA, QLoRA and Parameter-Efficient Fine-TuningMust know
LoRA fine-tunes a large model by freezing its weights and learning, for chosen weight matrices, a small low-rank update (the product of two thin matrices), so only a tiny fraction of parameters is trained and stored per task.
Know well - Mixture of Experts (MoE)Must know
A mixture-of-experts layer replaces one feed-forward network with many smaller 'experts' and a router that sends each token to only a few of them, so the model can store far more parameters than it uses for any one token.
Know well - Multi-Query and Grouped-Query AttentionMust know
Multi-query and grouped-query attention keep many query heads but share fewer key/value heads between them (one in MQA, a few groups in GQA), shrinking the KV cache and the memory each decode step must read, with little loss in quality.
Understand - Prefill, Decode and the Memory WallMust know
Serving a language model has two phases: prefill reads the whole prompt in one parallel pass and keeps the GPU busy, while decode produces one token per pass and spends most of its time moving weights and cached keys and values out of memory.
Know well - QuantizationMust know
Quantization stores weights (and sometimes activations or the KV cache) in fewer bits, such as 8 or 4 instead of 16, by mapping each group of numbers onto a small grid of levels with a shared scale, trading a little accuracy for much less memory and memory traffic.
Know well - The KV CacheMust know
The KV cache stores every earlier token's keys and values in each attention layer, so generating a new token computes only its own query, key and value instead of reprocessing the whole sequence, at the cost of memory that grows with context length and with the number of users.
Know well - The Quadratic Cost of AttentionMust know
Self-attention compares every token with every other token, so its score matrix, and a naive implementation's time and memory, grow with the square of the sequence length.
Understand - FlashAttentionShould know
FlashAttention computes exact attention in tiles that stay in the GPU's small, fast on-chip memory, combining partial softmaxes as it goes, so the n × n score matrix is never written to slow memory: same result, much less memory traffic, memory linear in sequence length.
Understand - Knowledge DistillationShould know
Knowledge distillation trains a small 'student' model to match a large 'teacher' model's output probabilities, which carry more information than the correct answers alone, so the student gets closer to the teacher than training on labels would allow.
Understand - PagedAttention and Continuous BatchingShould know
PagedAttention stores each request's KV cache in small fixed-size blocks found through a lookup table, like an operating system's virtual memory, so memory is allocated as tokens arrive, wasted space nearly disappears, and requests can share common blocks; with batching at the level of individual decode steps, far more users fit on a GPU.
Understand - Pruning and SparsityShould know
Pruning removes weights (or whole neurons, heads or layers) that contribute little, leaving a sparse network that needs less storage and, if the hardware can exploit the pattern, less computation.
Understand - Rotary Position Embedding (RoPE)Should know
RoPE encodes a token's position by rotating each pair of coordinates in its query and key by an angle proportional to the position, so the dot product between a query and a key depends only on how far apart the two tokens are.
Understand - Speculative DecodingShould know
Speculative decoding lets a small draft model guess several tokens ahead and has the large model check all the guesses in one parallel pass, keeping the ones it agrees with by a rule that leaves the output distribution exactly the large model's own.
Understand - The Modern Decoder Block: Pre-Norm, RMSNorm, SwiGLUShould know
Today's open LLMs keep the 2017 Transformer's decoder block but normalize before each sublayer instead of after (pre-norm), use the cheaper RMSNorm, and replace the feed-forward layer's single nonlinearity with a gated one (SwiGLU).
Understand
Chapter 12
Embeddings, RAG & the LLM Application Stack
- Approximate Nearest-Neighbour SearchMust know
Approximate nearest-neighbour indexes find the vectors most similar to a query without comparing it to every stored vector, by searching only promising clusters (IVF) or walking a proximity graph (HNSW), giving up a little recall for a large speed-up.
Know well - ChunkingMust know
Chunking splits documents into passages before embedding them, and the chunk size sets a trade-off: small chunks are precise but can cut an answer in half, large chunks keep context but blur their vectors and cost more prompt space.
Know well - Context EngineeringMust know
Context engineering is deciding what goes into the model's limited context window, in what form and in what order (instructions, retrieved passages, conversation history, tool results), because the model can only use what it reads, and doesn't use everything it reads equally well.
Know well - Evaluating Retrieval and RAGMust know
A RAG system is evaluated in two layers: did retrieval find the passages that contain the answer (recall@k, MRR, nDCG on labelled queries), and is the generated answer correct and supported by the passages it cites (faithfulness, citation quality)?
Know well - Keyword Search and BM25Must know
Keyword search ranks documents by the query words they contain, weighting rare words more (inverse document frequency) and letting repeated words count less and less; BM25 is the standard formula, and it is still a strong baseline.
Know well - Parametric vs Retrieved KnowledgeMust know
What a language model knows from training is stored in its weights (parametric knowledge): frozen at the training cutoff, unreliable for rare facts and unable to name its source; retrieved knowledge is read from documents at question time instead.
Understand - Retrieval-Augmented Generation (RAG)Must know
Retrieval-augmented generation answers a question by first searching a document collection for relevant passages and then giving those passages to a language model in its prompt, so the answer can use, and cite, knowledge that isn't in the model's weights.
Know well - Semantic and Hybrid SearchMust know
Semantic (dense) search embeds the query and returns the stored passages whose vectors are most similar to it, finding matches that share meaning but not words; hybrid search runs keyword and semantic search together and merges their rankings.
Know well - Structured Outputs and Constrained DecodingMust know
Structured outputs make a model produce data a program can parse, such as JSON matching a schema, and constrained decoding guarantees it by masking, at every step, the tokens that would break the format and renormalising over the rest.
Know well - System Prompts and InstructionsMust know
A system prompt is the developer's standing instruction at the start of the conversation (the role, rules, output format and available tools), and to the model it's just more tokens in the chat template that post-training taught it to give priority.
Know well - Text EmbeddingsMust know
A text embedding model turns a whole passage into one fixed-length vector, placed so that passages with similar meaning have a high cosine similarity, which lets a computer compare meaning with a dot product.
Know well - Tool CallingMust know
Tool calling lets a model ask the application to run a function: the model emits a structured request (a tool name and JSON arguments), the application executes it and returns the result as a new message, and the model continues with that result in its context.
Know well - Contrastive LearningShould know
Contrastive learning trains an encoder by pulling the vectors of matching pairs (a question and its answer) together and pushing non-matching ones apart, usually by asking the model to pick the true partner out of a batch with a softmax.
Understand - GuardrailsShould know
Guardrails are the checks an application runs around a model (on inputs, on retrieved text and tool results, on outputs and on actions) because the model's own trained behaviour is a strong default, not a guarantee.
Understand - RerankingShould know
Reranking takes the top candidates from a fast retriever and rescores them with a slower, more accurate model, typically a cross-encoder that reads the query and each passage together.
Know well
Chapter 13
Agents
- Agent EvaluationMust know
Agent evaluation checks final outcomes, constraint compliance and repeated-run reliability under a specified budget.
Understand - Agent Planning and ReActMust know
Agent planning organizes actions toward a goal and revises them as new observations arrive.
Understand - Agent Reliability and BudgetsMust know
Agent reliability measures completing a whole task correctly under limits, not merely choosing one plausible action.
Know well - Agent RuntimeMust know
The agent runtime assembles context, routes authorized tool calls, records observations and enforces execution limits.
Know well - Agent Trust BoundariesMust know
Agent trust boundaries prevent untrusted observations from granting permissions or directing unauthorized tool use.
Know well - Human-in-the-Loop AgentsMust know
Human-in-the-loop systems reserve meaningful decisions or approvals for a person at defined points in execution.
Understand - LLM AgentsMust know
An LLM agent repeatedly selects actions from observations to pursue a goal within a software-controlled environment.
Know well - Tool Execution in AgentsMust know
A model proposes a tool call, but separate software validates, authorizes and executes it.
Understand - Workflows vs AgentsMust know
A workflow specifies control paths in code, while an agent lets a model select subsequent actions from observations.
Understand - Agent MemoryShould know
Agent memory retains and retrieves task evidence, state and useful history across model calls.
Understand - Agent ReflectionShould know
Reflection turns feedback from an attempt into a proposed lesson for subsequent attempts.
Understand - Coding AgentsShould know
Coding agents inspect and modify software through tools, using executable checks to guide and verify changes.
Understand - Computer-Use AgentsShould know
Computer-use agents act through interface controls and inspect fresh observations to determine the resulting state.
Understand - Model Context ProtocolShould know
MCP defines how host applications connect to servers exposing tools, resources and prompts.
Understand - Multi-Agent SystemsShould know
Multi-agent systems coordinate separate model contexts or roles to accomplish a shared task.
Understand
Chapter 14
Reasoning Models
- Chain of ThoughtMust know
A chain of thought is intermediate text generated before the final answer, so that later tokens can condition on partial results instead of computing everything implicitly in one step.
Know well - Inference-Time ScalingMust know
Inference-time scaling is improving answers by spending more computation per request, on longer reasoning, more samples, search or verification, and it pays off only when that computation is aimed by a useful selector and matched to the problem's difficulty.
Know well - RL with Verifiable RewardsMust know
Reinforcement learning with verifiable rewards trains a model on problems whose results a program can check, such as math answers or code tests, and raises the probability of the responses that pass.
Know well - Search over Reasoning StepsMust know
Search over reasoning steps keeps several partial solutions alive, scores them, and expands the most promising, so that one tempting early choice does not decide the whole answer.
Know well - Self-ConsistencyMust know
Self-consistency samples several independent reasoning paths for the same question and returns the final answer they most often agree on.
Know well - Training vs Inference ComputeMust know
Training compute changes a model's parameters once, for every future request; inference compute is spent on one request with the parameters held fixed, and nothing it learns survives unless someone saves it.
Know well - Verifiers and Best-of-NMust know
A verifier scores or checks candidate solutions so a system can keep the best one, and the quality of that check, not the number of candidates, often decides the final accuracy.
Know well - Faithfulness of Reasoning TracesShould know
A reasoning trace is faithful to the extent that it accurately reflects what actually caused the model's answer; a trace can be useful, correct and convincing while still leaving out what mattered.
Know well - Process vs Outcome SupervisionShould know
Outcome supervision gives feedback on a solution's final result; process supervision gives feedback on each intermediate step, so a lucky answer reached by invalid steps is not rewarded.
Know well - Synthetic Reasoning Data and DistillationShould know
Reasoning distillation fine-tunes a model on solutions that a stronger or more expensive system generated and that passed a check, moving inference effort upstream into training data.
Know well - Group Relative Policy Optimization (GRPO)Frontier
GRPO is a PPO-style policy-optimization method that judges each sampled response against the other responses to the same prompt, replacing PPO's learned value model with a group average.
Know well
Chapter 15
Multimodal AI
- CLIP and Image–Text EmbeddingsMust know
CLIP trains an image encoder and a text encoder together so that a picture and its caption land on nearby vectors, which lets any written phrase act as a label and gives later models a shared space for pictures and words.
Know well - Diffusion ModelsMust know
A diffusion model learns to remove noise; to generate, it starts from pure random noise and repeatedly predicts the clean data behind it, stepping a little closer each time, until a sample emerges.
Know well - Latent Diffusion and Text-to-ImageMust know
Latent diffusion compresses images with an autoencoder, runs diffusion on the small latent instead of on pixels, conditions each denoising step on a text embedding, and decodes the result back to an image.
Understand - Turning Signals into TokensMust know
Before a Transformer can use an image, a sound or a video, the signal is cut into pieces (patches, frames, spacetime blocks) and each piece becomes one token: either a continuous vector or the index of an entry in a learned codebook.
Know well - Vision-Language ModelsMust know
A vision-language model lets a language model read images by encoding each image into vectors and feeding them into the model alongside text tokens, usually through a small trained connector between a pretrained image encoder and a pretrained LLM.
Know well - Audio Language Models and VoiceShould know
Audio language models treat sound as a token sequence, using spectrogram features to listen and neural-codec codes to speak, so one model can hear speech, music and tone and answer in audio without converting everything to text.
Understand - Classifier-Free GuidanceShould know
Classifier-free guidance makes a diffusion model follow its prompt more strongly by running the denoiser twice per step, with and without the prompt, and extrapolating from the unprompted prediction past the prompted one.
Know well - Generative Models: GANs, VAEs and Image TokensShould know
A generative model learns the distribution of its training data well enough to draw new samples from it; for images the main families are GANs, variational autoencoders, autoregressive models over image tokens, and diffusion.
Understand - Multimodal Hallucination and EvaluationShould know
Evaluating multimodal models means checking both directions separately: whether a model that reads images reports only what is there, and whether a model that makes images produces realistic, varied, on-prompt and original outputs.
Understand - Reading Documents, Charts and ScreensShould know
Document understanding means extracting text, numbers and structure from images of pages, charts, forms and screens, either with a separate OCR step or, increasingly, by a vision-language model reading the pixels directly.
Understand - Video GenerationShould know
Video generators extend image diffusion through time: they compress video into a latent, cut it into spacetime patches, and denoise all frames together so motion stays consistent.
Understand - Vision-Language-Action ModelsShould know
A vision-language-action model is a vision-language model fine-tuned to output robot actions, often written as discretized tokens, from camera images and a natural-language instruction.
Understand - World ModelsFrontier
A world model is a learned model that predicts how an environment will change in response to actions, so that an agent can plan or practise inside its predictions instead of only in the real world.
Understand
Chapter 16
Evaluation, Reliability, Safety & Interpretability
- Abstention and Selective PredictionMust know
Abstention means answering only when confidence clears a threshold and otherwise saying 'I don't know' or handing off, which trades how many questions are answered (coverage) for how often the answers are right.
Understand - Benchmarks and What They MeasureMust know
A benchmark is a fixed set of tasks, a way of asking the model and a scoring rule, and its number measures only what those three together capture, on questions like those, under that setup.
Know well - CalibrationMust know
A model is calibrated when its confidence matches its accuracy: of all the answers it gives with 80% confidence, about 80% are right.
Know well - Error Bars on EvalsMust know
A benchmark score is an estimate from a sample of questions, so it has a standard error, and comparing two models on the same questions question by question (a paired comparison) separates real gaps from noise with far fewer questions.
Know well - HallucinationMust know
A hallucination is a fluent, confident statement that is false or unsupported, and it follows from how language models are trained and graded: they learn to produce plausible text, and most tests reward a guess over 'I don't know'.
Know well - Human Preference Evaluation and ArenasMust know
For open-ended tasks with no single right answer, people compare two answers side by side, and a Bradley–Terry model turns many such votes into ratings with uncertainty.
Understand - Jailbreaks and Adversarial PromptsMust know
A jailbreak is an input crafted to make a safety-trained model do what its training was meant to prevent, and it works because safety training is a learned tendency competing with other tendencies, not a rule the model must obey.
Know well - LLM-as-a-JudgeMust know
An LLM judge reads a question and one or two answers and outputs a verdict, which makes open-ended evaluation cheap and fast, but the judge has measurable biases (answer order, length, its own style) that must be tested and corrected.
Know well - Circuits and Mechanistic InterpretabilityShould know
Mechanistic interpretability tries to reverse-engineer the algorithm a network has learned, as circuits of components (attention heads, MLPs, features) that pass information to each other, and tests each claim by intervening on the components.
Understand - Memorization and Training-Data ExtractionShould know
Language models store some of their training data verbatim, and an attacker who can only query the model can sometimes get it back out, including personal information that appeared in a single document.
Understand - Probing RepresentationsShould know
A probe is a small classifier, usually linear, trained to predict some property from a model's internal activations, which shows what information is available at that layer but not, by itself, that the model uses it.
Know well - Red TeamingShould know
Red teaming means deliberately trying to make a model fail, by people or by other models, to find harmful behaviours before users do and to turn them into tests and training data.
Understand - Robustness and Prompt SensitivityShould know
A model is robust when small changes that should not matter (rephrasing, formatting, a few pixels, a shift in the kind of input) leave its behaviour unchanged, and neural networks often are not.
Understand - Superposition and Polysemantic NeuronsShould know
Superposition is a network storing more features than it has neurons, as overlapping directions in activation space, which works when features are rarely active at the same time and explains why single neurons often respond to unrelated things.
Know well - Sparse Autoencoders and Dictionary LearningFrontier
A sparse autoencoder learns to rewrite a model's activation as a sparse sum of many learned directions (a dictionary), so that each direction, unlike a neuron, tends to stand for one interpretable feature.
Understand
Next: Chapter 2 · The Math Toolkit