Appendix F — Appendix F: Glossary

Short definitions of the terms used in the book, in the sense the book uses them.

Abstention. Declining to answer when the available context does not contain the answer; a RAG system that abstains beats one that guesses. (Chapter 7)

Adapter. The small set of new weights LoRA trains while the base model stays frozen; swapping adapters reuses one base model across many tasks. (Chapter 16)

Agent. A system where the model decides the control flow at run time, choosing which tools to call and when to stop, whereas in a workflow you fix the steps in advance. Contrast with workflow. (Chapter 12)

ARIMA. Autoregressive integrated moving average, a classical statistical forecaster that is fitted to one series at a time. It is a strong baseline that any foundation forecaster has to justify itself against. (Chapter 20)

Bag-of-words. Representing text by which words it contains, ignoring order; the basis of keyword methods like TF-IDF. (Chapters 6, 13)

Base model. What pretraining produces: a model that continues text fluently but does not follow instructions, until instruction and preference tuning turn it into an assistant. Contrast with instruct model. (Chapter 1)

Bi-encoder. An embedding model that encodes the query and each document separately and compares the vectors. It is fast enough to search a whole corpus, but it is a blunter judge than a cross-encoder. (Chapter 8)

Break-even. The volume at which a fixed up-front cost (a training run, or a self-hosted GPU) becomes cheaper per unit than paying per call; the deciding number for fine-tuning and for self-hosting. (Chapters 4, 15)

Calibration. Whether a model’s stated uncertainty matches reality, for example whether an 80 percent prediction interval really contains the true value about 80 percent of the time. (Chapter 20)

Chunk. A small piece of a document, sized so a query can match a specific passage, where a whole document would be too coarse a unit to match. (Chapter 6)

Closed frontier model. A top-capability model available only through a provider’s API, which you cannot host yourself or fully fine-tune. Contrast with open-weight model. (Chapter 15, Appendix E)

Confusion matrix. A table of predicted against actual categories whose off-diagonal cells show which categories a classifier mistakes for which, the detail a single accuracy number hides. (Chapter 9)

Context engineering. Deciding what goes into a model’s limited context window, given that tokens cost money and attention degrades over long inputs. (Chapter 10)

Context window. The maximum number of tokens one model call can hold, prompt and reply together. Everything you send competes for this one budget, and what overflows is dropped. (Chapter 2)

Contextual retrieval. Prepending document context to each chunk before embedding, so a chunk carries its own provenance and is easier to retrieve. (Chapter 8)

Cosine distance. One minus cosine similarity, used as a drift signal. A larger value means an input is further in direction from a reference point. (Chapter 24)

Cosine similarity. A measure of how aligned two vectors are; for normalized embeddings it is their dot product, and it is how semantic search ranks matches. (Chapter 6)

Cross-encoder. A model that reads the query and a document together and scores their relevance. It is sharper than a bi-encoder but too slow for a whole corpus, so it is used to rerank a shortlist. (Chapter 8)

Cross-validation. Estimating accuracy by training on most of the data and testing on the held-out rest, repeated over several folds and averaged, so the number does not hinge on one lucky split. (Chapter 13)

Customization ladder. The order of options for adapting a model, from prompting and few-shot up through retrieval, fine-tuning, and reinforcement, cheapest rung tried first. (Chapter 15)

Data residency. Rules on where data may physically be stored and processed. The most common reason to self-host is a residency constraint. (Appendix D)

Diarization. Segmenting audio by speaker, labeling who spoke when, separate from transcribing what was said. (Chapter 18)

Dimensionality reduction. Projecting high-dimensional vectors such as embeddings down to two or three dimensions to visualize them. PCA, t-SNE, and UMAP are common methods, all of which distort distances to some degree. (Chapter 13)

Distillation. Using a large model’s outputs to fine-tune a smaller, cheaper model that inherits much of its skill on a task. (Chapter 17)

Drift. A change over time in the distribution of inputs (or model behavior) that can silently degrade quality. (Chapter 24)

Embedding. A vector that represents a piece of text by meaning, positioned so that similar meanings sit near each other. (Chapter 6)

Endpoint. A single URL a service answers requests at; wrapping a function in an HTTP endpoint is what turns a notebook into something other applications can call. (Chapter 25)

Entity resolution. Merging different mentions of the same real-world thing (Acme, Acme Inc., the company) into one node when building a knowledge graph. (Chapter 21)

Epoch. One full pass over the training data; a fine-tune usually takes several. (Chapter 16)

Evaluator-optimizer. A workflow that creates a candidate, evaluates it against a criterion, and revises it if it fails, looping until it passes. (Chapter 11)

Faithfulness. Whether an answer is supported by its retrieved source or is invented; one of the judge’s verdicts and the core grounding metric. (Chapter 9)

Few-shot. Teaching a model a task by including a handful of input-output examples in the prompt, with no training. (Chapter 15)

Fine-tuning. Changing a model’s weights by training on examples, to alter its default behavior. A common mistake is fine-tuning to add knowledge, which is better served by retrieval. (Chapters 15-16)

Foundation model. A large model pretrained on broad data that can be prompted or adapted for many tasks without task-specific training; the language, vision, and time-series models this book builds on. (Chapter 1)

Golden set. A small, trusted set of inputs with known correct answers, written in advance, used to measure quality and to compare one change against another. (Chapter 9)

Graph RAG. Answering a question by traversing a knowledge graph to gather connected facts, then supplying them to a model, for multi-hop questions flat retrieval cannot answer. (Chapter 22)

Guardrail. A check wrapped around a model call that screens inputs before the model sees them or validates outputs before anything acts on them, so a deceived model cannot do real damage. (Chapter 23)

Hallucination. A model producing plausible, confident, and wrong output. The central reliability risk. (Chapter 1)

High-risk (AI). A regulatory tier (under the EU AI Act and similar laws) for uses such as employment, credit, and housing decisions, carrying the heaviest obligations; the tier is determined by the use, whatever the underlying tool. (Appendix D)

Hybrid search. Combining meaning-based (dense) retrieval with keyword-based (sparse) retrieval. (Chapter 8)

In-context learning. A model picking up a task from what is in the prompt, instructions or a few examples, with no change to its weights. (Chapter 15)

Instruct model. A base model further trained on instruction-response pairs and human preferences so that it answers requests, whereas a base model merely continues the text; every model this book calls is one. Contrast with base model. (Chapter 1)

Knowledge graph. A representation of text as entities (nodes) and relationships (edges). (Chapter 21)

KV cache. The running memory a model keeps of the tokens processed so far. It grows with context length and competes for GPU memory during serving. (Chapter 4)

Learning rate. The size of each step the optimizer takes when updating weights during training; small adapters tolerate a higher one than a full fine-tune does. (Chapter 16)

LLM-as-judge. Using a model to grade open-ended outputs against a rubric or source, when there is no single correct answer to match. (Chapter 9)

LoRA. Low-Rank Adaptation: fine-tuning by training small adapter matrices while freezing the original weights, a fraction of a percent of the parameters. (Chapter 16)

Lost in the middle. The documented tendency of models to attend most reliably to the beginning and end of a long input and least reliably to its middle. (Chapter 10)

MCP (Model Context Protocol). A standard for exposing tools so any client (a coding assistant, an agent) can discover and call them. (Chapter 12)

Mean absolute error (MAE). The average absolute gap between predicted and actual values; the headline accuracy metric for forecasting. (Chapter 20)

Mixture-of-experts (MoE). An architecture that advertises two parameter counts, total and active. A router uses only a few expert subnetworks per token, so memory scales with the total while speed scales with the active count. (Chapters 1, 4)

Model collapse. The degradation when models are trained on the output of earlier models across generations, compounding distortions until quality drifts from reality; the reason to keep real data in any synthetic mix. (Chapter 17)

Multi-hop. A question whose answer requires chaining several connected facts, each from a different place; what graph retrieval handles and flat retrieval often misses. (Chapter 22)

Multimodal. Of a model, accepting more than one kind of input (text plus images, or audio), so one call can read a document, a chart, or a screenshot. (Chapter 19)

Needle in a haystack. A benchmark that hides one fact in a long context and checks whether the model still finds it; a floor test for long-context recall. (Chapter 10, Appendix B)

Open-weight model. A model whose trained weights are released for you to download, host, and fine-tune, though not necessarily its training data or code, so not the same as fully open-source. Contrast with closed frontier model. (Chapter 15, Appendix E)

Orchestrator-workers. A workflow where one model call breaks a task into pieces, worker calls handle the pieces, and the results are assembled into one answer. (Chapter 11)

PEFT. Parameter-efficient fine-tuning: the family of methods, LoRA among them, that train only a small fraction of a model’s parameters, where a full fine-tune trains them all. (Chapter 16)

PII. Personally identifiable information: names, contact details, and other data tied to a person, which triggers data-protection rules and is worth redacting before a third-party call. (Appendix D)

Pilot scorecard. The task, baseline, success metric, owner, and cost per outcome, written down before a pilot starts, that decide whether it graduates to production. (Chapter 25)

Precision@k. The fraction of the top k retrieved chunks that are actually relevant to the query; the workhorse metric for retrieval quality. (Chapter 9)

Prediction interval. The range a forecast expects the true value to fall within most of the time; a forecast reported without one is only half a forecast. (Chapter 20)

Preference tuning. Fine-tuning on pairs of answers where one is preferred over the other, most often via DPO (direct preference optimization); for behavior easier to rank than to write down. (Chapters 15, 17)

Privilege separation. Keeping the model from holding the power to do harm directly, so it can request an action but a separate, validated step carries it out. (Chapter 23)

Prompt caching. Billing a repeated, stable prompt prefix at a discount, triggered by putting the fixed part of a prompt first. (Chapter 2)

Prompt injection. Smuggling instructions into untrusted input to hijack a system; indirect injection arrives via retrieved content or tools. (Chapter 23)

QLoRA. LoRA with the frozen base model stored in 4-bit precision, so a larger model fits in less memory. (Chapter 16)

Quantization. Storing a model’s weights at lower precision (8-bit, 4-bit) so it fits in less memory, trading a little accuracy for a much smaller footprint. (Chapter 16)

RAG (retrieval-augmented generation). Retrieving relevant passages and giving them to a model as context so its answer is grounded in your documents. (Chapter 7)

Reasoning model. A model trained to work through steps before answering; more capable on multi-step tasks, but slower and more expensive. (Chapter 2)

Recall. For retrieval or extraction, the fraction of the truly relevant items that were found; the natural pair to precision, which measures how many of the found items were relevant. (Chapter 9)

Reciprocal rank (MRR). One over the rank of the first relevant result, averaged across queries as mean reciprocal rank; it rewards a retriever for putting a right answer near the top. (Chapter 9)

Reinforcement fine-tuning. Training a model against a reward signal or grader, where supervised tuning would use fixed labels; the rung above supervised and preference tuning, beyond this book’s scope. (Chapter 15)

Reranking. Rescoring a retrieved shortlist with a cross-encoder that reads query and passage together, more precise than the embedding model but too slow for the whole corpus. (Chapter 8)

Routing. Sending each input to the handler or model that fits it: a cheap model for easy work and a stronger one for the hard cases (Chapter 2), or a classifier that dispatches to a specialized handler (Chapter 11). (Chapters 2, 11, 12)

Schema linking. Selecting only the handful of relevant tables to put in a text-to-SQL prompt, so that the whole large schema need not be sent. (Chapter 14)

Self-consistency. Running the same prompt several times and taking the majority answer, to stabilize an ambiguous or high-stakes decision. (Chapter 11)

Semantic layer. A curated catalog of defined metrics and dimensions between a model and the raw tables: the model requests metrics by name, so a metric nobody defined cannot be queried, the production guard against silently wrong text-to-SQL. (Chapter 14)

Structured output. A model reply constrained to a schema (via Pydantic and a library like Instructor), validated so it can load straight into a dataframe. (Chapter 3)

Supervised fine-tuning (SFT). Fine-tuning on input-output examples, the form used for formats, styles, and narrow judgments; the default meaning of “fine-tuning” in this book. (Chapters 15, 16)

Synthetic data. Training data generated by a model, with no collection from the real world; useful but prone to distribution mismatch if not mixed with real data. (Chapter 17)

Temperature. A setting controlling randomness in a model’s output; 0 for deterministic analytics tasks, higher for variety. (Chapter 2)

Text-to-SQL. Translating a natural-language question into a database query, running it, and returning the result. (Chapter 14)

TF-IDF. Term frequency-inverse document frequency: a keyword retrieval method that scores documents by word overlap, weighting rarer words more; the bag-of-words baseline semantic search is measured against. (Chapters 6, 13)

Token. The unit a model reads and is billed in, roughly three-quarters of a word. (Chapter 2)

Top-k. In retrieval, the number of nearest chunks fetched for a query; the main dial trading completeness of the answer against context size and cost. (Chapters 7, 8, 10)

Tracing. Recording every model call’s inputs, outputs, and metadata (model, tokens, cost, latency) so production behavior can be inspected and replayed. (Chapter 24)

Transcription. Turning recorded speech into text, separate from diarization (who spoke when); measured by word error rate. (Chapter 18)

Triple. A subject-relation-object fact (Acme supplies Beta) and the unit a knowledge graph is built from. (Chapter 21)

Unit economics. Cost expressed per business outcome (per ticket triaged, per document summarized), the only framing a business sponsor can act on; a per-token figure carries no meaning for a sponsor. (Chapter 2, Appendix C)

Vector database. A store for embeddings that finds the vectors nearest a query quickly; the index behind semantic search, ChromaDB in this book. (Chapter 6)

Vision-language model. A model that reads images alongside text, used for documents, charts, and screenshots. (Chapter 19)

Word error rate (WER). The fraction of words a transcription gets wrong against a reference; the standard transcription metric. (Chapter 18)

Workflow. A multi-step system where you fix the control flow and the model fills in the steps. Contrast with agent. (Chapter 11)

Zero-shot. Performing a task with no task-specific training or examples, on the strength of the model’s pretraining and the prompt alone; what foundation models made practical. (Chapters 1, 20)