Glossary
The canonical terms for this course, following Huyen's usage. A term is added only after you've shown you can use it.
Foundations
- Token
- The basic unit a language model reads and writes: a character, a word, or part of a word. About ¾ of a word for GPT-4, so 100 tokens ≈ 75 words.
- Language model
- A model encoding the statistics of language. In this course it always means an autoregressive one, which predicts the next token from the preceding tokens.Ambiguity: masked models (e.g. BERT) fill in blanks instead; they're mentioned but not our focus.
- Self-supervision
- Training where the labels come from the input itself: each next token is the label for the tokens before it. This is what let language models scale.Avoid: unsupervised learning (that needs no labels at all)
- Foundation model
- A large general-purpose model (an LLM or large multimodal model) that applications are built on top of.Avoid: “LLM” when the model also handles images or audio
- AI engineering
- Building applications on top of foundation models: less about model development, more about adapting and evaluating models.Avoid: LLMOps, AIOps
- AI stack
- The three layers of any AI application: application development, model development, and infrastructure. Work starts at the top and moves down as needed.
Adaptation
- Model adaptation
- Making an existing model fit your task. Its two families are prompt-based techniques (no weight change) and finetuning (weights change).
- Prompt engineering
- Adapting a model through its input alone (instructions, examples, context) without changing its weights.Avoid: “training” or “finetuning” ChatGPT by pasting text into it
- RAG (retrieval-augmented generation)
- A prompt-based technique that retrieves relevant information (e.g. from a database) and adds it to the model's context.
- Pre-training
- Training a model from randomly initialized weights. For LLMs this means training for text completion. By far the most expensive stage.
- Finetuning
- Continuing to train an already-trained model, which updates its weights.
- Post-training
- Training after pre-training, done by the model developer (e.g. to follow instructions).Ambiguity: conceptually the same as finetuning. In this course, “post-training” is what the model provider does and “finetuning” is what you as the app developer do.
Sampling
- Sampling
- How a model picks each output token from its probability distribution over the vocabulary. It is the source of AI's probabilistic behavior.
- Greedy sampling
- Always picking the most likely token, equivalent to temperature 0. Consistent but bland.
- Top-p (nucleus) sampling
- Sampling only from the smallest set of top tokens whose probabilities add up to p, so the candidate pool grows or shrinks with the context.
- Stopping condition
- A rule that ends generation: a maximum token count, or stop tokens. It caps cost and latency but can truncate structured output.
- Test-time compute
- Spending more inference on a query, e.g. generating N candidates and keeping the best (best-of-N). Costs roughly N×.Ambiguity: “test time” here means inference in general, not only testing.
- Inconsistency
- A model giving different outputs for the same or nearly the same input. It can't be fully removed even with temperature 0 and a fixed seed, because the serving hardware matters.
- Temperature
- A sampling knob that divides the logits before softmax. Lower temperature sharpens the distribution, so the top token gets likelier and output is more consistent. Higher temperature flattens it, so output is more varied (“creative”). 0 means greedy.
- Hallucination
- A model stating something not grounded in fact or in its context. Huyen gives two hypotheses. Self-delusion: the model can't tell its own generated text from given facts, so one wrong token snowballs. Knowledge mismatch: SFT taught it to imitate labelers' answers that used knowledge the model doesn't have, so it learns to make things up.
Prompting
- In-context learning
- A model learning a task from instructions and examples in its prompt, with no weight update. Each example is a shot: zero-shot has none, few-shot has a handful.
- System prompt
- The developer's instructions, sent separately from the user prompt. Both are joined into one sequence before the model sees them.
- Chat template
- The model-specific format (special tokens, roles) that joins system, user and assistant messages into one sequence. A mismatch fails silently.Not the same as a prompt template, which is your own fill-in-the-blanks string.
- Chain-of-thought (CoT)
- Asking the model to reason step by step before answering. It improves accuracy but costs output tokens and latency.
- Prompt injection / jailbreaking
- Getting a model to ignore its intended instructions. Huyen uses “jailbreaking” for both. Indirect prompt injection delivers the instruction through tool outputs or retrieved content.
- Instruction hierarchy
- Training a model to prioritize instructions: system prompt > user prompt > model outputs > tool outputs.
Agents
- Agent
- Anything that perceives its environment and acts on it. In an AI agent, the model plans the actions, reads the feedback and decides when the task is done. A RAG system is a simple agent.
- Workflow
- LLM calls arranged along code paths the developer wrote, in contrast to an agent, where the model chooses the path (Anthropic's distinction).
- Tool / function calling
- A tool is a function the model may use. The model returns a call (name + arguments), and your code executes it and returns the result. The set of tools is the tool inventory.
- Write action
- A tool call that changes the environment (send email, update a database, move money), as opposed to a read-only one. A candidate for human approval.
- ReAct
- The agent pattern of interleaving Thought → Act → Observation until the agent decides it's finished.
- Reflection
- An agent evaluating its plan or results (is it feasible, on track, actually done?) and correcting course. A reflection error is falsely concluding the task is done.
- Planning failure / tool failure
- Planning failures are the model's wrong decisions: invalid tool, invalid parameters, wrong parameter values, goal failure, reflection error. A tool failure is a correctly called tool returning a wrong output, or a needed tool missing.
- Short-term / long-term memory
- Short-term memory is the context window: fast, limited, gone after the task. Long-term memory is an external store reached by retrieval, persisting across sessions. The weights are the model's internal knowledge.