Skip to main content

LLM and Transformer glossary

Essential terms, introduced plainly and linked to canonical explanations

This glossary gives a concise first definition for terms used across the site. It does not replace canonical concept pages: follow the links for deeper explanations where available.

Language models and generation

  • Language model — a model that assigns probabilities to text sequences or their next tokens, conditional on context. See the LLM panorama.
  • Generative model — a model that defines a distribution from which new samples can be produced, possibly conditioned on an input; it is not necessarily a language model.
  • LLM (large language model) — a language model trained at large scale. No universal parameter threshold defines this category; see scaling laws.
  • Scaling law — an empirical relationship between a training resource (parameters, data, or compute) and a measure such as loss; it depends on the regime studied and does not establish a universal LLM threshold. See scaling laws.

Text and data

  • Token — a discrete unit processed by a model; it may be a word, subword, character, or another segment.
  • Tokenization — converting text into a sequence of token IDs.
  • Vocabulary — the set of tokens a tokenizer can represent.
  • Prefix — the part of a sequence already available to condition the next prediction.
  • Forward pass — the network computation that transforms the context into representations and logits while keeping model parameters fixed. See GPT and Transformers.
  • Decoding — the procedure that uses logits or their distribution to select the next token; it follows the forward pass and is one step in generation. Do not confuse it with a decoder, a component of some Transformer architectures. See Generating text.
  • Autoregressive generation — an iterative process that selects a token, appends it to the context, and repeats until a stopping condition is met. See Generating text.
  • Prefill — the inference phase that processes the initial prompt as a sequence; logits at its final position are used to select the first generated token. See Generating text.
  • Incremental decode — the phase after prefill that repeats prediction from the context extended with generated tokens. Do not confuse it with decoding, the token-selection rule. See Generating text.
  • KV cache — a mechanism that retains previously computed attention keys and values to avoid recomputing the prefix during decode; an optional inference optimization.
  • Context window — the amount of token context a model can process in a given input.
  • In-context learning (ICL) — adaptation of predictions to instructions, examples, or patterns in the input context without updating model parameters. See in-context learning.
  • Context engineering — the design and management of the information actually supplied to a model: selection, retrieval, structuring, updating, security, and evaluation. See context engineering.
  • Prompt engineering — formulating and organizing a prompt’s instructions and examples; it is one part of context work, not a synonym for context engineering.

Representations and geometry

  • Embedding — a vector representation of an object. The term refers to different objects depending on context; the entries below distinguish the main cases. See embedding space.
  • Initial token embedding — the vector retrieved from the embedding matrix using a token ID; before contextualization, the same ID selects the same vector regardless of the surrounding sentence. See embedding space.
  • Contextualized representation — the vector produced by the network for a given position after taking context into account; unlike the initial embedding, it depends on the other accessible tokens and the model’s transformations. See contextualized representations.
  • Sentence or document embedding — a vector representing an entire text, obtained from an encoder or an aggregation method; it should not be conflated with an initial token embedding or the hidden state of a single position. See cosine similarity.
  • Embedding space — the vector space in which object representations are compared; its geometry depends on the model, layer, and representation method. See embedding space.
  • Cosine similarity — the cosine of the angle between two non-zero vectors; see its definition, assumptions, and limitations.
  • Anisotropy — a vector distribution that favours some directions in the space; it can affect scores and nearest-neighbour rankings.
  • Hubness — a phenomenon in which some points become the nearest neighbours of many other points.
  • Linear representation hypothesis — a family of hypotheses that features may correspond to directions or subspaces in activations; see representation linearity.

These topics are grouped in the Representation geometry and interpretability path.

Probability and learning

  • Logit — an unnormalized real-valued score for a class or token. See Logits.
  • Softmax — a transformation of scores into positive probabilities that sum to one. See Probabilities.
  • Likelihood — the probability assigned to observations by a parameterized model, viewed as a function of its parameters. See Likelihood.
  • Shannon entropy — the average uncertainty of a discrete variable under its distribution. See Entropy.
  • Cross-entropy — the average cost associated with a target distribution and a predictive distribution. See Cross-entropy and KL divergence.
  • KL divergence — a measure of discrepancy between distributions that is generally asymmetric. See Cross-entropy and KL divergence.
  • Loss function — the numerical objective optimized during training; it is not a universal measure of quality. See Loss.
  • Gradient — a derivative of an objective with respect to a variable or parameter. See Gradients.
  • Teacher forcing — a conditioning strategy in which training predictions use the observed data prefix rather than tokens generated by the model. The causal mask still prevents access to future tokens. See Training examples.
  • Calibration — empirical agreement between predicted probabilities and observed frequencies for comparable events.

Transformer architecture

  • Depth — the number of Transformer blocks stacked in the network. See GPT and Transformers.
  • Width — a term often used for the dimension of representations flowing between blocks (d_model or hidden size in a classic GPT); its meaning depends on context and should not be conflated with d_ff or d_head. See GPT and Transformers.
  • Hidden size — the dimension of an internal representation vector; in classic GPT models, it usually corresponds to d_model, the residual-stream width.
  • Transformer — a family of neural architectures built around attention and representation transformations, introduced by Vaswani and colleagues in 2017. The term does not name a single model family. See the Transformer overview and history.
  • GPT (Generative Pre-trained Transformer) — a family of pretrained generative models built on Transformers; classic GPT models use a decoder-only architecture and an autoregressive objective. GPT is not synonymous with Transformer. See GPT and Transformer and Transformer architectures.
  • Attention — a mechanism that computes weights from queries and keys, then aggregates the corresponding values. See Q, K, and V.
  • Query (Q) — a projection used to compute compatibility scores with keys. See Q, K, and V.
  • Key (K) — a projection compared with a query to produce a score. See Q, K, and V.
  • Value (V) — a projection whose representations are aggregated using attention weights. See Q, K, and V.
  • Self-attention — attention where queries, keys, and values are derived from representations of the same sequence. See Q, K, and V.
  • Multi-head attention — several attention mechanisms computed in parallel and then combined.
  • Causal mask — a constraint preventing a position from accessing future positions. See Causal masking.
  • Autoregressive Transformer — a Transformer trained to model a sequence from left to right, predicting each token conditioned on earlier tokens. “Autoregressive” describes the prediction objective; it does not require generating only one token at a time during training.
  • Encoder — a component that builds contextual representations of an input; in BERT, for example, attention can use context from both directions.
  • Decoder — a component designed to produce outputs from context; in an autoregressive decoder, a causal mask prevents access to future tokens.
  • Tensor — an array of numbers organized along several axes. Its shape indicates the size of each axis; it does not by itself specify the meaning of the data. See Tensors.
  • Positional encoding / position information — a mechanism that supplies the model with information about token order. Approaches include absolute encodings, relative biases, and RoPE. See positional encoding and RoPE.
  • RoPE (Rotary Position Embedding) — a positional encoding that applies position-dependent rotations to coordinate pairs of queries and keys.
  • Parameter — a value learned during training.
  • Fine-tuning — continuing training of a pretrained model on a particular objective or dataset.
  • Supervised fine-tuning (SFT) — adaptation on curated input–target or instruction–response demonstrations.
  • RLHF (reinforcement learning from human feedback) — a family of post-training methods that use human preferences; a classic pipeline trains a reward model from comparisons and optimizes a policy against it.
  • Reward model — a model trained to score responses in a way that reflects preference data; its scores are learned proxies, not objective measures of truth or quality.
  • PPO (proximal policy optimization) — a policy-gradient reinforcement-learning algorithm used in some RLHF pipelines to optimize a policy while constraining update size.
  • DPO (direct preference optimization) — a method that optimizes a policy directly from preference comparisons, without the separate reward-model-plus-PPO loop of the classic RLHF recipe.
  • GRPO (group relative policy optimization) — a policy-optimization method that compares rewards across several sampled responses to the same prompt to form a relative learning signal. The reward may come from a verifier or another evaluator; GRPO does not specify its source.
  • RLVR (reinforcement learning with verifiable rewards) — reinforcement learning in which rewards are computed from checkable outcomes, such as exact answers, executable tests, or output-format validation.