Glossary

294 terms. Each links to the lesson where it is explained properly.

1×1 convolution
→ lesson 5.2

A convolution with a 1×1 kernel, i.e. a per-pixel linear layer across channels. Used to change channel counts cheaply in bottlenecks and Inception modules.

A2A
→ lesson 10.7

Agent-to-Agent protocol: a standard for agents from different vendors to discover each other, exchange tasks and stream results.

Ablation study
→ lesson 11.1

Removing or altering one component at a time to measure its contribution to a result. The evidence that separates real improvements from lucky configurations.

Activation function
→ lesson 4.2

The elementwise nonlinearity applied after a linear layer (sigmoid, tanh, ReLU, GELU). Without it, stacked linear layers collapse into a single linear map.

Adam
also: AdamW, RMSProp
→ lesson 1.10

An optimizer keeping bias-corrected running averages of the gradient (m^\hat m) and squared gradient (v^\hat v) and stepping θ←θ−η m^/(v^+ϵ)\theta\leftarrow\theta-\eta\,\hat m/(\sqrt{\hat v}+\epsilon) per parameter. AdamW applies weight decay directly to the weights and is the standard choice for training transformers.

Adversarial example
→ lesson 5.9

An input with a tiny, deliberately crafted perturbation, for example x+ϵ sign(∇xL)\mathbf{x}+\epsilon\,\mathrm{sign}(\nabla_{\mathbf{x}}L) (FGSM), that flips a model's prediction while looking unchanged to a human.

Agent
also: AI agent, LLM agent
→ lesson 10.1

A language model that runs in a loop: observe (context and tool results), reason, act (call tools), and repeat until a goal is met or a budget is exhausted. It chooses its own steps, unlike a workflow with a fixed path.

Agent harness
also: harness
→ lesson 10.11

The software around the model: tool definitions, the loop, state and progress files, verifiers, permissions, budgets and logging. For long-running agents the harness determines reliability as much as the model does.

Agent loop
→ lesson 10.2

The control loop that sends the conversation to the model, executes any tool calls it returns, appends the results, and repeats until the model stops calling tools or a step or cost budget is reached.

Agent memory
also: episodic memory, semantic memory
→ lesson 10.4

What an agent keeps beyond the current prompt: working memory (the context), episodic memory of past runs, semantic memory in retrievable stores, and procedural memory as instructions, skills and tools.

Agent Skills
also: skills
→ lesson 10.7

Packaged folders of instructions, scripts and resources that an agent loads on demand to perform a specialized task reliably; procedural memory shipped as files.

Agentic RAG
→ lesson 9.7

Letting the model decide when and what to retrieve, run several searches, and critique or verify results (Self-RAG, corrective RAG) instead of a single fixed retrieval step.

ALiBi
→ lesson 7.3

Attention with Linear Biases: instead of position embeddings, subtract a penalty proportional to the distance between query and key from the attention scores. Simple and extrapolates to longer sequences than seen in training.

Alignment
→ lesson 8.12

Making a model's behaviour match intended goals and values (helpful, honest, harmless) and keeping it so under distribution shift and optimization pressure. Verified, not assumed.

Approximate nearest neighbor (ANN) search
→ lesson 9.3

Finding near vectors quickly by accepting a small loss in recall, using indexes such as inverted files (IVF), product quantization or HNSW instead of comparing against every vector.

Attention
also: attention mechanism
→ lesson 6.7

A weighted average of value vectors whose weights come from the compatibility between a query and a set of keys. It lets a model focus on the relevant positions instead of compressing everything into one fixed vector.

Autoencoder
→ lesson 4.10

An encoder that compresses the input to a low-dimensional latent code and a decoder that reconstructs it, trained on reconstruction error. Learns representations without labels; a linear autoencoder recovers PCA.

Autograd
also: automatic differentiation
→ lesson 2.4

Automatic differentiation: the framework records every tensor operation in a graph and, when you call backward(), applies the chain rule in reverse to produce exact gradients for all parameters.

Autoregressive generation
also: autoregressive
→ lesson 7.6

Producing a sequence one token at a time, each conditioned on all previous tokens, by sampling from p(xt∣x<t)p(x_t\mid x_{<t}) and appending the result.

Backpropagation
also: backprop
→ lesson 4.4

Reverse-mode automatic differentiation for neural networks: compute the loss in a forward pass, then propagate gradients backward through the computational graph with the chain rule, reusing intermediate values. Cost is about the same as the forward pass.

Backpropagation through time (BPTT)
→ lesson 6.4

Backpropagation applied to an RNN unrolled over time. Gradients are multiplied through every step, which is why they vanish or explode and why truncation and clipping are used.

Base, instruct and reasoning models
also: base model, instruct model
→ lesson 8.1

A base model continues text; an instruct (chat) model has been fine-tuned and aligned to follow instructions in a conversation format; a reasoning model has additionally been trained, usually with RL, to think in long chains before answering.

Batch normalization
also: BatchNorm
→ lesson 4.6

Normalizing each feature to zero mean and unit variance over the mini-batch, then rescaling with learned γ\gamma and β\beta. Speeds and stabilizes training but couples examples within a batch and behaves differently at inference (running statistics).

Bayes' theorem
also: posterior, prior
→ lesson 1.7

p(θ∣x)=p(x∣θ) p(θ)p(x)p(\theta\mid x)=\dfrac{p(x\mid\theta)\,p(\theta)}{p(x)}: posterior is proportional to likelihood times prior. The engine of probabilistic inference and of the Naive Bayes classifier.

Beam search
→ lesson 6.6

Decoding that keeps the BB most probable partial sequences at each step instead of only the best one (greedy). Common in translation; rarely used for open-ended chat because it favours bland, repetitive text.

Bellman equation
→ lesson 4.11

The recursive identity Vπ(s)=E[rt+γVπ(st+1)]V^\pi(s)=\mathbb{E}\big[r_t+\gamma V^\pi(s_{t+1})\big] relating a state's value to its successors'. The basis of dynamic programming, temporal-difference learning and Q-learning.

Benchmark
→ lesson 8.7

A fixed dataset and metric for comparing models (MMLU, GSM8K, HumanEval, SWE-bench, GPQA). Subject to saturation, contamination and eval awareness, so headline numbers need error bars and scrutiny.

BERT
also: encoder-only model
→ lesson 7.5

A bidirectional transformer encoder pretrained with masked language modeling and fine-tuned per task. The foundation of modern text classifiers, taggers and the embedding models used in retrieval.

Bi-encoder and cross-encoder
also: cross-encoder, reranker
→ lesson 9.2

A bi-encoder embeds the query and each document separately, so documents can be pre-indexed (fast, slightly less accurate); a cross-encoder reads query and document together and scores the pair (accurate, slow). Retrieve with the first, rerank with the second.

Bias–variance trade-off
→ lesson 3.5

Expected squared error decomposes as Bias2+Variance+σ2\text{Bias}^2+\text{Variance}+\sigma^2. Simple models have high bias; flexible models have high variance; regularization, ensembling and more data move the balance.

BLEU
→ lesson 6.6

A machine-translation metric based on modified n-gram precision against reference translations with a brevity penalty. Cheap and standard, but it correlates imperfectly with human judgments.

BM25
→ lesson 9.5

A probabilistic keyword ranking function scoring documents by saturated term frequency and inverse document frequency with length normalization. The strong sparse baseline and the lexical half of hybrid search.

Bootstrap
→ lesson 1.8

Estimating the variability of a statistic by resampling the dataset with replacement many times and recomputing it. A general way to put error bars on any evaluation metric.

Broadcasting
→ lesson 2.2

The rule by which arrays of different shapes combine element-wise by virtually repeating size-1 dimensions, so a (d,)(d,) bias can be added to an (n,d)(n,d) matrix without a loop.

Byte-pair encoding (BPE)
→ lesson 6.1

A subword tokenizer trained by repeatedly merging the most frequent adjacent pair of symbols into a new token until the vocabulary is full. Byte-level BPE (GPT-2, tiktoken) can encode any text with no unknown tokens.

Catastrophic forgetting
→ lesson 8.2

Loss of previously learned abilities when a model is fine-tuned on new data. Mitigated by mixing in general data, small learning rates, fewer steps or parameter-efficient methods.

Causal (masked) attention
also: masked self-attention, causal mask
→ lesson 7.2

Attention where future positions are masked to −∞-\infty before the softmax so each token sees only its past. Required for autoregressive generation and for training on all positions at once.

Central limit theorem
→ lesson 1.8

Sums or averages of many independent random variables are approximately Gaussian regardless of the individual distributions. It is why sample means have predictable error bars and why Gaussian noise models are so common.

Chain rule
→ lesson 1.4

ddxf(g(x))=f′(g(x)) g′(x)\frac{d}{dx}f(g(x))=f'(g(x))\,g'(x); in many variables, a product of Jacobians. Backpropagation is the chain rule applied systematically over a computational graph.

Chain-of-thought (CoT)
→ lesson 8.4

Prompting or training a model to write intermediate reasoning steps before its answer, which markedly improves multi-step accuracy in large models. Reasoning models learn long chains through reinforcement learning.

Chat template
→ lesson 8.2

The exact string format, with special tokens marking system, user and assistant turns, that a chat model was trained on. Feeding a different format silently degrades outputs.

Checkpoint
→ lesson 4.9

A saved snapshot of model weights (and usually optimizer and scheduler state) taken during training, used for resuming, evaluation, early-stopping selection and deployment.

Chinchilla-optimal
→ lesson 7.9

The compute-optimal allocation from Hoffmann et al.: for a fixed training budget, use roughly 20 tokens per parameter. Modern models deliberately over-train past this point to make inference cheaper.

Chunking
→ lesson 9.4

Splitting documents into retrievable pieces by fixed size, recursive separators, semantic boundaries or document structure, usually with overlap. Chunk size trades retrieval precision against the context each chunk carries.

Class imbalance
→ lesson 3.13

When one class is far rarer than others, accuracy misleads (predicting the majority class scores high). Use class weights, resampling, threshold tuning and precision–recall metrics.

Classifier-free guidance
also: guidance scale
→ lesson 8.9

Steering a diffusion model toward a condition by extrapolating between conditional and unconditional predictions, ϵ^=ϵ∅+w (ϵc−ϵ∅)\hat{\boldsymbol{\epsilon}}=\boldsymbol{\epsilon}_\varnothing+w\,(\boldsymbol{\epsilon}_c-\boldsymbol{\epsilon}_\varnothing). Larger guidance scale ww trades diversity for prompt fidelity.

CLIP
→ lesson 8.10

A pair of image and text encoders trained contrastively on hundreds of millions of image–caption pairs so matching pairs have high cosine similarity. Enables zero-shot classification and provides the text conditioning for text-to-image models.

Coding agent
→ lesson 10.8

An agent that reads, writes, runs and tests code in a repository (Claude Code, Cursor's agent, SWE-agent). Code's verifiability (tests, compilers) makes it the leading agent domain.

Compaction
also: context compression
→ lesson 10.4

Summarizing or pruning the older parts of a long agent conversation so it fits the context window while preserving the state needed to continue.

Computational graph
→ lesson 4.4

A directed acyclic graph of operations from inputs and parameters to the loss. The forward pass evaluates it; the backward pass traverses it in reverse to accumulate gradients at every node.

Computer use
also: browser agent
→ lesson 10.8

An agent controlling a computer through screenshots or accessibility trees and mouse and keyboard actions, to operate software that has no API.

Confidence interval
→ lesson 1.8

A range computed from data that would contain the true value in a stated fraction (for example 95%) of repeated experiments. Benchmark scores without one cannot be compared honestly.

Confused deputy
→ lesson 10.10

A privileged component tricked into misusing its authority on an attacker's behalf. An agent holding the user's credentials and following injected instructions is the modern example.

Confusion matrix
→ lesson 3.5

The table of true positives, false positives, false negatives and true negatives for a classifier at a chosen threshold; every classification metric is computed from it.

Constitutional AI and RLAIF
also: RLAIF
→ lesson 8.3

Using a written set of principles and AI-generated critiques, revisions and rankings in place of most human labels to train harmlessness. RLAIF is the general term for RL from AI feedback.

Constrained decoding
also: grammar-guided decoding, JSON mode
→ lesson 8.5

Restricting generation at every step to tokens allowed by a grammar or JSON schema, guaranteeing syntactically valid structured output.

Contamination
also: data contamination
→ lesson 8.7

Benchmark questions or answers appearing in a model's training data, inflating its scores. Detected with canary strings, n-gram overlap and freshly written held-out sets.

Context engineering
→ lesson 10.4

Deliberately curating what enters the model's context at each step (instructions, retrieved facts, tool results, summaries) and what is left out. The successor to prompt engineering for agents.

Context rot
→ lesson 10.4

The degradation of model performance as the context fills with long, stale or irrelevant material. A reason to compact, retrieve just in time and keep working memory small.

Context window
also: context length
→ lesson 7.10

The maximum number of tokens a model can attend to at once. Everything the model knows about the current task must fit in it or be retrieved into it; attention cost and KV-cache memory grow with it.

Contextual retrieval
→ lesson 9.4

Prepending an LLM-written sentence or two describing where a chunk sits in its document before embedding and indexing it, so the chunk remains retrievable out of context.

Contrastive learning
also: InfoNCE
→ lesson 5.8

Learning embeddings by pulling positive pairs together and pushing negatives apart, usually with the InfoNCE loss −log⁡es(x,x+)/τ∑jes(x,xj)/τ-\log\dfrac{e^{s(x,x^+)/\tau}}{\sum_j e^{s(x,x_j)/\tau}} with temperature τ\tau. Powers SimCLR, CLIP and text-embedding models.

Convex function
also: convexity
→ lesson 1.10

A function whose chords lie above its graph, so every local minimum is global and gradient descent provably converges. Linear and logistic regression are convex; deep networks are not.

Convolution
→ lesson 5.1

Sliding a small kernel over the input and taking a dot product at every position (technically cross-correlation in deep learning libraries). It shares weights across locations, is translation-equivariant and has far fewer parameters than a dense layer.

Cosine similarity
→ lesson 1.1

cos⁡θ=x⋅y∥x∥ ∥y∥∈[−1,1]\cos\theta=\dfrac{\mathbf{x}\cdot\mathbf{y}}{\|\mathbf{x}\|\,\|\mathbf{y}\|}\in[-1,1]: similarity of directions ignoring length. The default score for comparing embeddings in search and RAG.

Cross-attention
→ lesson 7.7

Attention whose queries come from one stream (the decoder) and whose keys and values come from another (the encoder output, an image, or retrieved text). How encoder–decoder models and text-to-image conditioning connect modalities.

Cross-entropy
→ lesson 1.9

H(p,q)=−∑xp(x)log⁡q(x)H(p,q)=-\sum_x p(x)\log q(x): the expected surprise when the data follow pp but you predict qq. Minimizing it over qq is maximum likelihood, which makes it the standard loss for classification and language modeling.

Cross-validation
also: k-fold
→ lesson 3.5

Splitting data into kk folds and training kk times, each time holding out a different fold, to estimate generalization with less variance than one split and to tune hyperparameters without touching the test set.

Curse of dimensionality
→ lesson 3.4

In high dimensions data become sparse, random vectors are nearly orthogonal and distances concentrate, so neighbourhood methods degrade and the volume needed to cover the space grows exponentially.

Data augmentation
→ lesson 4.7

Generating label-preserving variants of training examples (crops, flips, color jitter, noise, paraphrases) to enlarge the effective dataset and regularize. The strongest regularizer in vision.

Data leakage
→ lesson 3.13

Information from the test set or the future reaching training: duplicated rows, features derived from the target, or random splits of time-ordered data. It produces optimistic metrics that collapse in deployment.

Data, tensor and pipeline parallelism
also: FSDP, ZeRO
→ lesson 4.12

Ways to split training across accelerators: replicate the model and split the data (data parallel), split one layer's matrices across devices (tensor parallel), or put different layers on different devices (pipeline parallel). ZeRO and FSDP additionally shard optimizer state and weights.

Decision boundary
→ lesson 3.3

The surface in input space where a classifier's prediction changes class: a hyperplane for linear models, curved for kernels, trees and neural networks.

Decision tree
→ lesson 3.8

A model that splits data by thresholding one feature at a time, choosing splits that maximize purity (information gain or Gini decrease) until leaves are pure or a stopping rule fires. Interpretable but high-variance.

Diffusion model
also: DDPM
→ lesson 8.9

A generative model that learns to reverse a gradual noising process: a network is trained to predict the noise added to data at a random step, then samples are produced by iteratively denoising from pure noise.

Direct Preference Optimization (DPO)
→ lesson 8.3

Optimizing on preference pairs directly with the loss −log⁡σ ⁣(βlog⁡π(yw)πref(yw)−βlog⁡π(yl)πref(yl))-\log\sigma\!\big(\beta\log\frac{\pi(y_w)}{\pi_{\text{ref}}(y_w)}-\beta\log\frac{\pi(y_l)}{\pi_{\text{ref}}(y_l)}\big), derived from the closed-form optimum of the RLHF objective. No reward model, no sampling loop.

Dot product
also: inner product
→ lesson 1.1

x⋅y=∑ixiyi=∥x∥ ∥y∥cos⁡θ\mathbf{x}\cdot\mathbf{y}=\sum_i x_i y_i=\|\mathbf{x}\|\,\|\mathbf{y}\|\cos\theta: a single number measuring how aligned two vectors are. Neuron pre-activations and attention scores are dot products.

Double descent
→ lesson 3.6

The observation that test error can fall again as a model grows past the point where it interpolates the training data, contradicting the classic U-shaped bias–variance curve and explaining why huge networks generalize.

Dropout
→ lesson 4.7

Randomly zeroing a fraction pp of activations during training and scaling the rest by 1/(1−p)1/(1-p), so units cannot rely on specific partners. Disabled at inference; acts like training an ensemble of thinned networks.

Durable execution
→ lesson 10.11

Running long workflows with persisted state and checkpoints so they survive crashes, restarts and waits for human input, resuming exactly where they stopped.

Early stopping
→ lesson 3.6

Halting training when validation loss stops improving. A regularizer that limits how far parameters travel from their initialization.

Eigenvector and eigenvalue
→ lesson 1.3

A vector v≠0\mathbf{v}\neq 0 with Av=λv\mathbf{A}\mathbf{v}=\lambda\mathbf{v}: the matrix only stretches it by the eigenvalue λ\lambda. Eigen-decompositions underlie PCA, spectral methods and stability analysis of optimizers.

Embedding
→ lesson 4.10

A learned dense vector representing a discrete item (token, word, user, image, document) such that geometric relations encode semantic ones. Produced by an embedding table or by an encoder network.

Embedding model
also: MTEB
→ lesson 9.2

An encoder trained contrastively to map text (or images) to vectors whose cosine similarity reflects semantic relatedness. The retrieval backbone of RAG; compared on the MTEB leaderboard.

Empirical risk minimization (ERM)
→ lesson 3.1

Choosing the model that minimizes the average loss on the training sample, 1n∑iℓ(f(xi),yi)\frac1n\sum_i\ell(f(x_i),y_i), as a proxy for the true expected risk on new data. The gap between the two is generalization error.

Encoder and decoder
also: encoder, decoder
→ lesson 6.6

An encoder maps an input to a representation and may use bidirectional context; a decoder generates output one token at a time, attending to the encoder's output through cross-attention and to its own past through causal self-attention.

Encoder–decoder model
→ lesson 7.7

A transformer with a bidirectional encoder and an autoregressive decoder joined by cross-attention (T5, BART, Whisper). Strong for translation, speech and structured transformation; less common for open-ended chat.

Ensemble
→ lesson 3.9

Combining several models' predictions. Averaging independent models reduces variance (bagging, random forests); fitting models sequentially to the residual errors reduces bias (boosting).

Entropy
→ lesson 1.9

H(p)=−∑xp(x)log⁡p(x)H(p)=-\sum_x p(x)\log p(x), the expected surprise of a distribution in bits (log base 2) or nats (natural log). Uniform distributions have maximal entropy; deterministic ones have zero.

Epoch, batch and iteration
also: epoch, batch size
→ lesson 2.4

An epoch is one full pass over the training set; a batch is the subset processed in one step; an iteration is one parameter update. Steps per epoch equals dataset size divided by batch size.

Evaluator–optimizer
→ lesson 10.5

One model generates a response, another evaluates it against explicit criteria, and the loop repeats until the evaluator is satisfied. Useful when good evaluation criteria exist.

Evidence lower bound (ELBO)
→ lesson 8.8

log⁡p(x)≥Eq(z∣x)[log⁡p(x∣z)]−DKL(q(z∣x) ∥ p(z))\log p(\mathbf{x})\ge\mathbb{E}_{q(\mathbf{z}\mid\mathbf{x})}[\log p(\mathbf{x}\mid\mathbf{z})]-D_{\mathrm{KL}}\big(q(\mathbf{z}\mid\mathbf{x})\,\|\,p(\mathbf{z})\big): reconstruction quality minus a KL regularizer. The training objective of VAEs and the starting point for diffusion's loss.

Expectation
also: expected value, mean
→ lesson 1.6

The probability-weighted average E[X]=∑xx p(x)\mathbb{E}[X]=\sum_x x\,p(x) or ∫x p(x) dx\int x\,p(x)\,dx. Every loss in machine learning is an expectation that we estimate by averaging over data.

Expectation–maximization (EM)
also: Gaussian mixture model
→ lesson 3.11

An algorithm for models with latent variables that alternates computing the expected latent assignments given current parameters (E-step) and maximizing the likelihood given those assignments (M-step). Fits Gaussian mixture models; k-means is its hard-assignment special case.

Feature engineering
→ lesson 3.13

Transforming raw data into informative model inputs: scaling, encoding categories, binning, interactions, date and text features, handling missing values. Still decisive for tabular models.

Feed-forward block (FFN)
also: MLP block
→ lesson 7.4

The per-token MLP in each transformer layer, typically expanding to 4d4d hidden units and projecting back. It holds about two-thirds of the parameters and behaves like a key–value memory of facts.

Few-shot prompting
also: zero-shot
→ lesson 8.4

Including a handful of worked examples in the prompt so the model infers the task and format by in-context learning. Zero-shot gives only instructions.

FlashAttention
→ lesson 7.10

An exact attention algorithm that tiles the computation so the n×nn\times n score matrix is never written to slow GPU memory, giving large speed and memory savings and making long contexts practical.

FLOPs
→ lesson 4.12

Floating-point operations, the unit of compute. Training a transformer costs about 6ND6ND FLOPs for NN parameters and DD tokens (forward 2ND2ND, backward 4ND4ND); inference costs about 2N2N per token.

Flow matching
also: rectified flow
→ lesson 8.9

Training a network to predict the velocity field that transports noise to data along (usually straight) paths, then integrating it with an ODE solver. A simpler, often faster alternative to noise-prediction diffusion and the default in recent image and video models.

Function calling
also: tool calling
→ lesson 9.6

An API pattern in which the model emits a structured call to a declared function with arguments, the application executes it and returns the result, and the model continues. The basis of tool use in agents.

Gaussian distribution
also: normal distribution
→ lesson 1.6

The bell-shaped density N(x;μ,σ2)=12πσ2exp⁡ ⁣(−(x−μ)22σ2)\mathcal{N}(x;\mu,\sigma^2)=\frac{1}{\sqrt{2\pi\sigma^2}}\exp\!\left(-\frac{(x-\mu)^2}{2\sigma^2}\right). It appears through the central limit theorem and as the noise model behind squared-error loss and diffusion.

GELU and SiLU
also: Swish, SwiGLU
→ lesson 4.2

Smooth variants of ReLU: GELU(z)=z Φ(z)\mathrm{GELU}(z)=z\,\Phi(z) and SiLU(z)=z σ(z)\mathrm{SiLU}(z)=z\,\sigma(z) (also called Swish). Used in transformer feed-forward layers; SwiGLU gates one linear projection with the SiLU of another.

Generative adversarial network (GAN)
also: mode collapse
→ lesson 8.8

A generator and a discriminator trained against each other in a minimax game. Produces sharp samples but trains unstably and suffers mode collapse, where the generator covers only part of the data distribution.

Generative vs discriminative model
→ lesson 3.7

Generative models learn p(x,y)p(\mathbf{x},y) or p(x)p(\mathbf{x}) (Naive Bayes, VAEs, language models); discriminative models learn p(y∣x)p(y\mid\mathbf{x}) or the decision boundary directly (logistic regression, SVMs, most classifiers).

Golden dataset
also: eval set
→ lesson 9.8

A curated set of questions with reference answers and relevant documents used to evaluate a system repeatably. The most valuable asset of an LLM application and the basis of regression testing.

GPT
also: decoder-only model
→ lesson 7.6

Generative Pre-trained Transformer: a decoder-only transformer trained on next-token prediction over large corpora. The lineage from GPT-1 through GPT-3 to modern chat and reasoning models.

Grad-CAM
also: saliency map
→ lesson 5.9

A saliency method that weights the last convolutional feature maps by the gradient of the class score flowing into them, producing a heatmap of the regions that drove a prediction.

Gradient
→ lesson 1.4

The vector of partial derivatives ∇f=(∂f/∂x1,…,∂f/∂xn)\nabla f=(\partial f/\partial x_1,\dots,\partial f/\partial x_n). It points in the direction of steepest ascent, so learning steps move against it.

Gradient boosting
also: GBDT, XGBoost
→ lesson 3.9

Building an additive model by fitting each new tree to the negative gradient of the loss with respect to current predictions (the residuals for squared error), scaled by a learning rate. XGBoost, LightGBM and CatBoost are optimized implementations.

Gradient clipping
→ lesson 4.5

Rescaling the gradient when its norm exceeds a threshold so no single step is huge. Standard in RNN and transformer training to prevent loss spikes.

Gradient descent
→ lesson 1.10

θ←θ−η∇θL(θ)\theta\leftarrow\theta-\eta\nabla_\theta\mathcal{L}(\theta): repeatedly step against the gradient of the loss with learning rate η\eta. The basic optimization algorithm of machine learning.

GraphRAG
also: knowledge graph RAG
→ lesson 9.7

Building a knowledge graph of entities and relations from a corpus, summarizing its communities, and retrieving over the graph to answer global or multi-hop questions that chunk retrieval misses.

Greedy decoding
→ lesson 8.5

Always choosing the single most probable next token. Deterministic, but prone to repetition and to locally good, globally poor sequences.

Grounding
also: citations
→ lesson 9.1

Tying a model's answer to provided evidence, typically with citations, so each claim can be checked against a source.

Grouped-query attention (GQA)
also: MQA, multi-query attention
→ lesson 7.10

Sharing one key/value head among several query heads to shrink the KV cache several-fold with little quality loss. Multi-query attention (MQA) is the extreme with a single KV head.

GRPO
→ lesson 8.3

Group Relative Policy Optimization: sample a group of responses per prompt, use their rewards normalized within the group as advantages (no learned critic), and update with a clipped PPO-style objective plus a KL term. The algorithm behind DeepSeek-R1's reasoning training.

Guardrails
→ lesson 9.9

Input and output checks around a model (classifiers, rules, schema validation, policy filters) that block unsafe or off-topic content and enforce formats before anything reaches the user or a tool.

Hallucination
also: confabulation
→ lesson 8.12

A fluent output that is false or unsupported by any source. Reduced by retrieval grounding, calibration, abstention and verification; not eliminated.

Handoff
→ lesson 10.6

Transferring control of a conversation from one agent to another, more specialized agent, carrying the relevant state along.

Hard negatives
→ lesson 9.2

Training examples that resemble the positive but are wrong. Mining them sharpens embedding models and rerankers far more than random negatives.

Hessian
→ lesson 1.5

The matrix of second partial derivatives Hij=∂2f/∂xi∂xjH_{ij}=\partial^2 f/\partial x_i\partial x_j. Its eigenvalues describe curvature; a positive-definite Hessian certifies a local minimum, and everywhere-positive-semidefinite means convex.

HNSW
→ lesson 9.3

Hierarchical Navigable Small World graph: a multi-layer proximity graph searched greedily from coarse to fine layers. The most common vector index; recall is tuned with the efSearch parameter at the cost of latency.

Human-in-the-loop
also: HITL
→ lesson 10.10

Requiring human approval for consequential or irreversible actions (payments, deletions, sending messages) inside an agent's workflow.

Hybrid search
→ lesson 9.5

Combining sparse (BM25) and dense (embedding) retrieval, typically fused with reciprocal rank fusion, to capture both exact keyword matches and semantic similarity.

HyDE
→ lesson 9.5

Hypothetical Document Embeddings: ask the LLM to write a plausible answer, embed that text and use it as the query vector. Helps when questions and documents are phrased very differently.

Idempotency
→ lesson 10.11

Designing an action so that repeating it has no additional effect, which makes retries after failures safe for agents that call external systems.

In-context learning
→ lesson 7.6

A model performing a new task from instructions or examples placed in its prompt, with no weight updates. It emerged clearly at GPT-3 scale and underlies few-shot prompting.

Induction head
→ lesson 8.11

A two-head attention circuit that finds an earlier occurrence of the current token and copies whatever followed it. The mechanism behind much in-context pattern completion.

Inductive bias
→ lesson 3.1

The assumptions built into a model family (locality and weight sharing in CNNs, permutation equivariance in attention, smoothness in kernels) that let it generalize from finite data. Less bias needs more data.

Information gain and Gini impurity
also: Gini
→ lesson 3.8

Split criteria for trees. Information gain is the reduction in entropy from a split; Gini impurity 1−∑kpk21-\sum_k p_k^2 measures how mixed a node is (zero when pure).

Intersection over union (IoU)
→ lesson 5.5

Area of overlap divided by area of union between a predicted and a true box or mask. The matching criterion for detection and segmentation metrics; also used directly as a loss.

Jacobian
→ lesson 1.5

The matrix of all first partial derivatives of a vector-valued function, Jij=∂fi/∂xjJ_{ij}=\partial f_i/\partial x_j. Autograd never builds it explicitly; it computes vector–Jacobian products, which is all a scalar loss needs.

Jailbreak
→ lesson 8.12

An input crafted to make a model violate its safety training. Distinct from prompt injection, which hijacks an application's instructions through data the model reads.

k-means
→ lesson 3.11

Clustering by alternating two steps: assign each point to its nearest centroid, then move each centroid to the mean of its points. Each step lowers the within-cluster squared distance, so it converges (to a local optimum).

k-nearest neighbors (kNN)
→ lesson 3.4

Predict by majority vote (or average) of the kk closest training points under a distance metric. No training phase, all the cost at query time; the conceptual ancestor of vector search.

Kernel (filter)
also: filter, feature map
→ lesson 5.1

The small learned weight tensor a convolution slides over its input. Each filter detects one pattern and produces one output channel, called a feature map.

Kernel trick
also: RBF kernel
→ lesson 3.10

Computing inner products in a high- or infinite-dimensional feature space through a kernel k(x,x′)=⟨ϕ(x),ϕ(x′)⟩k(\mathbf{x},\mathbf{x}')=\langle\phi(\mathbf{x}),\phi(\mathbf{x}')\rangle without ever constructing ϕ\phi. RBF and polynomial kernels are standard.

KL divergence
also: Kullback–Leibler divergence, relative entropy
→ lesson 1.9

DKL(p ∥ q)=∑xp(x)log⁡p(x)q(x)≥0D_{\mathrm{KL}}(p\,\|\,q)=\sum_x p(x)\log\frac{p(x)}{q(x)}\ge 0: the expected extra bits paid for using qq when the truth is pp. Asymmetric. It regularizes VAEs and penalizes drift from the reference model in RLHF.

Knowledge cutoff
→ lesson 9.1

The date after which a model's training data contains nothing. Anything newer must be supplied through retrieval or tools.

KV cache
→ lesson 7.10

Storing each layer's keys and values for all past tokens so that generating a new token only computes attention against the cache instead of recomputing the whole prefix. Its memory grows linearly with context length and dominates long-context inference.

Label smoothing
→ lesson 4.7

Replacing one-hot targets with 1−ϵ1-\epsilon on the true class and ϵ/(K−1)\epsilon/(K-1) on the others, which discourages over-confident logits and improves calibration.

Language model
→ lesson 6.2

A model of the probability of text, usually factored autoregressively as p(x1,…,xT)=∏tp(xt∣x<t)p(x_1,\dots,x_T)=\prod_t p(x_t\mid x_{<t}). n-gram models estimate it by counting; neural models predict each factor with a network.

Latent diffusion
also: Stable Diffusion
→ lesson 8.9

Running the diffusion process in the compressed latent space of a pretrained autoencoder instead of in pixel space, cutting cost by an order of magnitude. The design of Stable Diffusion.

Latent space
→ lesson 4.10

The compressed representation space inside a model (an autoencoder bottleneck, a VAE's z\mathbf{z}, a transformer's residual stream) where semantically similar inputs lie near each other.

Layer normalization
also: LayerNorm, RMSNorm
→ lesson 4.6

Normalizing across the features of each individual example rather than across the batch, so it works for any batch size and sequence length. The normalization used in transformers; RMSNorm is a cheaper variant that only divides by the root mean square.

Learning rate
also: step size
→ lesson 1.10

The step size η\eta in gradient descent. Too large and training diverges or oscillates; too small and it crawls. Usually warmed up then decayed by a schedule.

Learning-rate schedule
also: warmup, cosine decay
→ lesson 4.5

A rule that changes the learning rate during training: a linear warmup avoids early instability, then cosine or step decay lets the optimizer settle into a minimum.

Least privilege
also: permission model
→ lesson 10.10

Granting an agent only the tools, data and permissions the task requires, scoped and revocable. The primary structural defence against injection and mistakes.

Lethal trifecta
→ lesson 10.10

Simon Willison's term for an agent that combines access to private data, exposure to untrusted content and the ability to communicate externally. With all three, an injection can exfiltrate data; remove one leg to be safe.

Likelihood
→ lesson 1.7

p(data∣θ)p(\text{data}\mid\theta) viewed as a function of the parameters θ\theta with the data fixed. Maximizing it over θ\theta is maximum likelihood estimation.

Linear regression
→ lesson 3.2

Predicting y≈w⊤x+by\approx\mathbf{w}^\top\mathbf{x}+b by minimizing squared error. Closed form w∗=(X⊤X)−1X⊤y\mathbf{w}^*=(\mathbf{X}^\top\mathbf{X})^{-1}\mathbf{X}^\top\mathbf{y}, or gradient descent for large data.

LLM-as-a-judge
→ lesson 8.7

Using a strong model to grade outputs against a rubric or in pairwise comparison. Cheap and scalable but biased toward position, verbosity and its own style; it must be calibrated against human labels.

Log-sum-exp
→ lesson 4.3

log⁡∑iezi\log\sum_i e^{z_i}, computed stably as m+log⁡∑iezi−mm+\log\sum_i e^{z_i-m} with m=max⁡izim=\max_i z_i. The trick that makes softmax cross-entropy safe from overflow.

Logistic regression
→ lesson 3.3

A linear classifier that outputs σ(w⊤x+b)\sigma(\mathbf{w}^\top\mathbf{x}+b) as a probability and is trained by minimizing cross-entropy. Equivalently a one-layer neural network; the multiclass version uses softmax.

Logits
→ lesson 4.3

The raw, unnormalized scores a model outputs before softmax or sigmoid. Losses are computed from logits (not probabilities) for numerical stability.

LoRA
also: QLoRA, low-rank adaptation
→ lesson 8.2

Low-Rank Adaptation: freeze W∈Rd×k\mathbf{W}\in\mathbb{R}^{d\times k} and learn an update αrBA\frac{\alpha}{r}\mathbf{B}\mathbf{A} with B∈Rd×r\mathbf{B}\in\mathbb{R}^{d\times r}, A∈Rr×k\mathbf{A}\in\mathbb{R}^{r\times k} and small rank rr. Trains well under 1% of the parameters and can be merged into W\mathbf{W} for zero inference overhead; QLoRA does this on a 4-bit quantized base.

Loss function
also: objective function, cost function
→ lesson 4.3

The scalar objective measuring how wrong the predictions are, whose gradient drives learning. Chosen to match the output distribution: MSE for Gaussian targets, cross-entropy for categorical ones.

Lost in the middle
→ lesson 9.6

The finding that models use information at the start and end of a long context far better than information in the middle. Argues for reranking and placing the most important evidence at the edges.

LSTM and GRU
also: LSTM, GRU
→ lesson 6.5

Gated recurrent cells whose additive cell state lets gradients survive long sequences. The LSTM has input, forget and output gates; the GRU merges them into update and reset gates with fewer parameters.

Markov decision process (MDP)
→ lesson 4.11

The formal setting of reinforcement learning: states, actions, transition probabilities, rewards and a discount factor γ\gamma, with the Markov property that the future depends only on the current state and action.

Masked language modeling (MLM)
→ lesson 7.5

BERT's pretraining objective: hide a fraction of input tokens (15%) and predict them from bidirectional context. Produces strong encoders for classification and embeddings but does not generate text.

Matrix
→ lesson 1.2

A rectangular array A∈Rm×n\mathbf{A}\in\mathbb{R}^{m\times n} that represents a linear map. A dataset is a matrix of nn examples by dd features, and a linear layer multiplies its input by a weight matrix.

Maximum a posteriori (MAP) estimation
→ lesson 1.7

Maximizing likelihood times prior, arg⁡max⁡θlog⁡p(x∣θ)+log⁡p(θ)\arg\max_\theta \log p(x\mid\theta)+\log p(\theta). Equivalent to MLE plus a regularizer: a Gaussian prior gives ℓ2\ell_2 (ridge), a Laplace prior gives ℓ1\ell_1 (lasso).

Maximum likelihood estimation (MLE)
→ lesson 1.7

Choosing parameters that make the observed data most probable, θ^=arg⁡max⁡θ∑ilog⁡p(xi∣θ)\hat\theta=\arg\max_\theta\sum_i\log p(x_i\mid\theta). Mean squared error and cross-entropy are negative log-likelihoods under Gaussian and categorical models.

Mean average precision (mAP)
→ lesson 5.5

The detection metric: average precision (area under the precision–recall curve) per class at one or several IoU thresholds, averaged over classes.

Mean squared error (MSE)
also: RMSE
→ lesson 3.2

1n∑i(yi−y^i)2\frac1n\sum_i (y_i-\hat y_i)^2. The regression loss that equals negative log-likelihood under Gaussian noise; its root (RMSE) is in the units of yy.

Mechanistic interpretability
also: interpretability
→ lesson 8.11

Reverse-engineering the computations inside a network into human-understandable features and circuits, rather than only measuring input–output behaviour.

Mixed precision
also: bf16, fp16
→ lesson 4.12

Training with 16-bit floats (fp16 or bf16) for most computation while keeping fp32 master weights, roughly halving memory and doubling speed. fp16 needs loss scaling to avoid underflow; bf16 usually does not.

Mixture of Experts (MoE)
also: sparse MoE, router
→ lesson 7.11

Replacing each feed-forward block with many expert FFNs and a router that sends each token to the top-kk experts. Total parameters grow while per-token compute stays small; a load-balancing loss keeps experts evenly used.

Model Context Protocol (MCP)
also: MCP server
→ lesson 10.7

An open protocol that lets AI applications (hosts) connect through clients to servers that expose tools, resources and prompts in a standard way, so any model can use any integration without bespoke glue code.

Momentum
→ lesson 1.10

Accumulating an exponential moving average of gradients, v←βv+∇L\mathbf{v}\leftarrow\beta\mathbf{v}+\nabla\mathcal{L}, θ←θ−ηv\theta\leftarrow\theta-\eta\mathbf{v}, so steps build speed along consistent directions and cancel oscillations. Nesterov momentum looks ahead before computing the gradient.

Multi-agent system
→ lesson 10.6

Several agents with distinct roles or tools communicating to solve a task. Adds parallelism and specialization at the cost of coordination failures and multiplied token spend.

Multi-head attention
→ lesson 7.2

Running hh attention operations in parallel on lower-dimensional projections and concatenating the results. Different heads learn different relations (syntax, position, copying).

Multilayer perceptron (MLP)
also: feed-forward network
→ lesson 4.1

A stack of linear layers with nonlinear activations between them, hl+1=ϕ(Wlhl+bl)\mathbf{h}_{l+1}=\phi(\mathbf{W}_l\mathbf{h}_l+\mathbf{b}_l). The basic feed-forward network and the FFN block inside every transformer layer.

n-gram model
→ lesson 6.2

A language model that predicts the next token from only the previous n−1n-1 tokens using smoothed counts. The baseline that perplexity was invented to compare and the ancestor of neural language models.

Naive Bayes
→ lesson 3.7

A generative classifier that assumes features are conditionally independent given the class and applies Bayes' theorem: p(y∣x)∝p(y)∏jp(xj∣y)p(y\mid\mathbf{x})\propto p(y)\prod_j p(x_j\mid y). Fast and surprisingly strong for text.

Noise schedule
→ lesson 8.9

The sequence β1,…,βT\beta_1,\dots,\beta_T, with cumulative αˉt=∏s≤t(1−βs)\bar\alpha_t=\prod_{s\le t}(1-\beta_s), that controls how quickly data is destroyed in the forward diffusion process, so that xt=αˉt x0+1−αˉt ϵ\mathbf{x}_t=\sqrt{\bar\alpha_t}\,\mathbf{x}_0+\sqrt{1-\bar\alpha_t}\,\boldsymbol{\epsilon}. Linear and cosine schedules are common.

Non-maximum suppression (NMS)
→ lesson 5.5

Removing duplicate detections by keeping the highest-scoring box and discarding others that overlap it above an IoU threshold, class by class.

Norm
→ lesson 1.1

A length function on vectors. The ℓ2\ell_2 norm is ∑ixi2\sqrt{\sum_i x_i^2}, the ℓ1\ell_1 norm is ∑i∣xi∣\sum_i |x_i|, the ℓ∞\ell_\infty norm is max⁡i∣xi∣\max_i |x_i|; norms define distances and regularizers.

One-hot encoding
→ lesson 3.13

Representing a categorical value as a vector with a single 1 and zeros elsewhere. The input form that embedding layers replace with dense learned vectors.

Open-weights model
also: open source model
→ lesson 8.1

A model whose parameters are published for download and local use (the Llama, Qwen, DeepSeek, Mistral and Gemma families). The license may still restrict uses; training data and code are often not released.

Orchestrator–workers
also: subagents
→ lesson 10.5

A central model breaks a task into subtasks, delegates them to worker agents (often in parallel, each with its own context) and synthesizes their results.

Overfitting and underfitting
also: generalization gap
→ lesson 3.1

Overfitting: low training error but high test error because the model fit noise. Underfitting: high error on both because the model is too simple or under-trained. Validation curves tell them apart.

Parameter-efficient fine-tuning (PEFT)
→ lesson 8.2

Adapting a large model by training a small number of new or selected parameters (LoRA, adapters, prompt tuning) while the original weights stay frozen. Cuts memory and makes many task-specific variants cheap to store.

pass@k and pass^k
→ lesson 10.9

pass@k is the probability that at least one of kk attempts succeeds (a best-case metric); pass^k is the probability that all kk attempts succeed (a reliability metric). Production agents need high pass^k.

Perceptron
→ lesson 4.1

A single neuron with a threshold output, y^=1[w⊤x+b>0]\hat y=\mathbb{1}[\mathbf{w}^\top\mathbf{x}+b>0], trained by Rosenblatt's error-correction rule. It can only learn linearly separable problems, which is why hidden layers were needed.

Perplexity
→ lesson 1.9

The exponential of the average negative log-likelihood per token, PPL=exp⁡ ⁣(−1N∑tlog⁡p(xt∣x<t))\mathrm{PPL}=\exp\!\big(-\frac1N\sum_t\log p(x_t\mid x_{<t})\big). Roughly the number of equally likely next tokens the model is choosing between; lower is better.

Plan-and-execute
→ lesson 10.3

Having the model first write a plan of subtasks, then execute each (possibly with cheaper models or tools), replanning when results surprise. Separates deliberation from action.

Policy
→ lesson 4.11

The agent's behaviour π(a∣s)\pi(a\mid s): a distribution over actions given the state. In reinforcement learning for language models, the LLM itself is the policy and a response is the action.

Policy gradient
also: REINFORCE, actor–critic
→ lesson 4.11

Improving a policy by ascending ∇θJ=E[∇θlog⁡πθ(a∣s) A(s,a)]\nabla_\theta J=\mathbb{E}\big[\nabla_\theta\log\pi_\theta(a\mid s)\,A(s,a)\big], where AA is the advantage. REINFORCE is the simplest form; actor–critic methods learn a baseline to reduce variance.

Pooling
also: max pooling
→ lesson 5.2

Downsampling a feature map by taking the maximum or average over local windows. Global average pooling collapses each channel to one number before the classifier.

Positional encoding
→ lesson 7.3

Information about token order injected into the model, because attention by itself is permutation-equivariant. Sinusoidal, learned absolute, relative biases, RoPE and ALiBi are the main families.

Pre-norm and post-norm
→ lesson 7.4

Where normalization sits relative to the residual addition. The original transformer normalized after the add (post-norm); normalizing the block input (pre-norm) trains more stably and is the modern default.

Precision, recall and F1
also: precision, recall, F1 score
→ lesson 3.5

Precision =TPTP+FP=\frac{TP}{TP+FP} (how many flagged items are right), recall =TPTP+FN=\frac{TP}{TP+FN} (how many positives were found), and F1 is their harmonic mean. Raising the threshold trades recall for precision.

Prefill and decode
→ lesson 7.10

The two phases of LLM inference: prefill processes the entire prompt in parallel (compute-bound, sets time to first token); decode generates one token per step (memory-bandwidth-bound, sets tokens per second).

Pretraining
→ lesson 8.1

The first and largest training stage: next-token prediction on trillions of tokens of web text, code and books. Produces a base model with broad knowledge and no instruction-following behaviour.

Principal component analysis (PCA)
→ lesson 3.12

Projecting centred data onto the top eigenvectors of its covariance matrix (equivalently the top right singular vectors of the data matrix), the directions of maximal variance. A linear dimensionality reduction and the best rank-kk reconstruction.

Product quantization (PQ)
→ lesson 9.3

Compressing vectors by splitting them into sub-vectors and replacing each with the index of its nearest centroid from a small codebook, enabling billion-scale search in memory.

Prompt caching
→ lesson 9.9

Reusing the processed key–value state of a repeated prompt prefix across requests, cutting latency and cost for long system prompts and shared documents.

Prompt chaining
→ lesson 10.5

Decomposing a task into a fixed sequence of model calls where each step's output feeds the next, with optional programmatic checks between steps.

Prompt injection
also: indirect prompt injection
→ lesson 10.10

Attacker-written instructions placed where the model will read them (a web page, email, document or tool result) to hijack the application's task. Indirect injection arrives through retrieved or fetched data rather than the user's message.

Proximal Policy Optimization (PPO)
→ lesson 4.11

A policy-gradient method that clips the ratio πθ(a∣s)/πold(a∣s)\pi_\theta(a\mid s)/\pi_{\text{old}}(a\mid s) to [1−ϵ,1+ϵ][1-\epsilon,1+\epsilon] so each update stays close to the previous policy. The RL algorithm behind classic RLHF.

Q-learning
also: DQN
→ lesson 4.11

Learning action values with Q(s,a)←Q(s,a)+α(r+γmax⁡a′Q(s′,a′)−Q(s,a))Q(s,a)\leftarrow Q(s,a)+\alpha\big(r+\gamma\max_{a'}Q(s',a')-Q(s,a)\big). Off-policy; Deep Q-Networks represent QQ with a neural network and use experience replay.

Quantization
→ lesson 7.10

Storing weights (and sometimes activations and KV cache) in fewer bits (int8, int4, NF4) to cut memory and speed up inference, with small accuracy loss when calibrated carefully.

Query, key and value
also: QKV
→ lesson 7.2

The three projections in attention: queries ask, keys are compared with queries to produce weights, values are what gets averaged. Q=XWQ\mathbf{Q}=\mathbf{X}\mathbf{W}_Q, K=XWK\mathbf{K}=\mathbf{X}\mathbf{W}_K, V=XWV\mathbf{V}=\mathbf{X}\mathbf{W}_V.

RAGAS metrics
also: faithfulness
→ lesson 9.8

Faithfulness (are the answer's claims supported by the retrieved context?), answer relevance, context precision and context recall. The standard reference-light evaluation set for RAG pipelines.

Random forest
also: bagging
→ lesson 3.9

An ensemble of decision trees each trained on a bootstrap sample with a random subset of features considered at every split. Robust, hard to overfit badly, and a strong tabular baseline.

Random variable
also: PMF, PDF
→ lesson 1.6

A quantity whose value depends on chance, described by a distribution: a probability mass function for discrete values or a probability density function for continuous ones.

Rank
→ lesson 1.2

The number of linearly independent columns (equivalently rows) of a matrix, i.e. the dimension of its column space. Low rank means the matrix carries less information than its size suggests, which LoRA exploits.

ReAct
→ lesson 10.3

Reason + Act: interleaving thought text, actions and observations in one trace so that reasoning guides tool use and tool results ground the reasoning. The ancestor of modern tool-calling loops.

Reasoning model
also: thinking model
→ lesson 8.6

A language model trained, mostly with reinforcement learning on verifiable tasks, to produce long internal chains of thought before answering. Trades inference tokens and latency for accuracy on math, code and planning.

Recall@k, MRR and nDCG
also: recall@k, nDCG, MRR
→ lesson 9.5

Retrieval metrics: recall@k is the fraction of relevant documents found in the top kk; MRR is the mean reciprocal rank of the first relevant hit; nDCG rewards relevant documents ranked higher with a logarithmic discount, normalized by the ideal ranking.

Receptive field
→ lesson 5.1

The region of the input that can influence one activation. It grows with depth, kernel size, stride and dilation; deep layers see the whole image.

Reciprocal rank fusion (RRF)
→ lesson 9.5

Merging ranked lists by giving each document the score ∑i1k+ranki(d)\sum_i \frac{1}{k+\mathrm{rank}_i(d)} (often k=60k=60). Simple and robust because it needs no score calibration between systems.

Recurrent neural network (RNN)
→ lesson 6.4

A network that processes a sequence one step at a time, updating a hidden state ht=f(Wht−1+Uxt+b)\mathbf{h}_t=f(\mathbf{W}\mathbf{h}_{t-1}+\mathbf{U}\mathbf{x}_t+\mathbf{b}) with the same weights at every step.

Reflexion
→ lesson 10.3

An agent critiquing its own failed attempt in natural language and storing the reflection in memory so the next attempt avoids the mistake; learning without weight updates.

Regularization
→ lesson 3.6

Any technique that discourages complexity to improve generalization: ℓ1\ell_1 and ℓ2\ell_2 penalties, weight decay, dropout, early stopping, data augmentation.

Reinforcement learning with verifiable rewards (RLVR)
also: verifiable rewards
→ lesson 8.6

Training with rewards computed by an automatic checker (answer key, unit tests, compiler) instead of a learned preference model. The signal behind DeepSeek-R1-style reasoning models.

ReLU
also: rectified linear unit
→ lesson 4.2

ReLU(z)=max⁡(0,z)\mathrm{ReLU}(z)=\max(0,z): cheap, non-saturating for positive inputs, and the default activation of the deep learning era. Units whose input is always negative output zero forever and are called dead.

Reparameterization trick
→ lesson 8.8

Writing a sample as z=μ+σ⊙ϵ\mathbf{z}=\boldsymbol{\mu}+\boldsymbol{\sigma}\odot\boldsymbol{\epsilon} with ϵ∼N(0,I)\boldsymbol{\epsilon}\sim\mathcal{N}(\mathbf{0},\mathbf{I}) so that gradients can flow through the sampling step to the encoder.

Representation learning
→ lesson 4.10

Learning useful features automatically from data instead of designing them by hand. The core promise of deep learning and the reason pretrained models transfer.

Reproduction
also: replication
→ lesson 11.1

Re-implementing a paper's method and re-running its experiment, usually at smaller scale, to confirm the result and surface omitted details. The fastest route from reading to understanding.

Residual connection
also: skip connection
→ lesson 4.6

Adding a block's input to its output, y=F(x)+x\mathbf{y}=F(\mathbf{x})+\mathbf{x}, so gradients flow through an identity path. Makes very deep networks trainable and defines the transformer's residual stream.

Residual stream
→ lesson 7.4

The running sum of all block outputs that flows through a transformer. Each attention head and MLP reads from it and writes back into it; the central object of mechanistic interpretability.

Retrieval-augmented generation (RAG)
→ lesson 9.1

Retrieving documents relevant to a query and placing them in the prompt so the model answers from evidence. Reduces hallucination and lets models use private or recent information without retraining.

Reward hacking
also: over-optimization
→ lesson 8.3

A policy exploiting flaws in the reward model or verifier to score well without doing the intended task (verbosity, sycophancy, gaming unit tests). The reason RLHF uses a KL penalty and RLVR needs robust checkers.

Reward model
also: Bradley–Terry model
→ lesson 8.3

A model trained to score responses so preferred ones score higher, usually with the Bradley–Terry loss −log⁡σ(r(yw)−r(yl))-\log\sigma\big(r(y_w)-r(y_l)\big) on winning and losing responses. The stand-in for human judgment during RLHF.

Ridge and lasso
also: L1 regularization, L2 regularization
→ lesson 3.6

Adding λ∥w∥22\lambda\|\mathbf{w}\|_2^2 (ridge, ℓ2\ell_2) shrinks all weights smoothly; adding λ∥w∥1\lambda\|\mathbf{w}\|_1 (lasso, ℓ1\ell_1) drives some weights to exactly zero because the ℓ1\ell_1 ball has corners on the axes.

RLHF
→ lesson 8.3

Reinforcement learning from human feedback: train a reward model on human preference comparisons, then optimize the policy against it with RL (typically PPO) under a KL penalty that keeps it close to the reference model.

ROC curve and AUC
also: AUC, ROC-AUC
→ lesson 3.5

The ROC curve plots true-positive rate against false-positive rate over all thresholds; AUC is the area under it, equal to the probability that a random positive scores above a random negative. Use precision–recall curves instead when positives are rare.

Rotary position embedding (RoPE)
→ lesson 7.3

Rotating each query and key pair of dimensions by an angle proportional to its position, so that the dot product qm⋅kn\mathbf{q}_m\cdot\mathbf{k}_n depends only on the relative offset m−nm-n. The standard in Llama-style models.

Routing
→ lesson 10.5

Classifying an input and sending it to a specialized prompt, model or workflow. Separates concerns and lets easy cases use cheap models.

Sandbox
→ lesson 10.8

An isolated execution environment (container or VM with restricted filesystem and network) where code and tools run by an agent can fail or be attacked without harming the host.

Scaled dot-product attention
→ lesson 7.2

Attention(Q,K,V)=softmax ⁣(QK⊤dk)V\mathrm{Attention}(\mathbf{Q},\mathbf{K},\mathbf{V})=\mathrm{softmax}\!\left(\frac{\mathbf{Q}\mathbf{K}^\top}{\sqrt{d_k}}\right)\mathbf{V}. Dividing by dk\sqrt{d_k} keeps the scores' variance near one so the softmax does not saturate.

Scaling laws
→ lesson 7.9

Empirical power laws relating loss to model size, dataset size and compute over many orders of magnitude. They predict the return on more resources and guide how to split a budget between parameters and tokens.

Self-attention
→ lesson 7.2

Attention in which queries, keys and values all come from the same sequence, so every position gathers information from every other position in one step.

Self-consistency
→ lesson 8.4

Sampling several reasoning chains for the same question and taking the majority answer. A simple, effective form of test-time compute.

Self-supervised learning
→ lesson 5.8

Manufacturing labels from the data itself (predict the next token, the masked word, or whether two augmented views match) so that unlabelled corpora become training signal. How language models and modern vision backbones are pretrained.

Semantic caching
→ lesson 9.9

Returning a stored answer when a new query's embedding is close enough to one already answered, avoiding a model call.

Semantic, instance and panoptic segmentation
also: segmentation
→ lesson 5.6

Semantic segmentation labels every pixel with a class; instance segmentation separates individual objects; panoptic does both at once.

Sentence embedding
→ lesson 7.5

A single vector representing a sentence or passage, produced by pooling an encoder's token outputs and trained contrastively so that semantically similar texts are close. The retrieval representation in RAG systems.

Sequence-to-sequence (seq2seq)
→ lesson 6.6

An encoder that reads an input sequence into a representation and a decoder that generates an output sequence from it. Introduced with RNNs for translation; transformers kept the framing.

SHAP values
also: feature importance
→ lesson 3.13

Per-feature contributions to one prediction derived from Shapley values in cooperative game theory, summing exactly to the prediction minus the baseline. The standard model-agnostic explanation for tabular models.

Sigmoid
→ lesson 3.3

σ(z)=11+e−z\sigma(z)=\dfrac{1}{1+e^{-z}}, squashing any real number into (0,1)(0,1) with derivative σ(z)(1−σ(z))\sigma(z)(1-\sigma(z)). Used for binary probabilities and in LSTM gates.

Singular value decomposition (SVD)
→ lesson 1.3

A=UΣV⊤\mathbf{A}=\mathbf{U}\boldsymbol{\Sigma}\mathbf{V}^\top for any matrix, with orthogonal U,V\mathbf{U},\mathbf{V} and non-negative singular values on the diagonal of Σ\boldsymbol{\Sigma}. Keeping the top kk singular values gives the best rank-kk approximation (Eckart–Young), the basis of PCA and the intuition behind low-rank adaptation.

Softmax
→ lesson 3.3

softmax(z)i=ezi∑jezj\mathrm{softmax}(\mathbf{z})_i=\dfrac{e^{z_i}}{\sum_j e^{z_j}} turns a vector of scores into a probability distribution. It is the output layer of classifiers and language models and the normalizer inside attention.

Sparse autoencoder (SAE)
→ lesson 8.11

An overcomplete autoencoder with a sparsity penalty trained on a model's activations to decompose them into interpretable, mostly monosemantic features. The main tool for mapping features in frontier models.

Speculative decoding
→ lesson 7.10

A small draft model proposes several tokens which the large model verifies in one parallel forward pass; accepted tokens are emitted and the first rejection is resampled. Produces the same output distribution faster.

State graph
also: LangGraph
→ lesson 10.11

Modelling an agent as a graph of nodes (model calls, tools, checks) and edges (transitions) over explicit state, as in LangGraph, so control flow, retries and approval points are inspectable and resumable.

State space model
also: SSM, Mamba
→ lesson 7.12

A sequence model with a linear recurrent state that can also be computed as a long convolution, giving linear-time processing. Mamba makes the state-transition parameters input-dependent (selective), closing much of the gap to transformers.

Stochastic gradient descent (SGD)
also: mini-batch
→ lesson 1.10

Gradient descent using the gradient of a random mini-batch, an unbiased but noisy estimate of the full gradient. Cheaper per step, and the noise often helps generalization.

Stride and padding
→ lesson 5.1

Stride is the step between kernel positions (downsampling when greater than 1); padding adds a border of zeros so spatial size is controlled. Output size is ⌊(n+2p−k)/s⌋+1\lfloor (n+2p-k)/s\rfloor+1.

Structured output
also: JSON schema output
→ lesson 9.6

Model output constrained to a schema (JSON with typed fields), enforced by constrained decoding or by validation and retry. The interface between language models and ordinary code.

Superposition
also: polysemanticity
→ lesson 8.11

A network representing more features than it has neurons by assigning them to nearly orthogonal directions in activation space, which makes individual neurons polysemantic.

Supervised fine-tuning (SFT)
also: instruction tuning
→ lesson 8.2

Continuing training on curated prompt–response pairs so a base model learns the desired format and behaviour. The first post-training stage, before preference or RL training.

Supervised learning
→ lesson 3.1

Learning a mapping from inputs to targets from labelled examples (xi,yi)(x_i,y_i): classification when yy is a category, regression when it is a number.

Support vector machine (SVM)
→ lesson 3.10

A classifier that maximizes the margin between classes, penalizing violations with hinge loss max⁡(0,1−y f(x))\max(0,1-y\,f(\mathbf{x})). Kernels make it nonlinear; the solution depends only on the support vectors.

SWE-bench
→ lesson 10.9

A benchmark of real GitHub issues that an agent must resolve by editing the repository so that hidden tests pass. SWE-bench Verified is the human-validated subset used for headline numbers.

System prompt
also: prompt
→ lesson 8.4

Instructions given to a chat model ahead of the conversation that set its role, rules, tools and output format. Distinct from user turns and a frequent target of injection attacks.

t-SNE and UMAP
→ lesson 3.12

Nonlinear methods that map high-dimensional points to two or three dimensions while preserving local neighbourhoods. Excellent for visualizing embeddings; unreliable for reading distances or cluster sizes.

Teacher forcing
→ lesson 6.6

Training a decoder by feeding it the true previous token rather than its own prediction. Fast and stable, but creates exposure bias because at inference the model must consume its own mistakes.

Temperature
→ lesson 8.5

A divisor applied to logits before the softmax, pi∝ezi/Tp_i\propto e^{z_i/T}. T<1T<1 sharpens toward the most likely tokens, T>1T>1 flattens toward randomness, and T→0T\to 0 recovers greedy decoding.

Tensor
→ lesson 2.4

An nn-dimensional array: a scalar (0-d), vector (1-d), matrix (2-d) and beyond, with a shape and a dtype. The basic data type of NumPy and PyTorch; a batch of RGB images is a 4-d tensor.

Test-time compute
also: inference-time scaling
→ lesson 8.6

Spending more computation at inference (longer reasoning, multiple samples, verifiers, search) to improve answers. A third scaling axis alongside parameters and training data.

TF-IDF
also: bag of words
→ lesson 6.2

Term frequency times inverse document frequency, tf(t,d)⋅log⁡Ndf(t)\mathrm{tf}(t,d)\cdot\log\frac{N}{\mathrm{df}(t)}, weighting words that are frequent in a document but rare across the corpus. The classic sparse text representation and the basis of BM25.

Three-pass method
→ lesson 11.1

Keshav's technique for reading papers: a ten-minute triage of title, abstract, headings and conclusion; a one-hour read that skips proofs and studies figures; and a multi-hour virtual re-implementation.

Time to first token (TTFT)
also: latency budget
→ lesson 9.9

Latency from sending a request to receiving the first streamed token, dominated by prefill of the prompt. Tokens per second then measures decode speed; both belong in a latency budget.

Token
also: tokenization
→ lesson 6.1

The unit a language model reads and writes: a subword piece, character or byte sequence mapped to an integer id. Roughly three-quarters of an English word; tokenization determines what the model can see.

Tool use
also: tool schema
→ lesson 10.2

Giving a model declared functions (search, code execution, file access, APIs) described by JSON schemas that it can call. The model emits calls, the harness executes them and feeds back results.

Top-k and top-p (nucleus) sampling
also: nucleus sampling, top-k sampling
→ lesson 8.5

Truncating the next-token distribution before sampling: top-k keeps the kk most likely tokens; top-p keeps the smallest set whose cumulative probability exceeds pp; both renormalize what remains.

Tracing
also: observability
→ lesson 9.8

Recording every prompt, retrieval, tool call, token count, latency and cost of a request as a tree of spans (LangSmith, Langfuse, Arize) for debugging, evaluation and cost analysis.

Train, validation and test split
also: held-out set
→ lesson 3.1

Training data fits parameters; validation data chooses hyperparameters and when to stop; test data is touched once for the final estimate. Reusing the test set for decisions turns it into a validation set.

Trajectory
→ lesson 10.9

The full record of one agent run: every model turn, tool call, tool result and final output. The unit that agent evaluations grade and that tracing tools display.

Transfer learning
also: fine-tuning, pretrained backbone
→ lesson 5.4

Reusing a model pretrained on a large dataset as a starting point for a new task: freeze it and train a new head (feature extraction) or update all weights with a small learning rate (fine-tuning).

Transformer
→ lesson 7.1

An architecture built from stacked blocks of multi-head self-attention and position-wise feed-forward layers with residual connections and normalization, processing all positions in parallel. The basis of modern language, vision and multimodal models.

Tree of Thoughts
→ lesson 10.3

Exploring multiple reasoning branches as a search tree, with the model evaluating partial states and backtracking, instead of committing to a single linear chain.

Universal approximation theorem
→ lesson 4.1

A network with one hidden layer and enough units can approximate any continuous function on a compact set to any accuracy. It says nothing about how many units are needed or whether gradient descent will find them.

Unsupervised learning
→ lesson 3.1

Finding structure in data without labels: clustering, density estimation and dimensionality reduction.

Value function
also: Q-function, critic
→ lesson 4.11

The expected discounted return from a state, Vπ(s)V^\pi(s), or from a state–action pair, Qπ(s,a)Q^\pi(s,a). Estimated by critics and used to bootstrap learning and reduce variance.

Vanishing and exploding gradients
→ lesson 4.2

Gradients shrink or blow up as they are multiplied through many layers or time steps, because the product of many Jacobians has norms that decay or grow exponentially. Mitigated by ReLU, careful initialization, normalization, residual connections and gradient clipping.

Variance
also: standard deviation
→ lesson 1.6

Var(X)=E[(X−EX)2]\mathrm{Var}(X)=\mathbb{E}[(X-\mathbb{E}X)^2], the expected squared deviation from the mean; its square root is the standard deviation.

Variational autoencoder (VAE)
→ lesson 8.8

A generative latent-variable model trained by maximizing the ELBO: an encoder outputs a distribution q(z∣x)q(\mathbf{z}\mid\mathbf{x}), a decoder reconstructs x\mathbf{x} from samples of z\mathbf{z}, and a KL term keeps the latent space close to a prior. The compressor inside latent diffusion.

Vector
→ lesson 1.1

An ordered list of nn numbers, equivalently an arrow in Rn\mathbb{R}^n. Every input, parameter block and embedding in machine learning is a vector or a stack of them.

Vector database
→ lesson 9.3

A store that indexes embeddings for approximate nearest-neighbour search with metadata filtering (pgvector, Chroma, Qdrant, Weaviate, Milvus, Pinecone). For small corpora a plain table with brute-force search is enough.

Vision Transformer (ViT)
also: patch embedding
→ lesson 5.7

A transformer applied to images by splitting them into fixed-size patches, linearly embedding each patch as a token and adding position embeddings. Needs more data or pretraining than CNNs but scales very well.

Vision-language model (VLM)
also: multimodal model
→ lesson 8.10

A language model that also accepts images (and often audio or video), usually by projecting a vision encoder's features into the language model's token space or by training natively on interleaved modalities.

Vocabulary
→ lesson 6.1

The fixed set of tokens a model knows, typically 32k to 256k entries. Larger vocabularies shorten sequences but enlarge the embedding and output matrices.

Weight decay
→ lesson 4.5

Shrinking weights toward zero at every step, w←(1−ηλ)w\mathbf{w}\leftarrow(1-\eta\lambda)\mathbf{w}. Identical to ℓ2\ell_2 regularization under plain SGD, but under Adam only the decoupled form (AdamW) behaves as intended.

Weight tying
→ lesson 7.4

Sharing the input embedding matrix with the output unembedding matrix, saving parameters and regularizing. Common in smaller language models.

Word embedding
also: word2vec, GloVe
→ lesson 6.3

A dense vector per word learned so that words appearing in similar contexts are close. word2vec trains them by predicting context words (skip-gram) or the centre word (CBOW) with negative sampling; GloVe fits co-occurrence statistics.

Workflow vs agent
→ lesson 10.1

A workflow orchestrates model calls along predefined code paths; an agent lets the model dynamically direct its own process and tool use. Anthropic's guidance: start with the simplest workflow that works and add autonomy only when it pays.

Xavier and He initialization
also: initialization
→ lesson 4.6

Drawing initial weights with variance 1/nin1/n_{\text{in}} (Xavier/Glorot, for tanh-like activations) or 2/nin2/n_{\text{in}} (He, for ReLU) so that activation and gradient scales stay roughly constant through depth.

τ-bench
also: tau-bench
→ lesson 10.9

A benchmark of multi-turn interactions between an agent, a simulated user and tool APIs under domain policies, whose pass^k metric measures how reliably the agent succeeds across repeated trials.