Glossary
219 terms, each in plain words, with the lesson that first teaches it. Skipped a lesson and met a word you do not know? Start here.
- Accuracy
- The share of examples whose predicted label matches the true label: 27 right out of 30 is 0.90.
- Taught in stage 2: The training loop
- Activation function
- The nonlinear function a neuron applies to its weighted sum, such as ReLU or tanh. Without it, stacked layers collapse into one linear layer.
- Taught in stage 2: The neuron and nonlinearity
- AdamW
- An optimizer that scales each parameter's step by running averages of its recent gradients and their squares, and applies weight decay directly to the weights.
- Taught in stage 3: A tiny transformer
- Add-alpha smoothing
- Adding a small count alpha to every cell before normalizing, P = (count + alpha) / (row total + alpha * V), so unseen pairs never get probability 0.
- Taught in stage 3: The bigram model
- Agent
- A loop your code runs around tool calls: call the model, run any requested tools, append the results, and call again until the model stops or a budget runs out.
- Taught in stage 6: The agent loop
- Allowlist
- A rule that states what is permitted and refuses everything else, such as: the resolved path's parent is exactly notes/ and its suffix is .md.
- Taught in stage 6: Guardrails: data is not instructions
- API
- Application programming interface: a web endpoint with a fixed request and response shape. A hosted model is reached by sending an HTTPS request to its API.
- Taught in stage 4: Your first model call: tokens, cost, and latency
- API key
- A secret that bills your account. Keep it in an environment variable such as ANTHROPIC_API_KEY, never in code, because git keeps every version of a file.
- Taught in stage 4: Your first model call: tokens, cost, and latency
- Approximate nearest neighbor (ANN)
- A search that checks only part of the vectors to go faster, at the risk of missing a true nearest neighbor. Worth it at millions of vectors, not hundreds.
- Taught in stage 5: Chunking and indexing
- Attention head
- One set of query, key and value maps of head size d, computing one attention pattern.
- Taught in stage 3: Embeddings and self-attention
- Autograd
- Code that records operations as they run and then computes exact gradients automatically by backpropagation, as your Value class and PyTorch do.
- Taught in stage 2: Backpropagation with a tiny autograd
- Axis
- One direction you can index along in an array. sum(axis=k) adds along axis k and removes it from the shape: (2, 3) summed over axis 0 gives (3,).
- Taught in stage 0: Numbers and arrays
- Backpropagation
- Computing the gradient of the loss with respect to every parameter by applying the chain rule backward through the computational graph, for about the cost of one forward pass.
- Taught in stage 2: Backpropagation with a tiny autograd
- Batch
- A group of examples processed together, usually as rows of one matrix, so one matrix multiply makes all their predictions at once.
- Taught in stage 1: Vectors and matrices in numpy
- Bi-encoder
- A model that encodes query and document separately, so document vectors are computed once and stored. Sentence embedding models are bi-encoders.
- Taught in stage 5: Evaluating and improving retrieval
- Bias
- The added constant b in a neuron or line, the output when every input is 0.
- Taught in stage 2: The neuron and nonlinearity
- Bigram model
- A language model that predicts the next token from the current one only, P(next = b | current = a), built from a table of pair counts.
- Taught in stage 3: The bigram model
- Binary cross-entropy
- Cross-entropy for yes-or-no labels: -(1/n) * sum of [y_i * log(p_i) + (1 - y_i) * log(1 - p_i)], where p_i = P(label i is 1).
- Taught in stage 1: Measuring wrong: loss functions
- BM25
- The classic keyword ranking: sum over query terms of idf * tf * (k1 + 1) / (tf + k1 * (1 - b + b * |D| / avgdl)). k1 caps repeated terms; b corrects for length.
- Taught in stage 5: Evaluating and improving retrieval
- Broadcasting
- numpy's rule for combining arrays of different shapes: pair lengths from the right; each pair must be equal or contain a 1, and a length-1 axis stretches to match. (2, 3) with (2, 1) works; (2, 3) with (2,) fails.
- Taught in stage 0: Numbers and arrays
- Brute-force search
- Exact nearest-neighbor search that scores every stored vector against the query. For thousands of vectors it takes milliseconds in numpy.
- Taught in stage 5: Search by meaning
- Byte-pair encoding (BPE)
- A tokenizer that starts from bytes and repeatedly merges the most frequent adjacent pair into a new token. The ordered merge list is the tokenizer.
- Taught in stage 3: Text to tokens
- Causal mask
- Setting every attention score for a later position to -inf before the softmax, so each position sees only itself and the past.
- Taught in stage 3: Embeddings and self-attention
- Chain rule
- For a function of a function, rates multiply: if y depends on u and u on x, dy/dx = dy/du * du/dx. For y = (3x + 1)^2 at x = 2 that is 14 * 3 = 42.
- Taught in stage 0: Slopes and derivatives
- Chunk
- A piece of a document small enough to get its own vector and about one topic. Pocket cuts notes at headings, then windows long sections.
- Taught in stage 5: Chunking and indexing
- Citation check
- Comparing the source ids an answer cites (C) with the ids actually sent (S). Any id in the set difference C - S is a source the model never saw.
- Taught in stage 5: Grounded answers with citations
- Clipping
- Limiting values to a range, such as probabilities to [1e-12, 1 - 1e-12] before a log, so log(0) = -inf cannot occur.
- Taught in stage 1: Measuring wrong: loss functions
- Cohen's kappa
- Agreement corrected for chance: kappa = (p_o - p_e) / (1 - p_e), with p_e = p_h * p_m + (1 - p_h) * (1 - p_m). 1 is perfect, 0 is chance level.
- Taught in stage 7: LLM-as-judge
- Computational graph
- The record of a calculation: each operation is a node, linked to the nodes it read from. Leaves are inputs and parameters.
- Taught in stage 2: Backpropagation with a tiny autograd
- Conditional probability
- P(B | A), the probability of B counting only cases where A happened: count(A and B) / count(A).
- Taught in stage 0: Probability basics
- Context budget
- A cap on how much retrieved text goes into the prompt. Fill it best-first and stop at the first chunk that would exceed it.
- Taught in stage 5: Grounded answers with citations
- Context engineering
- Deciding what goes into the context window. The model cannot open files, so the text it needs must be in the request, clearly marked, with rules first and the question last.
- Taught in stage 4: Prompts are specs: context engineering
- Context window
- The most text, counted in tokens, a model can take in at once.
- Taught in stage 3: Text to tokens
- Contrastive training
- Training on matched pairs so that each pair's vectors move together and the other texts in the batch move away: softmax over each row of cosines, cross-entropy with the true partner as the class.
- Taught in stage 5: Search by meaning
- Cosine similarity
- cos(a, b) = (a . b) / (||a|| * ||b||), the cosine of the angle between two vectors. It measures direction, not size, and runs from -1 to 1.
- Taught in stage 1: Vectors and matrices in numpy
- Cost per call
- cost = input_tokens * input_rate / 1,000,000 + output_tokens * output_rate / 1,000,000, with rates quoted per million tokens. Output tokens cost more because each needs its own model pass.
- Taught in stage 4: Your first model call: tokens, cost, and latency
- Cross-encoder
- A model that reads query and document together and outputs a relevance score. More accurate but one pass per candidate, so it reranks a short list.
- Taught in stage 5: Evaluating and improving retrieval
- Cross-entropy
- The average negative log-likelihood of the true labels: for one example, -log of the probability given to the true class. From logits z it is LSE(z) - z_y.
- Taught in stage 1: Measuring wrong: loss functions
- Dense retrieval
- Ranking by cosine similarity between embedding vectors, as opposed to sparse keyword methods such as BM25.
- Taught in stage 5: Evaluating and improving retrieval
- Derivative
- The slope of a function at a single point, written f'(x): the value (f(x + h) - f(x)) / h approaches as h shrinks. The derivative of x^2 is 2x.
- Taught in stage 0: Slopes and derivatives
- Deterministic check
- Code that returns True or False and gives the same verdict on the same text every time, such as a whole-word match on an expected value.
- Taught in stage 7: Evals before opinions
- Dot product
- Multiply two vectors position by position and add: a . b = sum over i of a_i * b_i. [3, 2] . [1, 1] = 5.
- Taught in stage 1: Vectors and matrices in numpy
- Drift
- Quality changing after launch because questions, notes, or the model change. Pin dated model ids and rerun the evals on a schedule.
- Taught in stage 7: Choose the fix, then ship
- dtype
- The single number type every entry of a numpy array shares, such as float64 or int64.
- Taught in stage 0: Numbers and arrays
- Early stopping
- Stopping training after a set number of epochs (the patience) with no new best validation loss, then restoring the best saved weights.
- Taught in stage 2: Generalization, then PyTorch
- Embedding
- A learned vector of C numbers for each token id, stored as the rows of a (V, C) table. Looking up id i equals a one-hot vector times the table.
- Taught in stage 3: Embeddings and self-attention
- Epoch
- One pass over all the training data. With mini-batches it contains ceil(N / B) steps.
- Taught in stage 1: Gradient descent
- Error result
- A tool_result with is_error true and a message naming the next step. The model reads it as a failure report and can recover, where an exception would end the run.
- Taught in stage 6: The agent loop
- Eval
- A fixed set of inputs plus a rule that says whether each output is acceptable, run the same way every time so two runs can be compared.
- Taught in stage 7: Evals before opinions
- Exfiltration
- Moving private data to a place an attacker can read, such as writing every note into a file that gets published.
- Taught in stage 6: Guardrails: data is not instructions
- Expectation
- The probability-weighted average of a numeric outcome: E[X] = sum over x of x * P(x). A fair die's expectation is 3.5.
- Taught in stage 0: Probability basics
- Exponential (exp)
- exp(x) = e^x with e = 2.71828. It is always positive, always increasing, turns sums into products (exp(a + b) = exp(a) * exp(b)), and is its own derivative.
- Taught in stage 0: Exponentials and logs
- Exponential backoff with full jitter
- Wait uniform(0, min(max_delay, base * 2^n)) seconds before retry n. Growth protects the service from one client; the random draw keeps many clients from retrying in step.
- Taught in stage 4: Production-grade calls: streaming, retries, caching
- Extrapolation
- Predicting for an input outside the range of the data a model was fitted on. Inside the range is interpolation; outside, the model's assumptions may not hold.
- Taught in stage 1: A model is a function with parameters
- Fallback string
- An exact reply the prompt allows when the material lacks the answer, such as NOT IN NOTE. Because it is exact, code can test for it.
- Taught in stage 4: Prompts are specs: context engineering
- Feature flag
- A runtime switch that decides who gets a feature. Turning it off is the rollback, so try that before launch.
- Taught in stage 7: Choose the fix, then ship
- Few-shot prompting
- Including two or three example inputs with their desired outputs in the prompt. Examples pin down format and tone faster than describing them.
- Taught in stage 4: Prompts are specs: context engineering
- Fine-tuning
- Running gradient descent further on an already trained model with your own examples. It stores patterns in the weights; it does not teach the model notes that change daily.
- Taught in stage 7: Choose the fix, then ship
- Finite difference
- A numeric estimate of a derivative from two nearby points. The central difference (f(x + h) - f(x - h)) / (2h) with h near 1e-5 is accurate to about 10 digits for smooth functions.
- Taught in stage 0: Slopes and derivatives
- Float
- A number with a decimal point stored in a fixed number of binary digits (64 bits by default), good to about 16 significant digits. Most decimals, such as 0.1, are rounded slightly, so compare floats with a tolerance, never ==.
- Taught in stage 0: Numbers and arrays
- Forced tool use
- Setting tool_choice to one tool so the model must reply with a tool_use block whose input is a dict shaped by that tool's input_schema. Validate the dict anyway.
- Taught in stage 4: Structured output you can trust
- Generalization
- How well a model does on data it was not trained on.
- Taught in stage 2: Generalization, then PyTorch
- Generation failure
- An answer that failed although the right note was retrieved: the model had the fact and misused it. Usually a prompt fix.
- Taught in stage 7: Choose the fix, then ship
- Golden set
- A fixed list of questions whose right answers (and source notes) you know in advance, so a program can grade a system against it the same way every run.
- Taught in stage 5: Chunking and indexing
- GPT
- Generative pre-trained transformer: a transformer trained to predict the next token, the design behind chat assistants.
- Taught in stage 3: A tiny transformer
- Gradient
- The list of all partial derivatives of a function, one per input or parameter. It points in the direction of steepest increase.
- Taught in stage 0: Slopes and derivatives
- Gradient accumulation
- A value used in several places collects gradient from each use, so backward adds with += rather than =. For L = a*a + a at a = 3, the contributions 1, 3 and 3 sum to 7.
- Taught in stage 2: Backpropagation with a tiny autograd
- Gradient check
- Comparing a hand-derived gradient with a finite-difference estimate before trusting it. A mismatch means the formula or the code is wrong.
- Taught in stage 1: Gradient descent
- Gradient descent
- Repeatedly moving each parameter against its gradient: parameter_new = parameter - lr * gradient. Each step goes downhill on the loss.
- Taught in stage 1: Gradient descent
- Greedy decoding
- Always picking the most likely next token instead of sampling. It tends to loop, such as "the the the".
- Taught in stage 3: The bigram model
- Grounded answer
- An answer built only from the supplied sources. Grounded is not the same as correct: it can faithfully repeat an outdated note.
- Taught in stage 5: Grounded answers with citations
- Hallucination
- A fluent, confident statement the context does not support. Temperature 0 does not prevent it; supplying the facts and allowing an explicit way out does.
- Taught in stage 4: Prompts are specs: context engineering
- HNSW
- Hierarchical navigable small world: an ANN index that links each vector to a few near neighbors in layered graphs and walks greedily toward the query.
- Taught in stage 5: Chunking and indexing
- Human approval
- A check in your code that shows the user a pending side effect and waits for yes, defaulting to no. It runs outside the model, so no text can skip it.
- Taught in stage 6: Guardrails: data is not instructions
- Hybrid retrieval
- Fusing a keyword ranking and an embedding ranking, usually with RRF. It does not always win; measure it on your own questions.
- Taught in stage 5: Evaluating and improving retrieval
- Hyperparameter
- A setting you choose rather than learn, such as the learning rate, batch size, layer sizes or number of epochs.
- Taught in stage 2: The training loop
- Independence
- Two events are independent when knowing one tells you nothing about the other: P(B | A) = P(B), or P(A and B) = P(A) * P(B).
- Taught in stage 0: Probability basics
- Input truncation
- A model silently dropping text past its input limit, such as 256 word pieces for all-MiniLM-L6-v2. The resulting vector says nothing about the dropped text.
- Taught in stage 5: Search by meaning
- Instruction tuning
- Further training of a pretrained language model on many instructions paired with good responses, so it answers requests instead of just continuing text.
- Taught in stage 4: Your first model call: tokens, cost, and latency
- Inverse document frequency (idf)
- A term weight that is high for rare terms and low for common ones: idf(t) = ln(1 + (N - n_t + 0.5) / (n_t + 0.5)) for N chunks, n_t of which contain t.
- Taught in stage 5: Evaluating and improving retrieval
- JSON
- JavaScript Object Notation: a text format for objects with named fields, such as {"answer": "24 minutes", "found_in_note": true}.
- Taught in stage 4: Structured output you can trust
- JSON Lines
- A file format with one JSON object per line (extension .jsonl). Appending never rewrites the file, and each line loads on its own.
- Taught in stage 4: Production-grade calls: streaming, retries, caching
- JSON-RPC 2.0
- The message format MCP uses: a request has jsonrpc, id, method, and params; a response has the same id and a result or an error; a notification has no id and gets no reply.
- Taught in stage 6: MCP: tools any client can use
- Keyword search
- Ranking texts by the words they share with the query, ignoring stop words such as "the". It misses paraphrase but catches exact rare strings.
- Taught in stage 5: Search by meaning
- Language model
- A model that assigns a probability to the next token given the tokens before it.
- Taught in stage 3: The bigram model
- Large language model (LLM)
- A GPT-style language model with billions of parameters trained on vast text, usually further trained to follow instructions.
- Taught in stage 3: A tiny transformer
- Latency
- How long a call takes: the wait for the first token plus the time to generate the rest, which grows with every output token. 0.5 s + 300 tokens * 0.02 s = 6.5 s.
- Taught in stage 4: Your first model call: tokens, cost, and latency
- Launch gate
- Thresholds written down before looking at results, such as a minimum pass rate per category, that decide ship or hold.
- Taught in stage 7: Choose the fix, then ship
- Layer
- Several neurons reading the same inputs, computed together as h = x @ W + b, one column of W per neuron.
- Taught in stage 2: The neuron and nonlinearity
- Layer normalization
- Rescaling each position's C numbers to mean 0 and variance 1, then applying a learned scale and shift: gamma * (x - mean) / sqrt(variance + eps) + beta.
- Taught in stage 3: A tiny transformer
- Learning rate
- The small positive number lr that sets the size of each gradient-descent step. Too small crawls; too large overshoots and diverges.
- Taught in stage 1: Gradient descent
- Least privilege
- Giving an agent only the tools and access its task needs, read-only by default, so a fooled model has little it can damage.
- Taught in stage 6: Guardrails: data is not instructions
- Least-squares fit
- The parameters with the lowest possible mean squared error on the data. For a line it has a closed form, which np.polyfit solves.
- Taught in stage 1: Gradient descent
- Likelihood
- The probability a model assigns to the observed data; for independent draws, the product of each draw's probability. It compares models on the same data, higher is better.
- Taught in stage 0: Probability basics
- LLM-as-judge
- A second model call that reads the question, the context, the answer, and a rubric, then returns a verdict. Calibrate it against human labels before trusting it.
- Taught in stage 7: LLM-as-judge
- Local derivative
- How one operation's output moves when one of its inputs moves. For out = a * b, d(out)/da = b.
- Taught in stage 2: Backpropagation with a tiny autograd
- Log-likelihood
- The sum of the logs of each observation's probability under a model. It ranks models like the likelihood but never underflows.
- Taught in stage 0: Probability basics
- Log-sum-exp
- LSE(z) = log(sum of exp(z_j)), computed stably as m + log(sum of exp(z_j - m)) with m = max(z). log(softmax(z)_i) = z_i - LSE(z).
- Taught in stage 0: Exponentials and logs
- Logit
- A raw score a model outputs before it is turned into a probability. Logits can be any real number.
- Taught in stage 0: Exponentials and logs
- Loop invariant
- A statement true at the top of every iteration. For the agent loop: roles alternate, every tool_use id has a matching tool_result, and at most MAX_STEPS calls have run.
- Taught in stage 6: The agent loop
- Loss function
- A function that turns all of a model's misses into one number where lower is better. Training minimizes it.
- Taught in stage 1: Measuring wrong: loss functions
- Matrix
- A 2-D array: a stack of vectors as rows. A matrix of shape (n, d) holds n vectors of d numbers.
- Taught in stage 1: Vectors and matrices in numpy
- Matrix multiply
- (n, d) @ (d, k) gives (n, k), where entry (i, j) is row i of the left dotted with column j of the right. The inner sizes must match.
- Taught in stage 1: Vectors and matrices in numpy
- max_tokens
- A hard ceiling on how many tokens the model may generate in one reply. It is not a target or a price: you pay only for the tokens actually generated.
- Taught in stage 4: Your first model call: tokens, cost, and latency
- Maximum-likelihood estimate
- The parameters that give the training data the highest likelihood, which is the same as the lowest cross-entropy. For a bigram table it is the normalized counts.
- Taught in stage 3: The bigram model
- MCP host, client, and server
- The host is the app that runs the model and the loop; inside it, one client connects to one server; the server exposes capabilities and answers requests, never calling a model.
- Taught in stage 6: MCP: tools any client can use
- MCP resource
- Read-only data an MCP server offers by URI, such as notes://index, loaded by the application rather than called by the model.
- Taught in stage 6: MCP: tools any client can use
- Mean absolute error (MAE)
- MAE = (1/n) * sum over i of |prediction_i - target_i|, the average size of the misses.
- Taught in stage 1: A model is a function with parameters
- Mean pooling
- Turning per-token vectors into one vector by averaging them: v = (1/T) * sum over t of h_t for T tokens.
- Taught in stage 5: Search by meaning
- Mean reciprocal rank (MRR)
- The mean over questions of 1 / (rank of the first relevant result), 0 if none is found. Rank 1 gives 1, rank 3 gives 0.33.
- Taught in stage 5: Evaluating and improving retrieval
- Mean squared error (MSE)
- MSE = (1/n) * sum over i of (prediction_i - target_i)^2. It punishes large misses more and is smooth, which gradient descent needs.
- Taught in stage 1: Measuring wrong: loss functions
- Messages API
- The chat call client.messages.create(model, max_tokens, system, messages), where messages is a list of turns, each with a role (user or assistant) and content.
- Taught in stage 4: Your first model call: tokens, cost, and latency
- Mini-batch
- A random group of B training examples whose mean loss gives one gradient and one step. Its gradient equals the full-data gradient on average.
- Taught in stage 2: The training loop
- Model
- A function that turns an input into a prediction, with its behavior set by parameters. Training changes the parameters, never the code.
- Taught in stage 1: A model is a function with parameters
- Model Context Protocol (MCP)
- An open standard for exposing tools, resources, and prompts to any AI app. Wrap a tool set once as a server, and N apps and M tool sets need N + M pieces instead of N * M.
- Taught in stage 6: MCP: tools any client can use
- Model tier
- A provider's range of models that trade capability for speed and price. Start with the smallest tier that passes your test questions.
- Taught in stage 4: Your first model call: tokens, cost, and latency
- Multi-head attention
- Several attention heads run side by side, their outputs concatenated and mixed by a projection, so different heads can look at different things.
- Taught in stage 3: A tiny transformer
- Multilayer perceptron (MLP)
- A stack of fully connected layers with an activation after each hidden layer. Sizes [2, 8, 8, 1] have 105 parameters.
- Taught in stage 2: The training loop
- Natural logarithm (log)
- The inverse of exp, defined for positive numbers: log(exp(x)) = x. It turns products into sums, log(a * b) = log(a) + log(b), and is negative between 0 and 1.
- Taught in stage 0: Exponentials and logs
- Negative log-likelihood (NLL)
- Average NLL = -(1/n) * sum over i of log P(x_i). Lower is better; a uniform model over k outcomes scores log(k).
- Taught in stage 0: Probability basics
- Neuron
- A weighted sum of inputs plus a bias, passed through an activation: z = w1*x1 + ... + wn*xn + b, then a = f(z).
- Taught in stage 2: The neuron and nonlinearity
- nn.Module
- PyTorch's base class for anything that holds parameters; a model subclasses it and defines forward.
- Taught in stage 2: Generalization, then PyTorch
- Norm
- The length of a vector: ||a|| = sqrt(sum over i of a_i^2). ||[3, 4]|| = 5.
- Taught in stage 1: Vectors and matrices in numpy
- numpy array
- A block of numbers that all share one type (its dtype), with arithmetic applied elementwise, position by position. np.array([1, 2]) + np.array([10, 20]) is [11, 22].
- Taught in stage 0: Numbers and arrays
- One-hot vector
- A vector of zeros with a single 1 at one position, used to pick out one row of a matrix.
- Taught in stage 3: Embeddings and self-attention
- Optimizer
- The object that applies the update rule to every parameter, such as torch.optim.SGD. optimizer.step() updates; optimizer.zero_grad() resets gradients.
- Taught in stage 2: Generalization, then PyTorch
- Overfitting
- Fitting the training examples, noise included, so well that the model does worse on new data. Training loss keeps falling while validation loss turns up.
- Taught in stage 2: Generalization, then PyTorch
- Overflow
- A result too large for a float to hold (above about 1.8e308), so it becomes inf. exp(710) overflows in float64.
- Taught in stage 0: Exponentials and logs
- Overlap
- Words shared by consecutive windows. With size 80 and overlap 20, windows start every 60 words, so a phrase of up to 20 words at a boundary appears whole in one window.
- Taught in stage 5: Chunking and indexing
- Parallel tool calls
- Several tool_use blocks in one response. Each gets its own tool_result, all in the same user turn.
- Taught in stage 6: Tool calling: the model asks, your code acts
- Parameter
- A number inside a model that stays fixed while it runs and is chosen by training, such as the slope w and intercept b of prediction = w * x + b.
- Taught in stage 1: A model is a function with parameters
- Paraphrase
- The same fact in different words, such as "levain" and "active starter". Keyword search scores it zero; an embedding model can match it.
- Taught in stage 5: Search by meaning
- Partial derivative
- The derivative of a function of several inputs with respect to one of them, holding the others fixed. For f(x, y) = x^2 * y, df/dx = 2xy.
- Taught in stage 0: Slopes and derivatives
- Pass rate
- passed / total, reported per category and overall. The overall number is a summary that can hide a loss in one category behind a gain in another.
- Taught in stage 7: Evals before opinions
- Percentile (p50, p95)
- The value below which p percent of measurements fall. p50 is the median; p95 is what the slowest users live with. Better than the mean for latency.
- Taught in stage 7: Observability and cost
- Perplexity
- exp of the average NLL: the number of equally likely choices a model is effectively picking among at each step. A uniform guess over 95 characters has perplexity 95.
- Taught in stage 3: The bigram model
- Position bias
- A pairwise judge leaning toward answer A or B by slot, not content. Ask twice with the order swapped and count a win only when both agree.
- Taught in stage 7: LLM-as-judge
- Position embedding
- A learned vector for each position 0 to T - 1, added to the token vectors so the model knows where each token sits.
- Taught in stage 3: A tiny transformer
- Power rule
- The derivative of x^n is n * x^(n-1). So x^3 gives 3x^2, and a constant gives 0.
- Taught in stage 0: Slopes and derivatives
- Probability distribution
- An assignment of a probability between 0 and 1 to each possible outcome, with all of them summing to 1. Counts divided by their total give one.
- Taught in stage 0: Probability basics
- Product rule
- The derivative of a product: (u * v)' = u' * v + u * v'. For x^2 * (3x + 1) at x = 2 it gives 4 * 7 + 4 * 3 = 40.
- Taught in stage 0: Slopes and derivatives
- Prompt as a spec
- Writing a prompt the way you would brief a new colleague: role, rules, the material in delimited tags, the output format, and an exact fallback for when the material runs out.
- Taught in stage 4: Prompts are specs: context engineering
- Prompt caching
- The provider stores its work on a stable prompt prefix marked with cache_control. Later calls that start with exactly the same tokens read it back, faster and far cheaper; one changed character is a miss.
- Taught in stage 4: Production-grade calls: streaming, retries, caching
- Prompt injection
- Text that tries to override a model's instructions. Direct injection is typed by the user; indirect injection hides in data the agent reads, such as a note or web page.
- Taught in stage 6: Guardrails: data is not instructions
- Pseudonymous id
- An identifier, such as a hashed user name, that hides the name but not the link: anyone with the list of names can hash them and match. It is not anonymous.
- Taught in stage 7: Observability and cost
- Pydantic
- A Python library that turns a typed class into a validator. Model.model_validate_json(text) returns a typed object or raises ValidationError naming each problem.
- Taught in stage 4: Structured output you can trust
- Query, key, value
- Three learned linear maps of each position's vector: the query says what it looks for, the key what it offers, and the value what it passes on.
- Taught in stage 3: Embeddings and self-attention
- Quotient rule
- The derivative of a quotient: (u / v)' = (u' * v - u * v') / v^2. For x / (x + 1) at x = 1 it gives (2 - 1) / 4 = 0.25.
- Taught in stage 0: Slopes and derivatives
- Random seed
- The starting number of a pseudo-random generator. The same seed always gives the same sequence, which makes a run reproducible: np.random.default_rng(0).
- Taught in stage 0: Numbers and arrays
- ReAct
- Reason, act, observe in turns: the pattern of an agent that thinks, calls a tool, reads the result, and repeats. Named after a 2022 paper.
- Taught in stage 6: The agent loop
- Recall@k
- For one question, |relevant intersect top k| / |relevant|: the share of relevant items found in the top k. Averaged over the question set.
- Taught in stage 5: Evaluating and improving retrieval
- Reciprocal rank fusion (RRF)
- Combining rankings by rank alone: RRF(d) = sum over rankings of 1 / (60 + rank). It never adds scores on different scales.
- Taught in stage 5: Evaluating and improving retrieval
- Refusal precision and recall
- Treating a refusal as a prediction that a question is unanswerable: precision = TP / (TP + FP), recall = TP / (TP + FN). Each is easy to game alone.
- Taught in stage 7: Evals before opinions
- ReLU
- Rectified linear unit: relu(z) = max(0, z). Positives pass unchanged; negatives become 0.
- Taught in stage 2: The neuron and nonlinearity
- Reranker
- A slower, better model that reorders the top candidates from a cheap first-stage search. Its gain shows up mostly in MRR.
- Taught in stage 5: Evaluating and improving retrieval
- Residual connection
- x = x + f(x): adding a sublayer's output to its input, so the gradient flows back through the 1 in 1 + f'(x) and deep stacks stay trainable.
- Taught in stage 3: A tiny transformer
- Retrieval failure
- An answer that failed because the note holding the fact was not retrieved. No prompt change can fix it; fix chunking, k, search, or the index.
- Taught in stage 7: Choose the fix, then ship
- Retrieval-augmented generation (RAG)
- Retrieve relevant text, put it in the prompt, and have the model answer from it. It brings facts the model was never trained on into the call.
- Taught in stage 5: Grounded answers with citations
- Rubric
- The judge's spec: yes/no criteria, each about one property, such as "grounded: every factual claim is stated in the excerpt".
- Taught in stage 7: LLM-as-judge
- Sampling
- Drawing outcomes at random so each appears with its probability, as rng.choice(outcomes, p=probs) does.
- Taught in stage 0: Probability basics
- Scaled dot-product attention
- out = softmax(mask(Q K^T / sqrt(d))) V. Dividing by sqrt(d) keeps the scores from saturating the softmax.
- Taught in stage 3: Embeddings and self-attention
- Schema
- A precise description of the data shape you accept: which fields, which types, which are required. JSON Schema writes it as JSON; a Pydantic class writes it in Python.
- Taught in stage 4: Structured output you can trust
- SDK
- Software development kit: a library, such as the anthropic Python package, that wraps an API's HTTP requests in ordinary function calls.
- Taught in stage 4: Your first model call: tokens, cost, and latency
- Self-attention
- Each position builds its output as a weighted average of value vectors from the positions it may see, with weights from softmax of query-key dot products.
- Taught in stage 3: Embeddings and self-attention
- Sentence embedding
- A fixed-length vector for a whole text, placed so that texts with similar meaning point in similar directions. all-MiniLM-L6-v2 gives 384 numbers.
- Taught in stage 5: Search by meaning
- Shape
- A tuple giving an array's length along each axis. A grid of 2 rows and 3 columns has shape (2, 3).
- Taught in stage 0: Numbers and arrays
- Sigmoid
- sigmoid(z) = 1 / (1 + exp(-z)) maps one score to a probability between 0 and 1. sigmoid(0) = 0.5.
- Taught in stage 0: Exponentials and logs
- Slope
- How much y changes per unit change in x: (y2 - y1) / (x2 - x1), rise over run. For y = 3x + 1 it is 3 everywhere.
- Taught in stage 0: Slopes and derivatives
- Softmax
- Turns a list of scores into probabilities that sum to 1: softmax(z)_i = exp(z_i) / sum over j of exp(z_j). softmax([2, 1, 0]) = [0.665, 0.245, 0.090].
- Taught in stage 0: Exponentials and logs
- Standard deviation
- The typical distance of numbers from their mean: the square root of the average squared distance.
- Taught in stage 3: Embeddings and self-attention
- Standard error
- The typical wobble of an estimate from sample to sample. For a pass rate p on n items it is about sqrt(p * (1 - p) / n): 0.083 for p = 0.79, n = 24.
- Taught in stage 7: Evals before opinions
- Stateless API
- An API that keeps nothing between calls. A follow-up works only if you resend the earlier turns, and you pay for them again as input tokens.
- Taught in stage 4: Your first model call: tokens, cost, and latency
- stdio transport
- Running a local MCP server as a child process: requests go to its standard input and responses come from its standard output, one JSON message per line. Logs go to stderr.
- Taught in stage 6: MCP: tools any client can use
- Step budget
- A cap on model calls per run, such as 8. It guarantees the loop ends whatever the model does.
- Taught in stage 6: The agent loop
- Stochastic gradient descent (SGD)
- Gradient descent where each step uses the gradient of a random mini-batch rather than all the data.
- Taught in stage 2: Generalization, then PyTorch
- stop_reason
- The response field that says why generation ended: end_turn (finished), max_tokens (cut off at your ceiling), stop_sequence, or tool_use (the model wants a tool run).
- Taught in stage 4: Your first model call: tokens, cost, and latency
- Streaming
- Receiving tokens as they are sampled over one open HTTP response (server-sent events). It cuts the time to the first words, not the total time or the cost.
- Taught in stage 4: Production-grade calls: streaming, retries, caching
- System prompt
- Standing instructions sent in the system field. The provider places them first in the one token sequence the model reads, so they are ordinary input, billed on every call.
- Taught in stage 4: Your first model call: tokens, cost, and latency
- tanh
- tanh(z) = (e^z - e^(-z)) / (e^z + e^(-z)), which squashes any number into (-1, 1). Its derivative is 1 - tanh(z)^2.
- Taught in stage 2: The neuron and nonlinearity
- Target
- The value a prediction should have been for one training example; the data are pairs of an input and a target.
- Taught in stage 1: A model is a function with parameters
- Temperature
- A number the logits are divided by before sampling. Below 1 sharpens the distribution; above 1 flattens it.
- Taught in stage 3: A tiny transformer
- Tensor
- PyTorch's n-dimensional array, like a numpy array, that can record the operations applied to it for autograd.
- Taught in stage 2: Generalization, then PyTorch
- Test set
- Examples kept aside and used once at the very end, because choosing settings by validation loss makes the validation number slightly optimistic.
- Taught in stage 2: The training loop
- Threat model
- Naming the source (where untrusted text enters), the sink (an action with outside effects), and the privilege (what the sink may touch). An attack needs a path from source to sink.
- Taught in stage 6: Guardrails: data is not instructions
- Timeout
- The longest your code waits for a reply before giving up, so one hung connection cannot stall the program forever.
- Taught in stage 4: Production-grade calls: streaming, retries, caching
- Token
- The piece of text one integer id stands for: a byte, a character or a common chunk like " the".
- Taught in stage 3: Text to tokens
- Token budget
- A cap on input plus output tokens across a whole run. Checked after each call, so a run can overshoot by at most one call.
- Taught in stage 6: The agent loop
- Token usage
- The usage field of a response: input_tokens you sent and output_tokens the model wrote. It is what you are billed for.
- Taught in stage 4: Your first model call: tokens, cost, and latency
- Tokenizer
- The pair of functions that turns text into token ids (encode) and ids back into text (decode).
- Taught in stage 3: Text to tokens
- Tool calling
- A contract in which the request lists tools (name, description, input_schema), the model may reply with a tool_use block, and your code runs the function and sends back a tool_result.
- Taught in stage 6: Tool calling: the model asks, your code acts
- tool_result block
- A block in the next user turn carrying a tool's output: {type: tool_result, tool_use_id, content}. Its tool_use_id must match a tool_use id in the assistant turn just before it.
- Taught in stage 6: Tool calling: the model asks, your code acts
- tool_use block
- A response block {type: tool_use, id, name, input} in which the model requests one tool call. The response's stop_reason is tool_use.
- Taught in stage 6: Tool calling: the model asks, your code acts
- Top-k retrieval
- Returning the k highest-scoring chunks for a query. It always returns k results, even when none answers the question, so the prompt must allow a way to decline.
- Taught in stage 5: Grounded answers with citations
- Top-k sampling
- Keeping only the k largest logits and setting the rest to -inf before sampling, so the unlikely tail is never drawn.
- Taught in stage 3: A tiny transformer
- Topological order
- A list of graph nodes where every node comes after all the nodes it reads from. Backprop runs it in reverse, starting at the loss.
- Taught in stage 2: Backpropagation with a tiny autograd
- Trace
- A record of one request from start to finish: ids, model, prompt version, retrieved notes, token counts, stop reason, latency, and cost, written as one JSON line.
- Taught in stage 7: Observability and cost
- Training loop
- The five moves repeated for each batch: forward, loss, zero-grad, backward, step.
- Taught in stage 2: The training loop
- Training set
- The examples that produce the gradients a model learns from.
- Taught in stage 2: The training loop
- Transformer
- A network built from repeated blocks of attention and MLP layers, each wrapped in a residual connection with layer norm.
- Taught in stage 3: A tiny transformer
- Transient error
- A failure that time can fix: HTTP 429 (rate limited), 5xx including 529 (overloaded), a timeout, or a dropped connection. Retry these; never retry 400, 401, 403, or 404.
- Taught in stage 4: Production-grade calls: streaming, retries, caching
- Transpose
- A.T swaps rows and columns, turning shape (n, d) into (d, n).
- Taught in stage 1: Vectors and matrices in numpy
- Underfitting
- Both training and validation loss stay high, because the model is too small or undertrained.
- Taught in stage 2: Generalization, then PyTorch
- Underflow
- A result too close to zero for a float to hold, so it becomes 0.0. Multiplying many small probabilities underflows; adding their logs does not.
- Taught in stage 0: Exponentials and logs
- Unit vector
- A vector of length 1, made by dividing a vector by its L2 norm. For unit vectors the dot product equals the cosine similarity, so D @ q scores every row at once.
- Taught in stage 5: Search by meaning
- Universal approximation theorem
- A network with one hidden layer, enough units and a nonlinear activation can approximate any continuous function on a bounded region. It says such weights exist, not how to find them.
- Taught in stage 2: The neuron and nonlinearity
- UTF-8
- The standard way to store text as bytes (0 to 255). English letters are one byte each; other characters take two to four.
- Taught in stage 3: Text to tokens
- Validation retry
- On a validation failure, append the bad reply and the error text to the conversation and ask for corrected output, with a cap of 2 or 3 attempts. The error changes the context, so the next sample differs.
- Taught in stage 4: Structured output you can trust
- Validation set
- Examples held out from training that never produce a gradient, used to measure the model on unseen data and to choose settings.
- Taught in stage 2: The training loop
- Variance
- The average squared distance of numbers from their mean. For [1, 2, 3, 6] it is 3.5.
- Taught in stage 3: A tiny transformer
- Vector
- An ordered list of numbers, a 1-D array, where each position has one fixed meaning, such as the count of one vocabulary word.
- Taught in stage 1: Vectors and matrices in numpy
- Vector database
- A service that stores vectors and answers nearest-neighbor queries, usually with an ANN index. It earns its place at millions of vectors or many concurrent writers.
- Taught in stage 5: Chunking and indexing
- Vector index
- The stored vectors plus their records. Pocket's is a float32 array (row i) and a JSON list (record i) written in the same order, joined only by position.
- Taught in stage 5: Chunking and indexing
- Vectorization
- Replacing a Python loop with one array operation, so the loop runs inside numpy's compiled code, often 50 or more times faster.
- Taught in stage 0: Numbers and arrays
- Verbosity bias
- A judge preferring longer answers even when the extra words add nothing. Test it by padding a correct answer and checking whether the verdict changes.
- Taught in stage 7: LLM-as-judge
- Vocabulary
- The set of all tokens a tokenizer or model knows, each with its own id.
- Taught in stage 3: Text to tokens
- Weight decay
- Adding (λ/2) * sum of w^2 to the loss, so each step becomes w = w - lr * (grad + λ*w) and every weight shrinks a little.
- Taught in stage 2: Generalization, then PyTorch
- XOR
- Exclusive or: 1 when exactly one of two inputs is 1. No straight line separates its cases, so it needs a hidden layer with a nonlinearity.
- Taught in stage 2: The neuron and nonlinearity
- Zero-grad
- Resetting every parameter's gradient before each backward pass, so gradients from earlier batches do not pile up.
- Taught in stage 2: The training loop