# LLM glossary

> Plain definitions of the terms you meet when learning large language models: Transformer, attention, KV cache, RoPE, LoRA, RLHF, RAG, MoE and more, each linked to a full lesson in the wiki.

- URL: https://dmxsf.com/en/glossary/
- 476 terms

## 4

### 4-bit NormalFloat (NF4)

The 4-bit data type used by QLoRA: 16 values taken from the quantiles of a standard normal distribution, rescaled to [-1, 1] and including an exact zero, which suits weights that are roughly normally distributed. Each block of 64 weights shares one scale; QLoRA also quantizes those scales a second time (double quantization) to cut the overhead further.

- Also called: NormalFloat 4
- Read the lesson: [LoRA Fine-Tuning in Practice](https://dmxsf.com/en/wiki/post-training/lora-finetuning/)
- See also: [QLoRA](https://dmxsf.com/en/glossary/#qlora), [Quantization](https://dmxsf.com/en/glossary/#quantization), [LoRA](https://dmxsf.com/en/glossary/#lora)

### 4D parallelism

Sharding training along four dimensions at once: tensor (TP), context (CP), pipeline (PP) and data parallelism (DP, usually FSDP). Llama 3 orders them [TP, CP, PP, DP]: the dimension needing the most bandwidth and lowest latency sits innermost, within one server, and the most latency-tolerant, data parallelism, outermost. The 405B on 16,384 H100s used TP=8, CP=1, PP=16, DP=128 at 41% MFU.

- Paper notes: [The Llama 3 Herd of Models: data, scale and the engineering recipe of a 405B dense model](https://dmxsf.com/en/blog/the-llama-3-herd-of-models/)
- See also: [Tensor parallelism](https://dmxsf.com/en/glossary/#tensor-parallelism), [Context parallelism](https://dmxsf.com/en/glossary/#context-parallelism), [Pipeline parallelism](https://dmxsf.com/en/glossary/#pipeline-parallelism), [Data parallelism](https://dmxsf.com/en/glossary/#data-parallelism), [Model FLOPs utilization](https://dmxsf.com/en/glossary/#mfu)

## A

### Ablation

Removing or replacing a component of a model and observing the change in behaviour, to judge whether the component is necessary. In interpretability the replacement is usually zero (which can push the model off distribution), the component's mean output over many inputs, or its output on another input (patching). The three choices can rank components differently, so state which one was used.

- Read the lesson: [Mechanistic Interpretability: Superposition, Sparse Autoencoders and Circuits](https://dmxsf.com/en/wiki/frontier/interpretability/)
- See also: [Activation patching](https://dmxsf.com/en/glossary/#activation-patching), [Circuit](https://dmxsf.com/en/glossary/#circuit)

### Abstention

The model declines to answer when unsure, for example saying it does not know, instead of guessing. Under binary grading (1 point for a right answer, 0 for a wrong answer or an abstention), the expected score of guessing is never below that of abstaining, so abstention is never rewarded; to teach it, the evaluation must penalize wrong answers or set an explicit confidence threshold.

- Read the lesson: [Hallucination and Calibration: Why Models Sound Sure and Are Wrong](https://dmxsf.com/en/wiki/safety/hallucination-and-calibration/)
- See also: [Hallucination](https://dmxsf.com/en/glossary/#hallucination), [Calibration](https://dmxsf.com/en/glossary/#calibration)

### Acceptance rate

In speculative decoding, the probability that the target model accepts a token proposed by the draft model. For a given prefix it is the sum of min(p, q) over tokens, i.e. 1 minus the total variation distance between the target distribution p and the draft distribution q; averaged over positions it is written α. A speedup needs α to exceed the draft cost coefficient c.

- Read the lesson: [Speculative Decoding: Draft with a Small Model, Verify with a Large One](https://dmxsf.com/en/wiki/inference/speculative-decoding/)
- Paper notes: [Fast Inference from Transformers via Speculative Decoding](https://dmxsf.com/en/blog/speculative-decoding-fast-inference-from-transformers/)
- See also: [Speculative decoding](https://dmxsf.com/en/glossary/#speculative-decoding), [Draft model](https://dmxsf.com/en/glossary/#draft-model)

### Action chunking

The policy predicts T_p future actions at once, executes only the first T_a (T_a ≤ T_p), then predicts again from a new observation. One chunk comes from a single sample, so it stays consistent among several valid ways of acting, and replanning keeps the policy responsive. A small T_a lets it dither between modes; a large one makes it slow to react.

- Paper notes: [Diffusion Policy: Generating Robot Action Sequences by Conditional Denoising](https://dmxsf.com/en/blog/diffusion-policy-visuomotor-policy-learning-via-action-diffusion/)
- See also: [Diffusion Policy](https://dmxsf.com/en/glossary/#diffusion-policy), [Behavior cloning](https://dmxsf.com/en/glossary/#behavior-cloning)

### Action expert

A separate set of weights in a vision-language-action model that handles the robot state and the noisy action tokens and exchanges information with the vision-language backbone only inside self-attention. In π0 it is a randomly initialized model of about 300M parameters next to the 3B PaliGemma. Tokens go to one set of weights or the other by type, with no learned router, unlike a sparse MoE.

- Paper notes: [π0: A Flow-Matching Action Expert on PaliGemma for Controlling Many Robots with Action Chunks](https://dmxsf.com/en/blog/pi0-a-vision-language-action-flow-model-for-general-robot-control/)
- See also: [Vision-language-action model](https://dmxsf.com/en/glossary/#vla), [Flow matching](https://dmxsf.com/en/glossary/#flow-matching), [Mixture of Experts](https://dmxsf.com/en/glossary/#moe)

### Action tokenization

Turning continuous robot actions into discrete tokens so that a language model can generate them like text. RT-2 follows RT-1: each continuous dimension is split uniformly into 256 bins and, with a termination command, an action is 8 integers, each one vocabulary token; decoding samples only these 256 tokens and maps each bin to its center value. The cost is lost precision and slow decoding.

- Paper notes: [RT-2: Transferring Web Knowledge to Robot Control with a Vision-Language-Action Model](https://dmxsf.com/en/blog/rt-2-vision-language-action-models-transfer-web-knowledge-to-robotic-control/)
- See also: [Vision-language-action model](https://dmxsf.com/en/glossary/#vla), [Tokenizer](https://dmxsf.com/en/glossary/#tokenizer), [Constrained decoding](https://dmxsf.com/en/glossary/#constrained-decoding)

### Activation checkpointing

Saving the activations of only some layers in the forward pass and recomputing the rest in the backward pass, trading extra forward computation for memory.

- Also called: Gradient checkpointing
- Read the lesson: [The Compute and Memory Ledger of Training: FLOPs, MFU and Memory Budgets](https://dmxsf.com/en/wiki/pretraining/compute-and-memory/)
- See also: [Activations](https://dmxsf.com/en/glossary/#activations), [Hardware FLOPs utilization](https://dmxsf.com/en/glossary/#hfu), [ZeRO](https://dmxsf.com/en/glossary/#zero)

### Activation patching

Replacing an activation in one run with its value from another run and measuring how much of the output is restored, to judge whether the information there causes the behaviour. A common recipe patches a clean run's activation into a corrupted prompt at one layer and position. Results depend on the corruption method and the metric (Zhang and Nanda, 2023).

- Read the lesson: [Mechanistic Interpretability: Superposition, Sparse Autoencoders and Circuits](https://dmxsf.com/en/wiki/frontier/interpretability/)
- See also: [Ablation](https://dmxsf.com/en/glossary/#ablation), [Circuit](https://dmxsf.com/en/glossary/#circuit), [Logit lens](https://dmxsf.com/en/glossary/#logit-lens)

### Activations

The intermediate tensors produced in the forward pass that the backward pass still needs to compute gradients. Their memory grows with batch size, sequence length and depth: about 18.75 GiB for 4,096 tokens of Llama 2 7B without recomputation.

- Read the lesson: [The Compute and Memory Ledger of Training: FLOPs, MFU and Memory Budgets](https://dmxsf.com/en/wiki/pretraining/compute-and-memory/)
- See also: [Activation checkpointing](https://dmxsf.com/en/glossary/#activation-checkpointing), [ZeRO](https://dmxsf.com/en/glossary/#zero)

### Active parameters

The number of parameters of a mixture-of-experts model that actually take part in computing one token, which sets the compute per token; memory, by contrast, must hold all experts and follows the total. DeepSeek-V3 has about 671B total and about 37B active parameters.

- Read the lesson: [Mixture of Experts (MoE): Routing, Load Balancing and Sparse Activation](https://dmxsf.com/en/wiki/architecture/mixture-of-experts/)
- See also: [Mixture of Experts](https://dmxsf.com/en/glossary/#moe), [FLOPs](https://dmxsf.com/en/glossary/#flops)

### AdamW

The Adam optimizer with decoupled weight decay: it tracks first and second moment estimates of each parameter's gradient and applies weight decay separately from the gradient step. The default optimizer for LLM training.

- Read the lesson: [Optimizers and Training Stability: AdamW, Warmup, Mixed Precision, Loss Spikes](https://dmxsf.com/en/wiki/foundations/optimizers-and-training-stability/)
- Paper notes: [AdamW: Decoupling Weight Decay from Adam's Adaptive Update](https://dmxsf.com/en/blog/decoupled-weight-decay-regularization-adamw/)
- See also: [Learning-rate schedule](https://dmxsf.com/en/glossary/#lr-schedule), [Gradient clipping](https://dmxsf.com/en/glossary/#gradient-clipping)

### Adaptive retrieval

Letting the model decide whether to retrieve and when to stop, instead of retrieving once per question. FLARE retrieves when the probability of a generated token falls below a threshold; Self-RAG trains the model to emit retrieve and critic reflection tokens, so it decides when to retrieve and scores the passages. Part of the trend of models using tools on their own, as in Toolformer.

- Also called: Active retrieval
- Read the lesson: [RAG in Practice: Chunking, Hybrid Retrieval, Reranking and Evaluation](https://dmxsf.com/en/wiki/applications/rag/)
- Paper notes: [RAG survey: three paradigms, four abilities, and a recount of the paper's tables](https://dmxsf.com/en/blog/rag-survey/)
- See also: [Iterative retrieval](https://dmxsf.com/en/glossary/#iterative-retrieval), [Modular RAG](https://dmxsf.com/en/glossary/#modular-rag), [Toolformer](https://dmxsf.com/en/glossary/#toolformer), [Agent](https://dmxsf.com/en/glossary/#agent)

### Additive attention

The attention introduced by Bahdanau et al. (2014) for machine translation: at each decoding step a small feed-forward network scores every encoder state, a softmax normalizes the scores and a weighted sum gives a context vector made for that step, so the whole sentence no longer has to fit in one fixed vector.

- Also called: Bahdanau attention
- Read the lesson: [From RNNs to Attention: Why the Transformer Appeared](https://dmxsf.com/en/wiki/architecture/from-rnn-to-attention/)
- See also: [Sequence-to-sequence model](https://dmxsf.com/en/glossary/#seq2seq), [Self-attention](https://dmxsf.com/en/glossary/#self-attention), [Query, key and value](https://dmxsf.com/en/glossary/#qkv)

### Adjusted base frequency (ABF)

Raising RoPE's base frequency from the default 10,000 to a much larger value, so each dimension rotates more slowly, then continuing pre-training on long texts. Proposed by Xiong et al. (2023) for Llama 2 (10,000 to 500,000); Qwen3 uses 1,000,000 in its long-context stage. Unlike position interpolation, which divides all frequencies by s, it changes low frequencies a lot and high ones little.

- Read the lesson: [Long Context: Position Extrapolation, Training Recipes and Cost](https://dmxsf.com/en/wiki/architecture/long-context/)
- Paper notes: [Qwen3 Technical Report: One Model, Two Modes, a Thinking Budget and Strong-to-Weak Distillation](https://dmxsf.com/en/blog/qwen3-technical-report/)
- See also: [Rotary position embedding](https://dmxsf.com/en/glossary/#rope), [Position interpolation](https://dmxsf.com/en/glossary/#position-interpolation), [YaRN](https://dmxsf.com/en/glossary/#yarn)

### Advanced RAG

The second RAG paradigm in Gao et al.'s survey. It is still a chain, with a layer added before and after retrieval: before it, better indexing (sliding windows, finer segmentation, metadata) and better queries (rewriting, expansion); after it, reranking and context compression, which put the most relevant content at the edges of the prompt and drop the rest. The aim is retrieval quality.

- Read the lesson: [RAG in Practice: Chunking, Hybrid Retrieval, Reranking and Evaluation](https://dmxsf.com/en/wiki/applications/rag/)
- Paper notes: [RAG survey: three paradigms, four abilities, and a recount of the paper's tables](https://dmxsf.com/en/blog/rag-survey/)
- See also: [Naive RAG](https://dmxsf.com/en/glossary/#naive-rag), [Modular RAG](https://dmxsf.com/en/glossary/#modular-rag), [Query rewriting](https://dmxsf.com/en/glossary/#query-rewriting), [Reranking](https://dmxsf.com/en/glossary/#reranking), [Chunking](https://dmxsf.com/en/glossary/#chunking)

### Advantage

How much better an action is than the average at that state: A(s,a) = Q(s,a) − V(s). The policy gradient uses it as the weight: push an action up when it is positive and down when it is negative. In practice it is estimated from samples: the reward minus a baseline, GAE, or the group-standardized reward in GRPO.

- Read the lesson: [Reinforcement Learning Basics: Policy Gradients, Advantages and PPO](https://dmxsf.com/en/wiki/post-training/rl-fundamentals/)
- See also: [Policy gradient](https://dmxsf.com/en/glossary/#policy-gradient), [Baseline (policy gradient)](https://dmxsf.com/en/glossary/#rl-baseline), [Generalized advantage estimation](https://dmxsf.com/en/glossary/#gae), [Value function](https://dmxsf.com/en/glossary/#value-function), [Group relative policy optimization](https://dmxsf.com/en/glossary/#grpo)

### Agent

A system with an LLM at its core that plans, calls tools, observes the results and adjusts its actions in a loop to reach a goal.

- Read the lesson: [Agents and Tool Calling in Practice: From Function Calling to ReAct Workflows](https://dmxsf.com/en/wiki/applications/agents-and-tool-calling/)
- See also: [LLM workflow](https://dmxsf.com/en/glossary/#llm-workflow), [ReAct](https://dmxsf.com/en/glossary/#react), [Function calling](https://dmxsf.com/en/glossary/#function-calling), [Model Context Protocol](https://dmxsf.com/en/glossary/#mcp)

### Agent harness

The engineering layer wrapping the model: it decides what context the model sees, how tool calls are executed, and when to stop. Changing the harness does not touch model parameters yet can move benchmark scores noticeably, so it is part of the system and must be documented as part of the evaluation protocol.

- Read the lesson: [Agent Evaluation: You Are Grading the System, Not the Model](https://dmxsf.com/en/wiki/applications/agent-evaluation/)
- See also: [Agent](https://dmxsf.com/en/glossary/#agent), [τ-bench](https://dmxsf.com/en/glossary/#tau-bench), [pass^k](https://dmxsf.com/en/glossary/#pass-hat-k)

### Agent long-term memory

Confirmed information that an application persists and retrieves across sessions, usually with scope, provenance, version, and expiration rules for defaults or task continuity.

- Read the lesson: [Agent context and memory: budgets, versions, and state](https://dmxsf.com/en/wiki/applications/context-and-memory/)
- See also: [Context engineering](https://dmxsf.com/en/glossary/#context-engineering), [Agent](https://dmxsf.com/en/glossary/#agent)

### Agent trajectory

The thoughts, actions and observations of one task, recorded in order. It is the basic unit of agent evaluation (judging the process, not only the final answer), of failure analysis and of supervised fine-tuning data: the ReAct paper fine-tunes PaLM-8B and 62B on 3,000 trajectories that ended in a correct answer.

- Also called: Trajectory
- Read the lesson: [Agents and Tool Calling in Practice: From Function Calling to ReAct Workflows](https://dmxsf.com/en/wiki/applications/agents-and-tool-calling/)
- Paper notes: [ReAct: Treating Thought as an Action So a Language Model Can Reason and Act in One Trace](https://dmxsf.com/en/blog/react-reasoning-and-acting/)
- See also: [Agent](https://dmxsf.com/en/glossary/#agent), [ReAct](https://dmxsf.com/en/glossary/#react), [Function calling](https://dmxsf.com/en/glossary/#function-calling)

### Aha moment

The name the DeepSeek-R1 paper gives to an intermediate R1-Zero version writing “Wait, wait. Wait. That’s an aha moment I can flag here.” mid-reasoning and then reconsidering its approach, which the paper presents as evidence of self-evolution. The cause is disputed: later work found that DeepSeek-V3-Base already writes such self-reflective sentences before any reinforcement learning.

- Read the lesson: [Reinforcement Learning for Reasoning: RLVR and GRPO](https://dmxsf.com/en/wiki/post-training/reasoning-rl/)
- Paper notes: [DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning](https://dmxsf.com/en/blog/deepseek-r1-reasoning-via-reinforcement-learning/)
- See also: [R1-Zero](https://dmxsf.com/en/glossary/#r1-zero), [Reasoning model](https://dmxsf.com/en/glossary/#reasoning-model), [Emergent abilities](https://dmxsf.com/en/glossary/#emergent-abilities)

### Alignment

The research and methods aimed at making a model's behavior match human intentions and values: helpful, honest and harmless.

- Read the lesson: [Preference Optimization: From RLHF to DPO](https://dmxsf.com/en/wiki/post-training/preference-optimization/)
- See also: [Reinforcement learning from human feedback](https://dmxsf.com/en/glossary/#rlhf), [Direct preference optimization](https://dmxsf.com/en/glossary/#dpo), [Constitutional AI](https://dmxsf.com/en/glossary/#constitutional-ai)

### Alignment tax

The loss of capability that alignment training can cause. InstructGPT found that optimizing human preferences directly with PPO made the model worse on public datasets such as SQuAD, DROP, HellaSwag and French-to-English translation; mixing pretraining gradients into PPO (PPO-ptx) largely reduces it.

- Read the lesson: [Preference Optimization: From RLHF to DPO](https://dmxsf.com/en/wiki/post-training/preference-optimization/)
- Paper notes: [InstructGPT: Training Language Models to Follow Instructions with Human Feedback](https://dmxsf.com/en/blog/instructgpt-rlhf/)
- See also: [Reinforcement learning from human feedback](https://dmxsf.com/en/glossary/#rlhf), [PPO-ptx](https://dmxsf.com/en/glossary/#ppo-ptx)

### All-gather

A collective primitive: n devices each hold one shard, and after the operation every device holds the full concatenated data. ZeRO-3 and FSDP use it right before the forward and backward pass to rebuild a layer's full weights, which are freed after use.

- Read the lesson: [Collective Communication: Why All-Reduce Has So Many Algorithms](https://dmxsf.com/en/wiki/systems/collective-communication/)
- See also: [All-reduce](https://dmxsf.com/en/glossary/#all-reduce), [Reduce-scatter](https://dmxsf.com/en/glossary/#reduce-scatter), [ZeRO](https://dmxsf.com/en/glossary/#zero)

### All-reduce

A collective operation that gives every device the sum of a value (such as gradients) over all devices. The ring version is a reduce-scatter followed by an all-gather; each device sends about 2(n−1)/n times the data size, which barely grows with the number of devices.

- Also called: Ring all-reduce
- Read the lesson: [Collective Communication: Why All-Reduce Has So Many Algorithms](https://dmxsf.com/en/wiki/systems/collective-communication/)
- See also: [Data parallelism](https://dmxsf.com/en/glossary/#data-parallelism), [ZeRO](https://dmxsf.com/en/glossary/#zero), [Tensor parallelism](https://dmxsf.com/en/glossary/#tensor-parallelism)

### All-to-all

A collective primitive in which each device sends its j-th chunk to device j and receives one chunk from every other device, a transpose of data spread across devices. Expert parallelism in MoE uses it to send tokens to the devices holding their experts and bring results back, so the traffic depends on the routing.

- Read the lesson: [Collective Communication: Why All-Reduce Has So Many Algorithms](https://dmxsf.com/en/wiki/systems/collective-communication/)
- See also: [Expert parallelism](https://dmxsf.com/en/glossary/#expert-parallelism), [Mixture of Experts](https://dmxsf.com/en/glossary/#moe), [All-reduce](https://dmxsf.com/en/glossary/#all-reduce)

### AlphaZero

A general self-play reinforcement learning algorithm from DeepMind (2017). A neural network outputting move priors and a position value is combined with Monte Carlo tree search. From random play and knowing only the rules, one set of hyperparameters learns chess, shogi and Go. The network learns the search's move distribution and the game outcomes.

- Read the lesson: [Reinforcement Learning for Reasoning: RLVR and GRPO](https://dmxsf.com/en/wiki/post-training/reasoning-rl/)
- Paper notes: [AlphaZero: Only the Rules, Self-Play from Scratch, Mastering Chess, Shogi and Go](https://dmxsf.com/en/blog/alphazero-mastering-chess-and-shogi-by-self-play/)
- See also: [Monte Carlo tree search](https://dmxsf.com/en/glossary/#mcts), [Reinforcement learning with verifiable rewards](https://dmxsf.com/en/glossary/#rlvr), [Proximal policy optimization](https://dmxsf.com/en/glossary/#ppo)

### Annealing

At the end of pre-training, decay the learning rate linearly to 0 while shifting the data mix toward higher-quality sources such as code and math, and often average the checkpoints. Llama 3 did this on its last 40M tokens. The paper also uses it as a cheap test of data value: anneal a half-trained 8B model on 40B tokens with 30% new data and see whether metrics improve.

- Paper notes: [The Llama 3 Herd of Models: data, scale and the engineering recipe of a 405B dense model](https://dmxsf.com/en/blog/the-llama-3-herd-of-models/)
- See also: [Learning-rate schedule](https://dmxsf.com/en/glossary/#lr-schedule), [Data mixture](https://dmxsf.com/en/glossary/#data-mixture), [Model averaging](https://dmxsf.com/en/glossary/#model-averaging)

### Arithmetic intensity

The number of floating-point operations performed per byte moved from memory, in FLOPs per byte. For matrix multiplication it rises with batch size; it stays low for elementwise operations and for the matrix–vector products of decoding, which is why those are limited by memory bandwidth.

- Read the lesson: [GPUs and the Roofline Model: Why Big Models Are Bound by Memory Bandwidth](https://dmxsf.com/en/wiki/systems/gpu-and-roofline/)
- See also: [Roofline model](https://dmxsf.com/en/glossary/#roofline-model), [Memory-bound](https://dmxsf.com/en/glossary/#memory-bound), [FLOPs](https://dmxsf.com/en/glossary/#flops)

### Attention Residuals (AttnRes)

A residual-connection variant from the Kimi team (March 2026). Layer l no longer gets the embedding plus all earlier outputs with weight 1 but a softmax-weighted sum of them: keys are the RMS-normalized sources, the query is one learned pseudo-query vector per layer (zero-initialized, so training starts as an equal average), values are the sources. Attention runs over depth, not sequence.

- Paper notes: [Attention Residuals: Letting Each Layer Pick What to Read From the Layers Before It](https://dmxsf.com/en/blog/attention-residuals/)
- See also: [Residual connection](https://dmxsf.com/en/glossary/#residual-connection), [Block Attention Residuals](https://dmxsf.com/en/glossary/#block-attnres), [PreNorm dilution](https://dmxsf.com/en/glossary/#prenorm-dilution), [Manifold-constrained hyper-connections](https://dmxsf.com/en/glossary/#mhc), [RMSNorm](https://dmxsf.com/en/glossary/#rmsnorm), [Softmax](https://dmxsf.com/en/glossary/#softmax)

### Attention sink

In autoregressive models the first few tokens attract very high attention scores even when they carry little meaning. Keeping only their keys and values plus a recent window lets a finite-window model generate stably in a stream, as StreamingLLM does; whatever has left the window is gone and cannot be recalled.

- Read the lesson: [Long Context: Position Extrapolation, Training Recipes and Cost](https://dmxsf.com/en/wiki/architecture/long-context/)
- Paper notes: [StreamingLLM: Keep the First Few Tokens in the KV Cache and Sliding Windows Stop Breaking](https://dmxsf.com/en/blog/efficient-streaming-language-models-with-attention-sinks/)
- See also: [KV cache](https://dmxsf.com/en/glossary/#kv-cache), [Sliding-window attention](https://dmxsf.com/en/glossary/#sliding-window-attention), [Context window](https://dmxsf.com/en/glossary/#context-window)

### Attribute inference

Inferring personal attributes the author never stated, such as location, income or sex, from a piece of text. Staab et al. (2023) found that LLMs reach up to 85% top-1 accuracy on real Reddit text at about 1/100 of the cost of humans. It does not depend on the record being in the training data, so neither deduplication nor goldfish loss stops it.

- Read the lesson: [Memorization and Privacy: What Models Remember, How to Measure and Reduce It](https://dmxsf.com/en/wiki/safety/memorization-and-privacy/)
- See also: [Membership inference](https://dmxsf.com/en/glossary/#membership-inference), [Memorization](https://dmxsf.com/en/glossary/#memorization)

### AUROC (AUROC)

Area under the ROC curve: the probability that a randomly chosen positive example gets a higher score than a randomly chosen negative one. 0.5 is guessing and 1.0 is perfect separation. It does not depend on a threshold, so it compares detectors fairly, but the false-positive and false-negative rates at a chosen threshold still have to be measured separately.

- Also called: Area under the ROC curve
- Read the lesson: [Benchmark Contamination: How It Happens, How to Detect It, How to Avoid It](https://dmxsf.com/en/wiki/evaluation/benchmark-contamination/)
- See also: [Min-K% Prob](https://dmxsf.com/en/glossary/#min-k-prob), [Membership inference](https://dmxsf.com/en/glossary/#membership-inference)

### Autoregressive generation

Generating one token at a time and feeding it back as input for the next step. Outputs depend on each other, so inference cannot produce a whole passage in parallel.

- See also: [Next-token prediction](https://dmxsf.com/en/glossary/#next-token-prediction), [KV cache](https://dmxsf.com/en/glossary/#kv-cache), [Decoder-only model](https://dmxsf.com/en/glossary/#decoder-only)

### AWQ

Activation-aware weight quantization: it identifies the few important channels from activation magnitudes and protects them during quantization, keeping accuracy loss small at 4 bits.

- Read the lesson: [Model Quantization: INT8, INT4, GPTQ and AWQ Explained and Measured](https://dmxsf.com/en/wiki/inference/quantization/)
- See also: [Quantization](https://dmxsf.com/en/glossary/#quantization), [GPTQ](https://dmxsf.com/en/glossary/#gptq)

## B

### Backpropagation

Applying the chain rule backward through the computation graph, from the output, to get the gradient of the loss with respect to all parameters in one pass. It costs about twice a forward pass and requires the forward activations to be kept, which is why activation checkpointing trades recomputation for memory.

- Also called: Backprop
- Read the lesson: [Neural Network Basics: From Linear Layers to Backpropagation](https://dmxsf.com/en/wiki/foundations/neural-network-basics/)
- See also: [Activations](https://dmxsf.com/en/glossary/#activations), [Activation checkpointing](https://dmxsf.com/en/glossary/#activation-checkpointing), [Multilayer perceptron](https://dmxsf.com/en/glossary/#mlp)

### Base model

A model that has only been pretrained, without instruction tuning or alignment. It is good at continuing text but does not necessarily follow instructions.

- Also called: Foundation model
- See also: [Pretraining](https://dmxsf.com/en/glossary/#pretraining), [Post-training](https://dmxsf.com/en/glossary/#post-training), [Supervised fine-tuning](https://dmxsf.com/en/glossary/#sft)

### Baseline (policy gradient)

A quantity that does not depend on the current action, subtracted from the reward in a policy gradient. Since E[b(s)·∇log π(a|s)] = 0, it leaves the expected gradient unchanged and cuts the variance. Examples: the batch mean reward, a value function V(s), the mean of the other responses in a group. If it includes the response's own reward, that fails: a group mean shrinks the gradient by (G−1)/G.

- Read the lesson: [Reinforcement Learning Basics: Policy Gradients, Advantages and PPO](https://dmxsf.com/en/wiki/post-training/rl-fundamentals/)
- See also: [Policy gradient](https://dmxsf.com/en/glossary/#policy-gradient), [Advantage](https://dmxsf.com/en/glossary/#advantage), [REINFORCE Leave-One-Out](https://dmxsf.com/en/glossary/#rloo), [Value function](https://dmxsf.com/en/glossary/#value-function)

### Beam search

Keeping the k best-scoring partial sequences at every step, extending each, and returning the best complete one. Common for translation and summarization; rarely used for open-ended chat.

- Read the lesson: [Decoding and Sampling: Temperature, Top-k, Top-p and Beam Search](https://dmxsf.com/en/wiki/inference/decoding-and-sampling/)
- See also: [Greedy decoding](https://dmxsf.com/en/glossary/#greedy-decoding), [Top-p (nucleus) sampling](https://dmxsf.com/en/glossary/#top-p)

### Behavior cloning (BC)

The most direct form of imitation learning: train a policy on expert (observation, action) pairs to reproduce the expert's actions. It is the same recipe as supervised fine-tuning (SFT), with similar difficulties: one observation can have several valid actions (multimodality), and errors accumulate at deployment and drift away from the training distribution.

- Read the lesson: [SFT Data: Construction and Quality Control](https://dmxsf.com/en/wiki/post-training/sft-data/)
- Paper notes: [Diffusion Policy: Generating Robot Action Sequences by Conditional Denoising](https://dmxsf.com/en/blog/diffusion-policy-visuomotor-policy-learning-via-action-diffusion/)
- See also: [Supervised fine-tuning](https://dmxsf.com/en/glossary/#sft), [Diffusion Policy](https://dmxsf.com/en/glossary/#diffusion-policy)

### τ-bench

An agent benchmark by Yao et al. (2024): a language model plays the user while the agent follows domain rules and calls API tools over a multi-turn conversation, and success is judged by whether the final database state equals the annotated goal state. Two domains: retail (115 tasks) and airline (50 tasks).

- Also called: tau-bench
- Read the lesson: [Agents and Tool Calling in Practice: From Function Calling to ReAct Workflows](https://dmxsf.com/en/wiki/applications/agents-and-tool-calling/)
- See also: [pass^k](https://dmxsf.com/en/glossary/#pass-hat-k), [Agent](https://dmxsf.com/en/glossary/#agent), [Benchmark](https://dmxsf.com/en/glossary/#benchmark)

### Benchmark

A fixed set of questions with a scoring method, used to compare models on some ability, such as MMLU, GSM8K and HumanEval.

- Read the lesson: [LLM Evaluation Methodology: Benchmarks, Contamination and a Workflow](https://dmxsf.com/en/wiki/evaluation/llm-evaluation/)
- See also: [MMLU](https://dmxsf.com/en/glossary/#mmlu), [HumanEval](https://dmxsf.com/en/glossary/#humaneval), [GSM8K](https://dmxsf.com/en/glossary/#gsm8k), [MT-Bench](https://dmxsf.com/en/glossary/#mt-bench), [pass@k](https://dmxsf.com/en/glossary/#pass-at-k), [Benchmark contamination](https://dmxsf.com/en/glossary/#contamination)

### Benchmark contamination

Test questions or their answers leaking into the training data, which inflates scores and hides the model's real generalization. Besides verbatim copies there are paraphrases, translations and answers scattered over web pages and discussions, which exact matching misses; the more copies, the firmer the memory.

- Also called: Data leakage
- Read the lesson: [Benchmark Contamination: How It Happens, How to Detect It, How to Avoid It](https://dmxsf.com/en/wiki/evaluation/benchmark-contamination/)
- See also: [Benchmark](https://dmxsf.com/en/glossary/#benchmark), [Deduplication](https://dmxsf.com/en/glossary/#deduplication), [Decontamination](https://dmxsf.com/en/glossary/#decontamination), [N-gram overlap](https://dmxsf.com/en/glossary/#n-gram-overlap), [Min-K% Prob](https://dmxsf.com/en/glossary/#min-k-prob)

### Benchmark saturation

The strongest models' scores approach the ceiling of an evaluation set, which then stops separating them. The ceiling is not 100% but 1−e, with e the label error rate: on a four-option set with 6.49% errors a perfect model scores 0.935. Beyond it, the remaining differences are mostly label errors rather than ability, so replace the items and ship a new version.

- Read the lesson: [Building Evaluation Sets: Question Sources, Label Quality and Item Information](https://dmxsf.com/en/wiki/evaluation/building-eval-sets/)
- See also: [Benchmark](https://dmxsf.com/en/glossary/#benchmark), [Benchmark contamination](https://dmxsf.com/en/glossary/#contamination), [Label noise](https://dmxsf.com/en/glossary/#label-noise)

### BERT

Google's 2018 pre-trained language model: a Transformer encoder trained on unlabeled text with masked language modeling and next-sentence prediction, giving bidirectional representations that one new output layer and fine-tuning turn into a classifier or tagger. BERT-BASE has 12 layers, hidden size 768 and 12 heads (about 110M parameters); BERT-LARGE has 24, 1024 and 16 (about 340M).

- Also called: Bidirectional Encoder Representations from Transformers
- Read the lesson: [From Language Modeling to Next-Token Prediction](https://dmxsf.com/en/wiki/foundations/next-token-prediction/)
- Paper notes: [BERT: pre-training a bidirectional Transformer by filling in masked words, then one thin output layer per task](https://dmxsf.com/en/blog/bert-pre-training-of-deep-bidirectional-transformers/)
- See also: [Masked language modeling](https://dmxsf.com/en/glossary/#masked-language-modeling), [Next-sentence prediction](https://dmxsf.com/en/glossary/#next-sentence-prediction), [Encoder-only model](https://dmxsf.com/en/glossary/#encoder-only), [Fine-tuning](https://dmxsf.com/en/glossary/#fine-tuning)

### Best-of-N sampling

Generate N candidate answers for one prompt, score them with a reward model or verifier, and keep the highest-scoring one. It does not update the model and is the simplest way to trade inference compute for quality. It is also used to study how far a reward model is over-optimized. For a continuous reward distribution its KL to the base model is log N - (N-1)/N.

- Read the lesson: [Preference Optimization: From RLHF to DPO](https://dmxsf.com/en/wiki/post-training/preference-optimization/)
- Paper notes: [Learning to Summarize: A Reward Model from Human Preferences, Optimized with PPO](https://dmxsf.com/en/blog/learning-to-summarize-from-human-feedback/)
- See also: [Reward model](https://dmxsf.com/en/glossary/#reward-model), [KL divergence](https://dmxsf.com/en/glossary/#kl-divergence), [Process reward model](https://dmxsf.com/en/glossary/#prm)

### BF16

The 16-bit floating-point format bfloat16: the same 8 exponent bits as FP32 but only 7 mantissa bits. Its wide range makes it less prone to overflow than FP16 in training.

- Read the lesson: [Numerical Precision: Three Ways FP16, BF16 and FP8 Training Goes Wrong](https://dmxsf.com/en/wiki/systems/numerical-precision/)
- See also: [Mixed-precision training](https://dmxsf.com/en/glossary/#mixed-precision)

### Bilingual Evaluation Understudy (BLEU)

An automatic metric for machine translation: the geometric mean of n-gram precisions (usually 1 to 4) between a translation and its references, times a brevity penalty for short outputs. It rewards surface overlap, not meaning, and scores from different tokenizations or implementations are not directly comparable. The Transformer paper reports WMT 2014 results in BLEU.

- Paper notes: [Attention Is All You Need: the Transformer, with self-attention instead of recurrence and convolution](https://dmxsf.com/en/blog/attention-is-all-you-need/)
- See also: [Perplexity](https://dmxsf.com/en/glossary/#perplexity), [Beam search](https://dmxsf.com/en/glossary/#beam-search)

### Bits per byte (BPB)

The language-model loss converted to bits per raw byte of text: the base-2 cross-entropy summed over tokens, divided by the number of bytes. The denominator is the text itself, independent of the tokenizer, so models with different vocabularies can be compared.

- Read the lesson: [The LLM Training Pipeline: From Data to Deployment](https://dmxsf.com/en/wiki/pretraining/training-pipeline/)
- See also: [Cross-entropy](https://dmxsf.com/en/glossary/#cross-entropy), [Perplexity](https://dmxsf.com/en/glossary/#perplexity), [Tokenizer](https://dmxsf.com/en/glossary/#tokenizer)

### Block Attention Residuals

The memory-saving variant of AttnRes: the L sublayers form N blocks (the paper uses about 8). Inside a block, outputs are summed by a plain residual into one block representation; attention runs only over the embedding, earlier block representations and the current partial sum. Vectors to keep and ship drop from O(L) to O(N); the paper reports under 4% training and 2% inference overhead.

- Also called: Block AttnRes
- Paper notes: [Attention Residuals: Letting Each Layer Pick What to Read From the Layers Before It](https://dmxsf.com/en/blog/attention-residuals/)
- See also: [Attention Residuals](https://dmxsf.com/en/glossary/#attention-residuals), [PreNorm dilution](https://dmxsf.com/en/glossary/#prenorm-dilution), [Residual connection](https://dmxsf.com/en/glossary/#residual-connection)

### Block table

The per-sequence map in PagedAttention that records which physical block holds each logical block and how many positions of it are filled. Logically consecutive blocks need not be adjacent in GPU memory, a new block is allocated only when the previous one is full, and a finished request frees its blocks for others.

- Paper notes: [vLLM and PagedAttention: Managing the KV Cache Like Paged Memory](https://dmxsf.com/en/blog/vllm-pagedattention/)
- See also: [PagedAttention](https://dmxsf.com/en/glossary/#pagedattention), [Copy-on-write](https://dmxsf.com/en/glossary/#copy-on-write), [KV cache](https://dmxsf.com/en/glossary/#kv-cache)

### Blockwise causal mask

An attention mask that splits the sequence into blocks: bidirectional inside a block, causal between blocks, so later blocks see earlier ones but not the reverse. π0 uses three blocks (image and language, state, actions); the first two do not depend on the noisy actions, so their keys and values can be cached across the 10 flow-matching steps. A fully bidirectional mask would break that cache.

- Paper notes: [π0: A Flow-Matching Action Expert on PaliGemma for Controlling Many Robots with Action Chunks](https://dmxsf.com/en/blog/pi0-a-vision-language-action-flow-model-for-general-robot-control/)
- See also: [Causal mask](https://dmxsf.com/en/glossary/#causal-mask), [KV cache](https://dmxsf.com/en/glossary/#kv-cache), [Prefix caching](https://dmxsf.com/en/glossary/#prefix-caching)

### BM25 (BM25)

A classic lexical scoring function: a term scores higher the more often it occurs in a document and the rarer it is in the corpus, term frequency saturates, and long documents are mildly penalized (parameters k1 and b). It needs no training and is strong on identifiers, commands and rare terms, but cannot match paraphrases that share no words, so it is often mixed with vector search.

- Also called: Okapi BM25
- Read the lesson: [RAG in Practice: Chunking, Hybrid Retrieval, Reranking and Evaluation](https://dmxsf.com/en/wiki/applications/rag/)
- See also: [Retrieval-augmented generation](https://dmxsf.com/en/glossary/#rag), [Reranking](https://dmxsf.com/en/glossary/#reranking), [Progressive tool discovery](https://dmxsf.com/en/glossary/#progressive-tool-discovery)

### Bradley–Terry model

A model that gives each item a strength coefficient and predicts pairwise win probabilities by passing the coefficient difference through a sigmoid: i beats j with probability 1/(1+exp(−(ξi−ξj))). Reward-model preference losses and Chatbot Arena rankings are both built on it.

- Read the lesson: [Reward Models: Turning Human Preferences into a Score to Optimize](https://dmxsf.com/en/wiki/post-training/reward-models/)
- See also: [Elo rating](https://dmxsf.com/en/glossary/#elo-rating), [Reward model](https://dmxsf.com/en/glossary/#reward-model), [Chatbot Arena](https://dmxsf.com/en/glossary/#chatbot-arena)

### Broadcasting

Aligning shapes from their trailing axes for elementwise operations. Matching dimensions and singleton axes are compatible, as when adding one bias vector to many rows.

- Read the lesson: [Python and tensor shapes: from a table to a linear layer](https://dmxsf.com/en/wiki/foundations/tensors-and-shapes/)
- See also: [Tensor shape](https://dmxsf.com/en/glossary/#tensor-shape)

### Budget forcing

A decoding control for reasoning length: append a wait prompt when the model stops early and force an answer at the budget, enabling test-time scaling.

- Paper notes: [s1: Curated data and budget forcing for test-time scaling](https://dmxsf.com/en/blog/s1-simple-test-time-scaling/)
- See also: [Test-time compute](https://dmxsf.com/en/glossary/#test-time-compute), [Chain of thought](https://dmxsf.com/en/glossary/#chain-of-thought)

### Bus bandwidth

A metric in NCCL performance tests: the algorithm bandwidth (data size divided by time) multiplied by a factor that depends on the primitive and the number of devices, so results at different scales can be compared directly with the hardware link speed. For all-reduce the factor is 2(n−1)/n.

- Also called: busbw
- Read the lesson: [Collective Communication: Why All-Reduce Has So Many Algorithms](https://dmxsf.com/en/wiki/systems/collective-communication/)
- See also: [All-reduce](https://dmxsf.com/en/glossary/#all-reduce), [Ring all-reduce](https://dmxsf.com/en/glossary/#ring-all-reduce)

### Byte-pair encoding (BPE)

A tokenizer algorithm that starts from single characters (or bytes) and repeatedly merges the most frequent adjacent pair of symbols into a new symbol until the vocabulary reaches the target size. Byte-level BPE, used since GPT-2, can encode any text without unknown words.

- Read the lesson: [Tokenizers and Embeddings: BPE, Vocabulary Size and the Embedding Table](https://dmxsf.com/en/wiki/foundations/tokenizer-and-embeddings/)
- See also: [Tokenizer](https://dmxsf.com/en/glossary/#tokenizer), [Vocabulary](https://dmxsf.com/en/glossary/#vocabulary)

## C

### Calibration

Agreement between a model's confidence and its actual accuracy: among the answers where it says it is 80% sure, about 80% are right. A calibrated model's confidence can be used directly for decisions; language models commonly turn overconfident, and post-training often weakens calibration.

- Read the lesson: [Hallucination and Calibration: Why Models Sound Sure and Are Wrong](https://dmxsf.com/en/wiki/safety/hallucination-and-calibration/)
- See also: [Expected calibration error](https://dmxsf.com/en/glossary/#expected-calibration-error), [Temperature scaling](https://dmxsf.com/en/glossary/#temperature-scaling), [Reliability diagram](https://dmxsf.com/en/glossary/#reliability-diagram), [Hallucination](https://dmxsf.com/en/glossary/#hallucination)

### Canary release

A rollout that exposes a candidate to a small eligible group first, then uses predetermined quality and reliability gates to promote, hold, or roll back. Candidate responses affect real user tasks.

- Read the lesson: [Production evaluation for LLMs: replay, canaries, and rollback](https://dmxsf.com/en/wiki/evaluation/production-evaluation/)
- See also: [Shadow traffic](https://dmxsf.com/en/glossary/#shadow-traffic), [Confidence interval](https://dmxsf.com/en/glossary/#confidence-interval)

### Canary string

A unique random string placed in a dataset together with a notice that the data should not appear in training corpora. If a model can complete it or gives it an unusually high probability, the training corpus included the data. BIG-bench puts one in every task file. It exposes only pipelines that scraped the original file, not paraphrased items or other copies of the questions.

- Also called: Canary GUID
- Read the lesson: [Benchmark Contamination: How It Happens, How to Detect It, How to Avoid It](https://dmxsf.com/en/wiki/evaluation/benchmark-contamination/)
- See also: [Benchmark contamination](https://dmxsf.com/en/glossary/#contamination), [Decontamination](https://dmxsf.com/en/glossary/#decontamination), [Exposure](https://dmxsf.com/en/glossary/#canary-exposure)

### Capacity factor

The multiple of the average load that sets how many tokens one expert of a mixture-of-experts model may take: capacity = ⌈capacity factor × tokens × k ÷ experts⌉. Tokens over the capacity are dropped and only pass through the residual connection in that layer.

- Read the lesson: [Mixture of Experts (MoE): Routing, Load Balancing and Sparse Activation](https://dmxsf.com/en/wiki/architecture/mixture-of-experts/)
- Paper notes: [Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity](https://dmxsf.com/en/blog/switch-transformers-scaling-to-trillion-parameter-models/)
- See also: [Expert load balancing](https://dmxsf.com/en/glossary/#load-balancing), [Mixture of Experts](https://dmxsf.com/en/glossary/#moe)

### Catastrophic forgetting

The sharp loss of a model's earlier abilities after it is fine-tuned on data from a new task or domain. A larger learning rate, longer training and more trainable parameters usually mean bigger changes and more forgetting. Common mitigations are a smaller learning rate, a lower rank, mixing in general data, and monitoring a general evaluation before and after fine-tuning.

- Read the lesson: [LoRA Fine-Tuning in Practice](https://dmxsf.com/en/wiki/post-training/lora-finetuning/)
- See also: [Fine-tuning](https://dmxsf.com/en/glossary/#fine-tuning), [LoRA](https://dmxsf.com/en/glossary/#lora), [Supervised fine-tuning](https://dmxsf.com/en/glossary/#sft)

### Causal encoder-decoder (CED)

DeepSeek-V4.1-Flash splits its 40 layers into a causal encoder (first 20) and a decoder (last 20), inspired by YOCO. Decoder layers project their global KV from the encoder's last-layer states instead of their own, so prefill needs only the first half, which the paper says removes nearly half of prefill compute. Decoding runs all 40 layers: 8B active parameters in prefill, 16B in decode.

- Paper notes: [DeepSeek-V4.1-Flash: Getting the Global KV Cache Down to 890 Bytes per Token](https://dmxsf.com/en/blog/deepseek-v41-flash-pushing-the-limits-of-kv-cache-compression/)
- See also: [KV cache](https://dmxsf.com/en/glossary/#kv-cache), [Compressed Sparse Attention 2](https://dmxsf.com/en/glossary/#csa2), [SWA Bounded Replay](https://dmxsf.com/en/glossary/#swa-bounded-replay)

### Causal mask

Setting the attention scores of future positions to negative infinity so that each token sees only itself and earlier tokens. Decoder models rely on it to predict the next word from the preceding ones.

- Read the lesson: [Attention Basics: How a Transformer Reads Context](https://dmxsf.com/en/wiki/architecture/attention-basics/)
- See also: [Self-attention](https://dmxsf.com/en/glossary/#self-attention), [Decoder-only model](https://dmxsf.com/en/glossary/#decoder-only), [Autoregressive generation](https://dmxsf.com/en/glossary/#autoregressive)

### Chain of thought (CoT)

Having the model write out intermediate reasoning steps before the answer, which clearly improves multi-step problems such as math and logic. Proposed by Wei et al. in 2022.

- Read the lesson: [Prompt Engineering: A Systematic Guide to Specs, Layers, Examples and Evaluation](https://dmxsf.com/en/wiki/applications/prompt-engineering/)
- Paper notes: [Chain-of-thought prompting: exemplars with intermediate steps let large models solve multi-step problems](https://dmxsf.com/en/blog/chain-of-thought-prompting/)
- See also: [Reasoning model](https://dmxsf.com/en/glossary/#reasoning-model), [ReAct](https://dmxsf.com/en/glossary/#react), [Test-time compute](https://dmxsf.com/en/glossary/#test-time-compute)

### Chain-of-thought faithfulness

Whether a model's written reasoning reflects what actually drove its answer. The chain-of-thought paper concedes the chain imitates human thinking and proves nothing about the network. Turpin et al. (2023): a hint favoring one option sways the model while its chain never mentions it. Lanham et al. (2023): by truncating chains and inserting mistakes, reliance on the chain varies by task.

- Read the lesson: [Prompt Engineering: A Systematic Guide to Specs, Layers, Examples and Evaluation](https://dmxsf.com/en/wiki/applications/prompt-engineering/)
- Paper notes: [Chain-of-thought prompting: exemplars with intermediate steps let large models solve multi-step problems](https://dmxsf.com/en/blog/chain-of-thought-prompting/)
- See also: [Chain of thought](https://dmxsf.com/en/glossary/#chain-of-thought), [Reasoning model](https://dmxsf.com/en/glossary/#reasoning-model), [Hallucination](https://dmxsf.com/en/glossary/#hallucination)

### Chatbot Arena

A crowdsourced human-preference platform: users compare two anonymous models' answers and vote, and a Bradley–Terry model turns the votes into a leaderboard with confidence intervals. The paper reported about 240K votes at the time.

- Read the lesson: [LLM-as-a-Judge: Using a Model as the Grader, Its Biases and Calibration](https://dmxsf.com/en/wiki/evaluation/llm-as-judge/)
- See also: [Bradley–Terry model](https://dmxsf.com/en/glossary/#bradley-terry), [Elo rating](https://dmxsf.com/en/glossary/#elo-rating), [LLM-as-a-judge](https://dmxsf.com/en/glossary/#llm-as-a-judge)

### Checkpoint

A snapshot saved during training: model weights, optimizer state, the step counter and the data position. Weights alone are enough for inference but not for lossless resumption, because Adam's moment estimates would restart from zero and the learning rate and data order depend on the step.

- Read the lesson: [The LLM Training Pipeline: From Data to Deployment](https://dmxsf.com/en/wiki/pretraining/training-pipeline/)
- See also: [AdamW](https://dmxsf.com/en/glossary/#adamw), [Pretraining](https://dmxsf.com/en/glossary/#pretraining)

### Chinchilla-optimal training

DeepMind's 2022 finding that, for a given compute budget, parameters and training tokens should grow roughly in proportion, about 20 tokens per parameter. The Chinchilla model (70B parameters, 1.4T tokens) was trained this way.

- Read the lesson: [Scaling Laws: How to Split Compute Between Parameters and Data](https://dmxsf.com/en/wiki/pretraining/scaling-laws/)
- Paper notes: [Chinchilla: Why a 70B Model on 1.4T Tokens Beats the 280B Gopher at the Same Compute](https://dmxsf.com/en/blog/chinchilla-training-compute-optimal-large-language-models/)
- See also: [Scaling law](https://dmxsf.com/en/glossary/#scaling-law), [FLOPs](https://dmxsf.com/en/glossary/#flops)

### Chunked prefill

Splitting a long prompt into chunks and processing one chunk per step while requests that are already decoding ride along, so that the prefill of one long prompt does not stall the output of every other request.

- Read the lesson: [Continuous Batching and PagedAttention: How a Server Handles Many Requests at Once](https://dmxsf.com/en/wiki/inference/continuous-batching/)
- See also: [Prefill and decode](https://dmxsf.com/en/glossary/#prefill-decode), [Continuous batching](https://dmxsf.com/en/glossary/#continuous-batching), [Time to first token](https://dmxsf.com/en/glossary/#ttft)

### Chunking

Cutting long documents into pieces that are good for retrieval and fit in the context. Chunk size, overlap and split boundaries directly affect retrieval quality.

- Read the lesson: [RAG in Practice: Chunking, Hybrid Retrieval, Reranking and Evaluation](https://dmxsf.com/en/wiki/applications/rag/)
- See also: [Retrieval-augmented generation](https://dmxsf.com/en/glossary/#rag), [Reranking](https://dmxsf.com/en/glossary/#reranking)

### Circuit

A subgraph of a neural network, made of features or components (attention heads, MLP neurons) and the connections between them, that together carry out a describable computation. Examples are the induction head and the 26 attention heads in 7 classes that Wang et al. (2022) found for indirect object identification in GPT-2 small. Circuits are judged by faithfulness, completeness and minimality.

- Read the lesson: [Mechanistic Interpretability: Superposition, Sparse Autoencoders and Circuits](https://dmxsf.com/en/wiki/frontier/interpretability/)
- See also: [Induction head](https://dmxsf.com/en/glossary/#induction-head), [Mechanistic interpretability](https://dmxsf.com/en/glossary/#mechanistic-interpretability), [Indirect object identification](https://dmxsf.com/en/glossary/#indirect-object-identification)

### Classifier-free guidance (CFG)

Ho and Salimans (2022): drop the condition at random in training (say 10% of samples) so one network learns both conditional and unconditional predictions; at sampling time extrapolate to (1+w) times the conditional prediction minus w times the unconditional one. Larger w follows the condition more closely but is less diverse and drifts from the data; each step costs an extra forward pass.

- Read the lesson: [Diffusion Models and Flow Matching: Generating Images, Actions and Text from Noise](https://dmxsf.com/en/wiki/multimodal/diffusion-and-flow-matching/)
- See also: [Diffusion model](https://dmxsf.com/en/glossary/#diffusion-model), [Flow matching](https://dmxsf.com/en/glossary/#flow-matching)

### CLIP

OpenAI's 2021 contrastive image-text model: an image encoder and a text encoder are trained on a large number of image-caption pairs so that matching pairs land close together in one vector space.

- Read the lesson: [Multimodal LLMs: How an Image Becomes Tokens](https://dmxsf.com/en/wiki/multimodal/multimodal-llms/)
- Paper notes: [CLIP: Contrastive Learning on 400 Million Image-Text Pairs, and a Classifier You Define in One Sentence](https://dmxsf.com/en/blog/clip-learning-transferable-visual-models/)
- See also: [Contrastive learning](https://dmxsf.com/en/glossary/#contrastive-learning), [Vision-language model](https://dmxsf.com/en/glossary/#vlm)

### Clip-Higher

The first DAPO trick: decouple the PPO clipping bounds, raising the upper one from 0.2 to 0.28 and keeping the lower one at 0.2. The upper bound is multiplicative, so a low-probability token cannot rise much in one update (0.01 reaches 0.012 at most). A looser bound leaves room for such exploration tokens and eases entropy collapse; the lower bound stays so their probability is not pushed to 0.

- Paper notes: [DAPO: An Open-Source Reasoning RL System and the Four Tricks That Keep GRPO Stable on Long Chains of Thought](https://dmxsf.com/en/blog/dapo-open-source-llm-reinforcement-learning-system-at-scale/)
- See also: [DAPO](https://dmxsf.com/en/glossary/#dapo), [Proximal policy optimization](https://dmxsf.com/en/glossary/#ppo)

### Closed-book

Answering with no reference documents at all, relying only on what the model memorized in its parameters. It is the usual baseline for retrieval-augmented evaluation: if the score with documents falls below the closed-book score, the documents are getting in the way. The oracle setting, which gives only the document that holds the answer, approximates the upper bound.

- Also called: Closed-book QA
- Paper notes: [Lost in the Middle: Models Use the Start and End of a Long Context Best](https://dmxsf.com/en/blog/lost-in-the-middle/)
- See also: [Retrieval-augmented generation](https://dmxsf.com/en/glossary/#rag), [Lost in the middle](https://dmxsf.com/en/glossary/#lost-in-the-middle)

### Co-fine-tuning

When fine-tuning on new-task data, mixing the original pre-training data into the same training batches instead of using the new data alone. RT-2 raises the sampling weight of robot data so that each batch balances robot data and web image-text data (robot data is about 50% or 66% of the mixture), so that the model does not forget web-learned concepts while it learns to act.

- Paper notes: [RT-2: Transferring Web Knowledge to Robot Control with a Vision-Language-Action Model](https://dmxsf.com/en/blog/rt-2-vision-language-action-models-transfer-web-knowledge-to-robotic-control/)
- See also: [Catastrophic forgetting](https://dmxsf.com/en/glossary/#catastrophic-forgetting), [Vision-language-action model](https://dmxsf.com/en/glossary/#vla), [Fine-tuning](https://dmxsf.com/en/glossary/#fine-tuning)

### Cohen's kappa

Agreement beyond chance: κ = (po − pe)/(1 − pe), where po is the observed agreement and pe is the agreement expected if both raters label at random with their own label frequencies. A judge that always guesses the majority class can score high agreement and κ = 0.

- Read the lesson: [LLM-as-a-Judge: Using a Model as the Grader, Its Biases and Calibration](https://dmxsf.com/en/wiki/evaluation/llm-as-judge/)
- See also: [LLM-as-a-judge](https://dmxsf.com/en/glossary/#llm-as-a-judge), [Inter-annotator agreement](https://dmxsf.com/en/glossary/#inter-annotator-agreement)

### Cold-start data

A small set of high-quality long chain-of-thought examples used to fine-tune the base model before large-scale reinforcement learning. R1 used a few thousand: readable ones were selected by rules from R1-Zero's correct responses, then rewritten by DeepSeek-V3 and human annotators. The aim is a more readable, more stable starting point for RL, not to teach reasoning.

- Read the lesson: [Reinforcement Learning for Reasoning: RLVR and GRPO](https://dmxsf.com/en/wiki/post-training/reasoning-rl/)
- Paper notes: [DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning](https://dmxsf.com/en/blog/deepseek-r1-reasoning-via-reinforcement-learning/)
- See also: [R1-Zero](https://dmxsf.com/en/glossary/#r1-zero), [Rejection sampling fine-tuning](https://dmxsf.com/en/glossary/#rejection-sampling-finetuning), [Distillation](https://dmxsf.com/en/glossary/#distillation)

### Common Crawl

Public web data crawled since 2007 by the non-profit Common Crawl and released as periodic snapshots (for example CC-MAIN-2024-10). C4, Pile-CC, RefinedWeb, the web part of Dolma and FineWeb all draw on it. The raw data comes as WARC (full HTML) or WET (extracted text); WET keeps much boilerplate, so FineWeb extracts text from WARC with Trafilatura, which trains a better model.

- Paper notes: [FineWeb: Extracting, Deduplicating and Filtering a 15T-Token Open Web Corpus, One Ablation at a Time](https://dmxsf.com/en/blog/the-fineweb-datasets-decanting-the-web-for-the-finest-text-data-at-scale/)
- See also: [FineWeb](https://dmxsf.com/en/glossary/#fineweb), [Deduplication](https://dmxsf.com/en/glossary/#deduplication)

### Compressed Sparse Attention 2 (CSA2)

The attention design of DeepSeek-V4.1-Flash. Each layer is statically Full (computes its own main KV and indexer K and picks a top-512), Reindex (reuses the latest Full layer's main KV and indexer K but rescores with its own indexer Q) or Reuse (reuses the main KV and the last selection, no indexer). Cache sharing is decoupled from selection reuse: only 4 of 40 layers generate global KV.

- Paper notes: [DeepSeek-V4.1-Flash: Getting the Global KV Cache Down to 890 Bytes per Token](https://dmxsf.com/en/blog/deepseek-v41-flash-pushing-the-limits-of-kv-cache-compression/)
- See also: [DeepSeek Sparse Attention](https://dmxsf.com/en/glossary/#dsa), [Lightning indexer](https://dmxsf.com/en/glossary/#lightning-indexer), [KV cache](https://dmxsf.com/en/glossary/#kv-cache), [Sliding-window attention](https://dmxsf.com/en/glossary/#sliding-window-attention), [Hierarchical sparse indexer](https://dmxsf.com/en/glossary/#hierarchical-sparse-indexer)

### Compute-optimal test-time scaling

Choosing the test-time strategy separately for each problem (for example how to split between parallel sampling and revision) so a correct answer is most likely within a budget. Snell et al. (2024) bin problems into 5 difficulty levels by the model's pass rate, pick the best strategy per bin, and report up to about 4x less compute than best-of-N on MATH, excluding difficulty estimation.

- Paper notes: [Scaling LLM Test-Time Compute Optimally: Spending Inference Compute by Difficulty Can Beat a Bigger Model](https://dmxsf.com/en/blog/scaling-llm-test-time-compute-optimally-can-be-more-effective-than-scaling-model-parameters/)
- See also: [Test-time compute](https://dmxsf.com/en/glossary/#test-time-compute), [Best-of-N sampling](https://dmxsf.com/en/glossary/#best-of-n), [pass@k](https://dmxsf.com/en/glossary/#pass-at-k)

### Confidence interval

A plausible range around a measured number. For an accuracy p measured on n questions the standard error is sqrt(p(1−p)/n) and the 95% interval is about p ± 1.96 standard errors; for 80% on 164 questions that is about ±6.1 points.

- Read the lesson: [The Statistics of Evaluation: pass@k, Confidence Intervals and Sample Size](https://dmxsf.com/en/wiki/evaluation/eval-statistics/)
- See also: [Benchmark](https://dmxsf.com/en/glossary/#benchmark), [pass@k](https://dmxsf.com/en/glossary/#pass-at-k)

### Confused deputy

A security problem in which a privileged program (the deputy) is tricked by a party without privileges into using its own on that party's behalf. In MCP, when a proxy server uses a static client ID with a third-party authorization server, an attacker can exploit the user's existing consent cookie to get an authorization code; the defense is consent for each dynamically registered client.

- Read the lesson: [MCP and the Tool Ecosystem: How It Works and What to Do When Tools Pile Up](https://dmxsf.com/en/wiki/applications/mcp-and-tool-ecosystem/)
- See also: [Model Context Protocol](https://dmxsf.com/en/glossary/#mcp), [Prompt injection](https://dmxsf.com/en/glossary/#prompt-injection)

### Consistency model

A few-step generative model of Song et al. (2023): it learns a function that maps any point on an ODE trajectory directly to the trajectory's endpoint, the clean sample, so one step is enough to generate and a few more steps trade compute for quality. It can be distilled from a pretrained diffusion model or trained from scratch.

- Read the lesson: [Diffusion Models and Flow Matching: Generating Images, Actions and Text from Noise](https://dmxsf.com/en/wiki/multimodal/diffusion-and-flow-matching/)
- See also: [Rectified flow](https://dmxsf.com/en/glossary/#rectified-flow), [Denoising Diffusion Implicit Models](https://dmxsf.com/en/glossary/#ddim)

### Constitutional AI

An alignment method from Anthropic: the model critiques and revises its own answers according to a written set of principles, and AI-generated preferences then drive reinforcement learning, reducing the need for human labels.

- Paper notes: [Constitutional AI: a written list of principles lets the model critique, rewrite and grade its own answers](https://dmxsf.com/en/blog/constitutional-ai-harmlessness-from-ai-feedback/)
- See also: [Reinforcement learning from human feedback](https://dmxsf.com/en/glossary/#rlhf), [Alignment](https://dmxsf.com/en/glossary/#alignment)

### Constrained decoding

At each decoding step, compute the set of tokens that keep the output within a target format (a regex, grammar or JSON Schema), set the logits of all other tokens to negative infinity and then sample, so the output is always a legal prefix. Implementations typically compile the format into an automaton and index it against the vocabulary.

- Also called: Grammar-constrained decoding
- Read the lesson: [Structured Outputs and Function Calling: From JSON Mode to Constrained Decoding](https://dmxsf.com/en/wiki/applications/structured-output-and-function-calling/)
- See also: [Structured output](https://dmxsf.com/en/glossary/#structured-output), [JSON Schema](https://dmxsf.com/en/glossary/#json-schema), [Temperature](https://dmxsf.com/en/glossary/#temperature)

### Context engineering

Assembling instructions, tool definitions, complete history, retrieval, and memory under a model call's token budget, with provenance and purpose for each item.

- Read the lesson: [Agent context and memory: budgets, versions, and state](https://dmxsf.com/en/wiki/applications/context-and-memory/)
- See also: [Context window](https://dmxsf.com/en/glossary/#context-window), [Agent harness](https://dmxsf.com/en/glossary/#agent-harness)

### Context parallelism (CP)

Splitting one long sequence along its length across several devices, and gathering their keys and values before attention. Llama 3 cuts the sequence into 2×CP chunks and pairs a head chunk with a tail chunk on each device to balance the load under a causal mask.

- Read the lesson: [Long Context: Position Extrapolation, Training Recipes and Cost](https://dmxsf.com/en/wiki/architecture/long-context/)
- See also: [Tensor parallelism](https://dmxsf.com/en/glossary/#tensor-parallelism), [Pipeline parallelism](https://dmxsf.com/en/glossary/#pipeline-parallelism), [Data parallelism](https://dmxsf.com/en/glossary/#data-parallelism)

### Context window

The maximum number of tokens a model can handle at once, shared by the prompt and the output. Anything beyond it must be truncated or compressed by retrieval or summarization.

- Also called: Context length
- Read the lesson: [Long Context: Position Extrapolation, Training Recipes and Cost](https://dmxsf.com/en/wiki/architecture/long-context/)
- Paper notes: [Lost in the Middle: Models Use the Start and End of a Long Context Best](https://dmxsf.com/en/blog/lost-in-the-middle/)
- See also: [Token](https://dmxsf.com/en/glossary/#token), [KV cache](https://dmxsf.com/en/glossary/#kv-cache), [Rotary position embedding](https://dmxsf.com/en/glossary/#rope), [Needle in a haystack](https://dmxsf.com/en/glossary/#needle-in-a-haystack)

### Continuous batching

Adding new requests and removing finished ones at every decoding iteration instead of waiting for the whole batch to end, which raises GPU utilization considerably. Also called iteration-level scheduling.

- Read the lesson: [Continuous Batching and PagedAttention: How a Server Handles Many Requests at Once](https://dmxsf.com/en/wiki/inference/continuous-batching/)
- See also: [Throughput](https://dmxsf.com/en/glossary/#throughput), [PagedAttention](https://dmxsf.com/en/glossary/#pagedattention)

### Continuous normalizing flow (CNF)

A generative model defined by an ODE dx/dt = v_t(x) whose vector field is a neural network: it transports a simple distribution such as a standard Gaussian into the data distribution and allows exact likelihoods. Maximum-likelihood training must solve the ODE during training, which is expensive; flow matching removes that step.

- Paper notes: [Flow Matching: Regress a Fixed Path's Vector Field and Train Continuous Normalizing Flows Without Simulation](https://dmxsf.com/en/blog/flow-matching-for-generative-modeling/)
- See also: [Flow matching](https://dmxsf.com/en/glossary/#flow-matching)

### Contrastive learning

A representation-learning method that pulls matching samples together and pushes non-matching ones apart, such as CLIP's image-text contrastive loss.

- Read the lesson: [Multimodal LLMs: How an Image Becomes Tokens](https://dmxsf.com/en/wiki/multimodal/multimodal-llms/)
- See also: [CLIP](https://dmxsf.com/en/glossary/#clip), [Embedding](https://dmxsf.com/en/glossary/#embedding)

### Copy-on-write

When several sequences share a physical block, the system keeps a reference count for it; a sequence that must write to a block with a count above one first copies it into a private block, while the others keep the original. vLLM uses it to share KV cache across parallel samples, beam search candidates and shared prefixes, as an operating system does when forking a process.

- Also called: COW
- Paper notes: [vLLM and PagedAttention: Managing the KV Cache Like Paged Memory](https://dmxsf.com/en/blog/vllm-pagedattention/)
- See also: [Block table](https://dmxsf.com/en/glossary/#block-table), [Parallel sampling](https://dmxsf.com/en/glossary/#parallel-sampling), [Beam search](https://dmxsf.com/en/glossary/#beam-search), [Prefix caching](https://dmxsf.com/en/glossary/#prefix-caching)

### Counterfactual robustness

One of the four RAG abilities: when retrieved documents contain known errors, the model should notice the risk and not be misled, even if the instruction warns that documents may be wrong. RGB picks questions the model can answer directly and corrupts the answers in the documents; models still tend to trust the retrieved content over their own knowledge.

- Read the lesson: [RAG in Practice: Chunking, Hybrid Retrieval, Reranking and Evaluation](https://dmxsf.com/en/wiki/applications/rag/)
- Paper notes: [RAG survey: three paradigms, four abilities, and a recount of the paper's tables](https://dmxsf.com/en/blog/rag-survey/)
- See also: [Noise robustness](https://dmxsf.com/en/glossary/#noise-robustness), [Negative rejection](https://dmxsf.com/en/glossary/#negative-rejection), [Hallucination](https://dmxsf.com/en/glossary/#hallucination)

### Credit assignment

A basic problem in reinforcement learning: after a sequence of actions only one delayed reward arrives, and the learner must decide which actions deserve credit or blame. Process rewards refine the signal to each step and make credit assignment easier, while a reward that looks only at the final outcome is sparse and gets harder to learn from as solutions get longer.

- Paper notes: [Let's Verify Step by Step: Scoring Every Reasoning Step Beats Checking Only the Final Answer](https://dmxsf.com/en/blog/lets-verify-step-by-step/)
- See also: [Process reward model](https://dmxsf.com/en/glossary/#prm), [Outcome reward model](https://dmxsf.com/en/glossary/#orm), [Proximal policy optimization](https://dmxsf.com/en/glossary/#ppo)

### Critical batch size

Up to this batch size, increasing the batch costs almost no compute efficiency and cuts the number of training steps; beyond it, returns diminish. Introduced by McCandlish et al. (2018); Kaplan et al. found that it depends only on the loss reached, not on model size, and roughly doubles for every 13% drop in the loss.

- Paper notes: [Scaling Laws for Neural Language Models](https://dmxsf.com/en/blog/scaling-laws-for-neural-language-models/)
- See also: [Scaling law](https://dmxsf.com/en/glossary/#scaling-law), [Data parallelism](https://dmxsf.com/en/glossary/#data-parallelism)

### Critique and revision

The model first criticizes its own answer under a principle, then rewrites it in light of the critique; revisions can go through more rounds and finally serve as fine-tuning data. Constitutional AI's supervised stage runs 4 rounds per red-team prompt, each with a principle drawn at random from 16. Critiques helped small models, not large ones.

- Paper notes: [Constitutional AI: a written list of principles lets the model critique, rewrite and grade its own answers](https://dmxsf.com/en/blog/constitutional-ai-harmlessness-from-ai-feedback/)
- See also: [Constitutional AI](https://dmxsf.com/en/glossary/#constitutional-ai), [Supervised fine-tuning](https://dmxsf.com/en/glossary/#sft), [RLAIF](https://dmxsf.com/en/glossary/#rlaif)

### Cross-attention

Attention in which the queries come from one sequence and the keys and values from another. Encoder-decoder translation models and some multimodal models use it to let the decoder "look up" the input.

- Read the lesson: [Attention Basics: How a Transformer Reads Context](https://dmxsf.com/en/wiki/architecture/attention-basics/)
- See also: [Self-attention](https://dmxsf.com/en/glossary/#self-attention), [Encoder-decoder model](https://dmxsf.com/en/glossary/#encoder-decoder), [Vision-language model](https://dmxsf.com/en/glossary/#vlm)

### Cross-entropy

A loss that measures how far the model's predicted distribution q is from the true distribution p: H(p, q) = −Σ p log q. Language-model pretraining minimizes the cross-entropy of the true next token.

- Read the lesson: [Information Theory Refresher: Entropy, Cross-Entropy and KL Divergence](https://dmxsf.com/en/wiki/foundations/information-theory/)
- See also: [Perplexity](https://dmxsf.com/en/glossary/#perplexity), [KL divergence](https://dmxsf.com/en/glossary/#kl-divergence), [Next-token prediction](https://dmxsf.com/en/glossary/#next-token-prediction)

## D

### DAPO (DAPO)

A reasoning reinforcement learning algorithm open-sourced in 2025 by ByteDance Seed and partners. On top of GRPO it adds four tricks: Clip-Higher with decoupled bounds, dynamic sampling that filters all-right or all-wrong prompts, a loss averaged over tokens instead of answers, and reward shaping for overlong answers, and it drops the KL penalty. It scores 50 on AIME 2024 from a Qwen2.5-32B base.

- Read the lesson: [Reinforcement Learning for Reasoning: RLVR and GRPO](https://dmxsf.com/en/wiki/post-training/reasoning-rl/)
- Paper notes: [DAPO: An Open-Source Reasoning RL System and the Four Tricks That Keep GRPO Stable on Long Chains of Thought](https://dmxsf.com/en/blog/dapo-open-source-llm-reinforcement-learning-system-at-scale/)
- See also: [Group relative policy optimization](https://dmxsf.com/en/glossary/#grpo), [Clip-Higher](https://dmxsf.com/en/glossary/#clip-higher), [Dynamic sampling](https://dmxsf.com/en/glossary/#dynamic-sampling)

### Data ablation

Fix the model, budget and evaluation, change one data-processing step at a time, train a control model per version and compare downstream scores. FineWeb used a 1.71B Llama-style model, 28B tokens for filtering ablations and 350B for deduplication, two models per version averaged, and benchmarks with low seed variance and near-monotonic curves. Small-scale results may not transfer.

- Paper notes: [FineWeb: Extracting, Deduplicating and Filtering a 15T-Token Open Web Corpus, One Ablation at a Time](https://dmxsf.com/en/blog/the-fineweb-datasets-decanting-the-web-for-the-finest-text-data-at-scale/)
- See also: [FineWeb](https://dmxsf.com/en/glossary/#fineweb), [Deduplication](https://dmxsf.com/en/glossary/#deduplication), [Scaling law](https://dmxsf.com/en/glossary/#scaling-law)

### Data mixture

The share of each source (web text, code, math, multilingual data and so on) among the pretraining samples. The mixture changes the validation loss of every domain, so evaluate per domain; a single average hides the trade-offs.

- Read the lesson: [The LLM Training Pipeline: From Data to Deployment](https://dmxsf.com/en/wiki/pretraining/training-pipeline/)
- See also: [Deduplication](https://dmxsf.com/en/glossary/#deduplication), [Pretraining](https://dmxsf.com/en/glossary/#pretraining), [Bits per byte](https://dmxsf.com/en/glossary/#bits-per-byte), [DoReMi](https://dmxsf.com/en/glossary/#doremi), [Data-constrained scaling](https://dmxsf.com/en/glossary/#data-constrained-scaling)

### Data parallelism

Every device holds a full copy of the model and processes a different batch; gradients are synchronized after the backward pass.

- Read the lesson: [Distributed Training: Data, Tensor and Pipeline Parallelism](https://dmxsf.com/en/wiki/pretraining/distributed-training/)
- See also: [Tensor parallelism](https://dmxsf.com/en/glossary/#tensor-parallelism), [Pipeline parallelism](https://dmxsf.com/en/glossary/#pipeline-parallelism), [ZeRO](https://dmxsf.com/en/glossary/#zero)

### Data pyramid

How GR00T N1 organizes training data: web data and human video at the base, synthetic data (simulation and neural trajectories) in the middle, real teleoperated robot data at the top, each layer closer to the target robot. Layers without actions get latent-action or inverse-dynamics labels. By Table 7's hours it is not a quantity pyramid: real-robot data (3,288.8 hours) is the largest.

- Paper notes: [GR00T N1: A Data Pyramid and a Dual-System Model for Generalist Humanoid Robots](https://dmxsf.com/en/blog/gr00t-n1-an-open-foundation-model-for-generalist-humanoid-robots/)
- See also: [Open X-Embodiment](https://dmxsf.com/en/glossary/#open-x-embodiment), [Latent action](https://dmxsf.com/en/glossary/#latent-action), [Neural trajectory](https://dmxsf.com/en/glossary/#neural-trajectory)

### Data-constrained scaling

How much repeated data is worth when high-quality data runs out. Muennighoff et al. (2023) fitted an effective-data formula D′ = U + U·R*·(1−e^(−R/R*)), where U is the number of unique tokens, R the number of repeats and R* about 15. Up to roughly 4 epochs repeated data is almost as good as fresh data; after that returns decay quickly and the formula saturates at 1+R* copies of fresh data.

- Also called: Effective data
- Read the lesson: [Pretraining Data Engineering: Filtering, Deduplication and Mixing](https://dmxsf.com/en/wiki/pretraining/data-engineering/)
- See also: [Scaling law](https://dmxsf.com/en/glossary/#scaling-law), [Data mixture](https://dmxsf.com/en/glossary/#data-mixture)

### DCLM

DataComp-LM (Li et al., 2024): a benchmark that compares pretraining datasets by changing only the data under a fixed recipe, with a Common Crawl pool of about 240T tokens and 53 downstream evaluations. Its DCLM-Baseline dataset keeps the top 10% of documents under a fastText classifier trained on OpenHermes 2.5 and ELI5 positives; a 7B model trained on it for 2.6T tokens reaches 64% on MMLU.

- Also called: DataComp-LM
- Read the lesson: [Pretraining Data Engineering: Filtering, Deduplication and Mixing](https://dmxsf.com/en/wiki/pretraining/data-engineering/)
- See also: [Model-based filtering](https://dmxsf.com/en/glossary/#model-based-filtering), [FineWeb](https://dmxsf.com/en/glossary/#fineweb), [Common Crawl](https://dmxsf.com/en/glossary/#common-crawl)

### De-tokenizer

Undoing pre-processing left in a dataset for older models: spaces before punctuation, placeholders such as @-@ for hyphens, split contractions. The GPT-2 paper used invertible de-tokenizers, so probabilities still map back to the original text, and reports gains of 2.5 to 5 perplexity from them. The heuristic one on this page is not shown to be invertible.

- Read the lesson: [From Language Modeling to Next-Token Prediction](https://dmxsf.com/en/wiki/foundations/next-token-prediction/)
- Paper notes: [GPT-1, GPT-2, GPT-3: From Fine-Tuning to In-Context Learning, Recomputed from the Papers](https://dmxsf.com/en/blog/gpt-series-evolution/)
- See also: [Per-word perplexity](https://dmxsf.com/en/glossary/#per-word-perplexity), [Perplexity](https://dmxsf.com/en/glossary/#perplexity), [Tokenizer](https://dmxsf.com/en/glossary/#tokenizer)

### Dead latent

A dictionary entry of a sparse autoencoder that never (or almost never) fires, which wastes capacity. In the three SAEs that Templeton et al. (2024) trained on Claude 3 Sonnet, with about 1M, 4M and 34M features, roughly 2%, 35% and 65% of the features were dead; Gao et al. (2024) found modifications of the TopK SAE that leave few dead latents even at the largest scale they tried.

- Read the lesson: [Mechanistic Interpretability: Superposition, Sparse Autoencoders and Circuits](https://dmxsf.com/en/wiki/frontier/interpretability/)
- See also: [Sparse autoencoder](https://dmxsf.com/en/glossary/#sparse-autoencoder)

### Decision Transformer (DT)

An offline RL method (Chen et al., 2021): trajectories become interleaved (return-to-go, state, action) tokens, and a causal GPT learns, with a supervised loss, to predict the action at each state token; no value function or policy gradient. A target return prompts it at test time. Later work found the return condition, not the Transformer, matters most, and that it fails in stochastic settings.

- Paper notes: [Decision Transformer: Reinforcement Learning as Conditional Sequence Modeling](https://dmxsf.com/en/blog/decision-transformer-reinforcement-learning-via-sequence-modeling/)
- See also: [Returns-to-go](https://dmxsf.com/en/glossary/#returns-to-go), [Return-conditioned supervised learning](https://dmxsf.com/en/glossary/#rcsl), [Behavior cloning](https://dmxsf.com/en/glossary/#behavior-cloning), [Causal mask](https://dmxsf.com/en/glossary/#causal-mask)

### Decoder-only model

An architecture that keeps only a stack of decoder layers with a causal mask and generates autoregressively. GPT, Llama, Qwen and DeepSeek are all decoder-only.

- Read the lesson: [Modern LLM Architecture: From GPT-2 to Llama, Qwen and DeepSeek](https://dmxsf.com/en/wiki/architecture/modern-llm-architecture/)
- See also: [Encoder-decoder model](https://dmxsf.com/en/glossary/#encoder-decoder), [Causal mask](https://dmxsf.com/en/glossary/#causal-mask), [Autoregressive generation](https://dmxsf.com/en/glossary/#autoregressive)

### Decontamination

Removing whatever overlaps with an evaluation set: deleting documents that share a long span with a benchmark item before training, or reporting scores only on the clean subset of items with no overlap. The usual tool is n-gram overlap, which handles verbatim copies only; paraphrased or translated leaks need model-based detection or items written after the training cutoff.

- Read the lesson: [Benchmark Contamination: How It Happens, How to Detect It, How to Avoid It](https://dmxsf.com/en/wiki/evaluation/benchmark-contamination/)
- See also: [Benchmark contamination](https://dmxsf.com/en/glossary/#contamination), [N-gram overlap](https://dmxsf.com/en/glossary/#n-gram-overlap), [Deduplication](https://dmxsf.com/en/glossary/#deduplication)

### Decoupled RoPE

The way MLA stays compatible with low-rank key-value compression. RoPE depends on position, so applying it to the up-projected keys would stop the key up-projection from being absorbed into the query. A small extra slice (one query per head plus one key shared by all heads) carries RoPE and is concatenated with the position-free content part; the shared key is cached too.

- Read the lesson: [Efficient Attention: MQA, GQA, MLA and FlashAttention](https://dmxsf.com/en/wiki/architecture/efficient-attention/)
- Paper notes: [DeepSeek-V2: Compressing the KV Cache with MLA and Cutting Training Cost with DeepSeekMoE](https://dmxsf.com/en/blog/deepseek-v2-strong-economical-efficient-mixture-of-experts/)
- See also: [Multi-head latent attention](https://dmxsf.com/en/glossary/#mla), [Rotary position embedding](https://dmxsf.com/en/glossary/#rope)

### Deduplication

Removing duplicate and near-duplicate documents from the training corpus (often with MinHash), which reduces memorization and benchmark leakage and improves training efficiency.

- Read the lesson: [Pretraining Data Engineering: Filtering, Deduplication and Mixing](https://dmxsf.com/en/wiki/pretraining/data-engineering/)
- Paper notes: [FineWeb: Extracting, Deduplicating and Filtering a 15T-Token Open Web Corpus, One Ablation at a Time](https://dmxsf.com/en/blog/the-fineweb-datasets-decanting-the-web-for-the-finest-text-data-at-scale/)
- See also: [Pretraining](https://dmxsf.com/en/glossary/#pretraining), [Benchmark contamination](https://dmxsf.com/en/glossary/#contamination), [MinHash](https://dmxsf.com/en/glossary/#minhash), [Locality-sensitive hashing](https://dmxsf.com/en/glossary/#locality-sensitive-hashing), [Suffix array](https://dmxsf.com/en/glossary/#suffix-array), [Memorization](https://dmxsf.com/en/glossary/#memorization)

### Deep Q-network (DQN)

Q-learning with a convolutional network approximating the action-value function Q(s, a): the input is the last 4 frames, the output is one Q value per action, and experience replay and reward clipping stabilize training. The 2013 DeepMind paper calls it the first deep model to learn control policies from high-dimensional input with reinforcement learning; the 2015 version added a target network.

- Paper notes: [DQN: Learning to Play Atari from Pixels with a Convolutional Q-Network and Experience Replay](https://dmxsf.com/en/blog/dqn-playing-atari-with-deep-reinforcement-learning/)
- See also: [Experience replay](https://dmxsf.com/en/glossary/#experience-replay), [Proximal policy optimization](https://dmxsf.com/en/glossary/#ppo)

### DeepSeek Sparse Attention (DSA)

Sparse attention from DeepSeek-V3.2. A small lightning indexer scores every earlier token for each query, the top 2048 are kept, and core attention runs only on them, cutting its cost from O(L²) to O(Lk). Selection depends on content and can reach arbitrarily far back; the indexer stays O(L²) but is about 5.9% of core attention per token pair. Added to a dense model by continued training.

- Read the lesson: [Efficient Attention: MQA, GQA, MLA and FlashAttention](https://dmxsf.com/en/wiki/architecture/efficient-attention/)
- Paper notes: [DeepSeek-V3.2: Sparse Attention, Scaled-Up Reinforcement Learning and Synthetic Agent Tasks](https://dmxsf.com/en/blog/deepseek-v32-pushing-the-frontier-of-open-large-language-models/)
- See also: [Lightning indexer](https://dmxsf.com/en/glossary/#lightning-indexer), [Multi-head latent attention](https://dmxsf.com/en/glossary/#mla), [Top-k sampling](https://dmxsf.com/en/glossary/#top-k), [Sliding-window attention](https://dmxsf.com/en/glossary/#sliding-window-attention), [KV cache](https://dmxsf.com/en/glossary/#kv-cache)

### Delta rule

A write rule for fixed-size-state models: read the value currently stored under the key, then write back only the difference, S ← S + β k (v − Sᵀk)ᵀ. It is one gradient step on a linear model that predicts the value from the key, so rewriting the same key cleanly replaces the old value, whereas an additive write returns the sum of old and new. Used by DeltaNet and Gated DeltaNet.

- Read the lesson: [State Space Models and Hybrids: Trading the KV Cache for a Fixed-Size State](https://dmxsf.com/en/wiki/architecture/state-space-and-hybrid/)
- See also: [Linear attention](https://dmxsf.com/en/glossary/#linear-attention), [Gated DeltaNet](https://dmxsf.com/en/glossary/#gated-deltanet)

### Denoising Diffusion Implicit Models (DDIM)

A way of sampling from a diffusion model: it reuses the same trained noise-prediction network but skips diffusion steps, denoising deterministically (with eta = 0) from noise to data. Inference can therefore use far fewer steps than training (for example 100 steps of training and 10 of inference), at some cost in sample quality.

- Read the lesson: [Diffusion Models and Flow Matching: Generating Images, Actions and Text from Noise](https://dmxsf.com/en/wiki/multimodal/diffusion-and-flow-matching/)
- See also: [Denoising diffusion probabilistic model](https://dmxsf.com/en/glossary/#ddpm), [Diffusion model](https://dmxsf.com/en/glossary/#diffusion-model)

### Denoising diffusion probabilistic model (DDPM)

The diffusion model of Ho et al. (2020): a forward process of T=1000 steps with variances rising linearly from 1e-4 to 0.02, a network that predicts the noise of each step, an unweighted mean squared error (L_simple) as the loss, and sampling that denoises step by step from Gaussian noise. It reaches FID 3.17 on unconditional CIFAR-10.

- Read the lesson: [Diffusion Models and Flow Matching: Generating Images, Actions and Text from Noise](https://dmxsf.com/en/wiki/multimodal/diffusion-and-flow-matching/)
- Paper notes: [DDPM: Add Noise Step by Step, Learn to Remove It Step by Step, and Train with a Simple Noise-Prediction Loss](https://dmxsf.com/en/blog/ddpm-denoising-diffusion-probabilistic-models/)
- See also: [Diffusion model](https://dmxsf.com/en/glossary/#diffusion-model)

### Device memory

Memory accessible by an accelerator for weights, intermediate tensors, and caches. Discrete GPUs often have dedicated memory, while a unified-memory system can share physical memory with the host.

- Read the lesson: [LLM hardware basics: CPUs, GPUs, memory, and moving data](https://dmxsf.com/en/wiki/systems/hardware-basics/)
- See also: [Arithmetic intensity](https://dmxsf.com/en/glossary/#arithmetic-intensity)

### Device-limited routing

An MoE routing constraint from DeepSeek-V2: first pick the M devices that hold the highest-affinity experts (M=3 in V2), then take the top-K only among the experts on those devices, so each token's experts live on at most M devices. This bounds cross-device communication under expert parallelism.

- Read the lesson: [Mixture of Experts (MoE): Routing, Load Balancing and Sparse Activation](https://dmxsf.com/en/wiki/architecture/mixture-of-experts/)
- Paper notes: [DeepSeek-V2: Compressing the KV Cache with MLA and Cutting Training Cost with DeepSeekMoE](https://dmxsf.com/en/blog/deepseek-v2-strong-economical-efficient-mixture-of-experts/)
- See also: [Mixture of Experts](https://dmxsf.com/en/glossary/#moe), [Router](https://dmxsf.com/en/glossary/#router), [Expert parallelism](https://dmxsf.com/en/glossary/#expert-parallelism)

### Differential attention

Two softmax attention maps are subtracted with a learned coefficient to cancel shared noise. Negative weights are possible, so the result is not an ordinary probability distribution.

- Paper notes: [Differential Transformer: Subtract two attention maps to suppress noise](https://dmxsf.com/en/blog/differential-transformer/)
- See also: [Transformer](https://dmxsf.com/en/glossary/#transformer)

### Differential privacy

A privacy definition with a mathematical guarantee: adding or removing any one record changes the probability of any output by at most a factor of e^ε, plus δ. DP-SGD (Abadi et al., 2016) clips per-example gradients and adds noise. The unit of privacy (sentence, document, user) must be chosen first; it costs compute and utility, less when fine-tuning pretrained models (Yu et al., 2021).

- Also called: DP, DP-SGD
- Read the lesson: [Memorization and Privacy: What Models Remember, How to Measure and Reduce It](https://dmxsf.com/en/wiki/safety/memorization-and-privacy/)
- See also: [Memorization](https://dmxsf.com/en/glossary/#memorization), [Membership inference](https://dmxsf.com/en/glossary/#membership-inference)

### Diffusion language model

Text generation with discrete diffusion: the forward process replaces tokens with a mask symbol at a random rate, and a bidirectional Transformer learns to recover them; generation starts from an all-mask sequence and fills in words over several steps, predicting many positions in parallel instead of left to right. LLaDA (Nie et al., 2025) trained an 8B-parameter model of this kind.

- Read the lesson: [Diffusion Models and Flow Matching: Generating Images, Actions and Text from Noise](https://dmxsf.com/en/wiki/multimodal/diffusion-and-flow-matching/)

### Diffusion model

A family of generative models: a fixed forward process gradually adds noise to data until only noise is left, and a neural network learns the reverse process; generation starts from pure noise and denoises step by step. Training usually reduces to predicting the noise added at each step, a simple regression problem; the cost is that sampling needs many sequential network evaluations.

- Read the lesson: [Diffusion Models and Flow Matching: Generating Images, Actions and Text from Noise](https://dmxsf.com/en/wiki/multimodal/diffusion-and-flow-matching/)
- Paper notes: [DDPM: Add Noise Step by Step, Learn to Remove It Step by Step, and Train with a Simple Noise-Prediction Loss](https://dmxsf.com/en/blog/ddpm-denoising-diffusion-probabilistic-models/)
- See also: [Denoising diffusion probabilistic model](https://dmxsf.com/en/glossary/#ddpm), [KL divergence](https://dmxsf.com/en/glossary/#kl-divergence)

### Diffusion Policy

A robot visuomotor policy written as a conditional diffusion model: given the observation, it starts from Gaussian noise and iteratively denoises a sequence of future actions. It can represent several valid actions for one observation (multimodality) and trains by regressing noise, with no normalization constant to estimate as in energy-based models.

- Paper notes: [Diffusion Policy: Generating Robot Action Sequences by Conditional Denoising](https://dmxsf.com/en/blog/diffusion-policy-visuomotor-policy-learning-via-action-diffusion/)
- See also: [Behavior cloning](https://dmxsf.com/en/glossary/#behavior-cloning), [Action chunking](https://dmxsf.com/en/glossary/#action-chunking), [Denoising diffusion probabilistic model](https://dmxsf.com/en/glossary/#ddpm)

### Diffusion Transformer (DiT)

Peebles and Xie (2022) replaced the diffusion U-Net with a Transformer: the latent is cut into p×p patches, embedded into a token sequence with position encodings, and the timestep and class condition enter through adaptive layer norm (adaLN-Zero). More Gflops gave lower FID; DiT-XL/2 reaches FID 2.27 on ImageNet 256×256 with guidance. SD3's MM-DiT gives text and image tokens separate weights.

- Read the lesson: [Diffusion Models and Flow Matching: Generating Images, Actions and Text from Noise](https://dmxsf.com/en/wiki/multimodal/diffusion-and-flow-matching/)
- See also: [Latent diffusion model](https://dmxsf.com/en/glossary/#latent-diffusion), [Vision Transformer](https://dmxsf.com/en/glossary/#vit)

### Direct preference optimization (DPO)

Rewrites the RLHF objective as a classification-style loss that can be minimized directly on preference pairs, with no explicit reward model and no online reinforcement learning loop. Proposed by Rafailov et al. in 2023.

- Read the lesson: [Preference Optimization: From RLHF to DPO](https://dmxsf.com/en/wiki/post-training/preference-optimization/)
- Paper notes: [Direct Preference Optimization: Your Language Model is Secretly a Reward Model](https://dmxsf.com/en/blog/dpo-direct-preference-optimization/)
- See also: [Reinforcement learning from human feedback](https://dmxsf.com/en/glossary/#rlhf), [Reward model](https://dmxsf.com/en/glossary/#reward-model), [KL divergence](https://dmxsf.com/en/glossary/#kl-divergence)

### Distillation

Training a small student model to imitate a large teacher's output distribution or the data it generates, gaining much of the teacher's ability at a fraction of the cost.

- See also: [Supervised fine-tuning](https://dmxsf.com/en/glossary/#sft), [Reasoning model](https://dmxsf.com/en/glossary/#reasoning-model)

### Document mask

Pre-training packs several short documents into one fixed-length sequence to avoid waste; a document mask lets attention act only within a document, so later documents cannot see earlier ones. Llama 3 uses it: the paper says it matters little in standard pre-training but a lot in continued pre-training on very long sequences, and it is easy to support in all-gather based context parallelism.

- Paper notes: [The Llama 3 Herd of Models: data, scale and the engineering recipe of a 405B dense model](https://dmxsf.com/en/blog/the-llama-3-herd-of-models/)
- See also: [Causal mask](https://dmxsf.com/en/glossary/#causal-mask), [Context parallelism](https://dmxsf.com/en/glossary/#context-parallelism), [Context window](https://dmxsf.com/en/glossary/#context-window)

### DoReMi

A way to choose pretraining data mixtures (Xie et al., 2023): a small proxy model trained with Group DRO against a reference model upweights domains with the largest excess loss, and the weights averaged over training define the mixture. A 280M proxy set the weights for an 8B model: average few-shot accuracy on The Pile rose 6.5 points, and the baseline was reached in 2.6 times fewer steps.

- Read the lesson: [Pretraining Data Engineering: Filtering, Deduplication and Mixing](https://dmxsf.com/en/wiki/pretraining/data-engineering/)
- See also: [Data mixture](https://dmxsf.com/en/glossary/#data-mixture), [Scaling law](https://dmxsf.com/en/glossary/#scaling-law)

### Double quantization

Quantizing the scaling constants produced by block-wise quantization to save memory. In QLoRA every 64 weights share one 32-bit constant (0.5 bits per weight on average); double quantization subtracts the mean and quantizes those constants to 8-bit floats in blocks of 256, cutting the overhead to about 0.127 bits per weight, roughly 3 GB for a 65B model.

- Read the lesson: [LoRA Fine-Tuning in Practice](https://dmxsf.com/en/wiki/post-training/lora-finetuning/)
- Paper notes: [QLoRA: Fine-Tuning a 65B Model on One 48 GB GPU by Quantizing the Base to 4 Bits](https://dmxsf.com/en/blog/qlora-efficient-finetuning-of-quantized-llms/)
- See also: [QLoRA](https://dmxsf.com/en/glossary/#qlora), [4-bit NormalFloat](https://dmxsf.com/en/glossary/#nf4), [Quantization](https://dmxsf.com/en/glossary/#quantization)

### Doubly stochastic matrix

A square matrix with non-negative entries whose rows and columns each sum to 1. Its spectral norm is at most 1, products of such matrices stay doubly stochastic, and by the Birkhoff-von Neumann theorem each is a convex combination of permutation matrices. mHC uses it to constrain the residual mixing matrix, so the forward gain of composed layers is exactly 1.

- Also called: Birkhoff polytope
- Paper notes: [mHC: Keeping a Wider Residual Stream Stable With Doubly Stochastic Mixing](https://dmxsf.com/en/blog/mhc-manifold-constrained-hyper-connections/)
- See also: [Sinkhorn-Knopp algorithm](https://dmxsf.com/en/glossary/#sinkhorn-knopp), [Manifold-constrained hyper-connections](https://dmxsf.com/en/glossary/#mhc)

### Draft model

The small, fast model that guesses first in speculative decoding (the paper calls it the approximation model). It proposes several candidate tokens and the target model verifies them in parallel. It can be a smaller model of the same family, an n-gram table or extra decoding heads attached to the target; it affects only the acceptance rate and the speed, never the output distribution.

- Read the lesson: [Speculative Decoding: Draft with a Small Model, Verify with a Large One](https://dmxsf.com/en/wiki/inference/speculative-decoding/)
- Paper notes: [Fast Inference from Transformers via Speculative Decoding](https://dmxsf.com/en/blog/speculative-decoding-fast-inference-from-transformers/)
- See also: [Speculative decoding](https://dmxsf.com/en/glossary/#speculative-decoding), [Acceptance rate](https://dmxsf.com/en/glossary/#acceptance-rate)

### Dual Chunk Attention (DCA)

A training-free context-extension method: it splits long-sequence attention into chunk-based modules that capture relative positions within and across chunks, and works with FlashAttention. Proposed by An et al. (2024), who report that Llama 2 70B can handle windows of over 100k tokens without further training; Qwen3 combines it with YaRN to quadruple its sequence-length capacity.

- Paper notes: [Qwen3 Technical Report: One Model, Two Modes, a Thinking Budget and Strong-to-Weak Distillation](https://dmxsf.com/en/blog/qwen3-technical-report/)
- See also: [YaRN](https://dmxsf.com/en/glossary/#yarn), [Rotary position embedding](https://dmxsf.com/en/glossary/#rope), [Context window](https://dmxsf.com/en/glossary/#context-window)

### Dual LLM pattern

A structural defense: a privileged model that can call tools never reads untrusted content; a quarantined model reads it but has no tool access and returns only variable references, which ordinary code passes between the two. An injected quarantined model cannot use tools. Proposed by Simon Willison (2023); CaMeL (2025) develops it into explicit policy checks on data flow.

- Read the lesson: [Prompt Injection and Jailbreaks: The Security Boundaries of LLM Applications](https://dmxsf.com/en/wiki/safety/prompt-injection-and-jailbreaks/)
- See also: [Indirect prompt injection](https://dmxsf.com/en/glossary/#indirect-prompt-injection), [Prompt injection](https://dmxsf.com/en/glossary/#prompt-injection), [Agent](https://dmxsf.com/en/glossary/#agent)

### DualPipe

DeepSeek-V3's bidirectional pipeline-parallel schedule: each forward and backward chunk is split into attention, dispatch, MLP and combine parts and rearranged so that the computation and the all-to-all communication of expert parallelism of a forward-backward pair overlap, with micro-batches fed from both ends of the pipeline. The price is two copies of the parameters.

- Paper notes: [DeepSeek-V3 Technical Report: MoE, MLA, FP8 and Low-Cost Training](https://dmxsf.com/en/blog/deepseek-v3-technical-report/)
- See also: [Pipeline parallelism](https://dmxsf.com/en/glossary/#pipeline-parallelism), [Expert parallelism](https://dmxsf.com/en/glossary/#expert-parallelism)

### Dynamic resolution

Letting a vision-language model choose the number of patches and visual tokens from the image's own size (within a pixel budget) instead of resizing every image to a fixed square. Qwen2-VL rounds both sides to a multiple of the patch size times the merge factor, so the token count is roughly the pixel count divided by the square of that length.

- Also called: Naive dynamic resolution
- Read the lesson: [Multimodal LLMs: How an Image Becomes Tokens](https://dmxsf.com/en/wiki/multimodal/multimodal-llms/)
- See also: [Visual token](https://dmxsf.com/en/glossary/#visual-token), [Multimodal RoPE](https://dmxsf.com/en/glossary/#m-rope), [Vision Transformer](https://dmxsf.com/en/glossary/#vit)

### Dynamic sampling

Oversampling and discarding prompts whose whole group of answers is all right or all wrong (such a group has zero advantage everywhere) until the batch is full, so that every prompt in a batch carries a gradient. The second DAPO trick; the price is extra sampling, so the sampling cost is dynamic. With G=16, a prompt with accuracy 5% or 95% has a 44% chance of a zero-advantage group.

- Read the lesson: [Reinforcement Learning for Reasoning: RLVR and GRPO](https://dmxsf.com/en/wiki/post-training/reasoning-rl/)
- Paper notes: [DAPO: An Open-Source Reasoning RL System and the Four Tricks That Keep GRPO Stable on Long Chains of Thought](https://dmxsf.com/en/blog/dapo-open-source-llm-reinforcement-learning-system-at-scale/)
- See also: [DAPO](https://dmxsf.com/en/glossary/#dapo), [Group relative policy optimization](https://dmxsf.com/en/glossary/#grpo)

## E

### Elo rating

A strength rating from chess: a 400-point gap means 10-to-1 odds, which is the Bradley–Terry coefficient times 400/ln 10, about 173.7. With a 100-point gap the stronger side wins about 64% of the time.

- Read the lesson: [LLM-as-a-Judge: Using a Model as the Grader, Its Biases and Calibration](https://dmxsf.com/en/wiki/evaluation/llm-as-judge/)
- See also: [Bradley–Terry model](https://dmxsf.com/en/glossary/#bradley-terry), [Chatbot Arena](https://dmxsf.com/en/glossary/#chatbot-arena)

### Embedding

A lookup table that maps discrete token ids to continuous vectors; more broadly, any dense vector representation of text or images in which similar meanings end up close together.

- Read the lesson: [Tokenizers and Embeddings: BPE, Vocabulary Size and the Embedding Table](https://dmxsf.com/en/wiki/foundations/tokenizer-and-embeddings/)
- See also: [Token](https://dmxsf.com/en/glossary/#token), [Vector database](https://dmxsf.com/en/glossary/#vector-database)

### Embodiment

The concrete body of a robot: number of arms and degrees of freedom, gripper or dexterous hand, camera placement, and the dimensions and control mode of state and actions. Cross-embodiment training puts different robots' data into one model. GR00T N1 gives each embodiment its own encoder and decoder MLPs projecting to a shared width; the official code reserves 32 slots.

- Paper notes: [GR00T N1: A Data Pyramid and a Dual-System Model for Generalist Humanoid Robots](https://dmxsf.com/en/blog/gr00t-n1-an-open-foundation-model-for-generalist-humanoid-robots/)
- See also: [Open X-Embodiment](https://dmxsf.com/en/glossary/#open-x-embodiment), [Vision-language-action model](https://dmxsf.com/en/glossary/#vla)

### Emergent abilities

Abilities that sit near chance in small models and rise clearly above it only past some model scale. The chain-of-thought paper calls its finding that chain of thought pays off only from about 100B parameters emergence. Caveats: Schaeffer et al. (2023) argue that part of the sudden appearance comes from non-linear metrics, and the paper's Table 2 shows the threshold varies by model family.

- Read the lesson: [Scaling Laws: How to Split Compute Between Parameters and Data](https://dmxsf.com/en/wiki/pretraining/scaling-laws/)
- Paper notes: [Chain-of-thought prompting: exemplars with intermediate steps let large models solve multi-step problems](https://dmxsf.com/en/blog/chain-of-thought-prompting/)
- See also: [Scaling law](https://dmxsf.com/en/glossary/#scaling-law), [Chain of thought](https://dmxsf.com/en/glossary/#chain-of-thought), [In-context learning](https://dmxsf.com/en/glossary/#in-context-learning)

### Encoder-decoder model

An architecture in which an encoder reads the input bidirectionally and a decoder generates the output autoregressively, reading the encoding through cross-attention. The original Transformer and T5 are encoder-decoder models.

- Read the lesson: [Attention Basics: How a Transformer Reads Context](https://dmxsf.com/en/wiki/architecture/attention-basics/)
- See also: [Decoder-only model](https://dmxsf.com/en/glossary/#decoder-only), [Cross-attention](https://dmxsf.com/en/glossary/#cross-attention)

### Encoder-only model

An architecture that keeps only the Transformer encoder and uses no causal mask: every position sees both sides of the whole sequence, and the output is a contextual representation rather than a next-token distribution. It suits classification, retrieval, tagging and reranking but cannot generate token by token. BERT and RoBERTa are encoder-only models.

- Read the lesson: [Modern LLM Architecture: From GPT-2 to Llama, Qwen and DeepSeek](https://dmxsf.com/en/wiki/architecture/modern-llm-architecture/)
- Paper notes: [BERT: pre-training a bidirectional Transformer by filling in masked words, then one thin output layer per task](https://dmxsf.com/en/blog/bert-pre-training-of-deep-bidirectional-transformers/)
- See also: [Encoder-decoder model](https://dmxsf.com/en/glossary/#encoder-decoder), [Decoder-only model](https://dmxsf.com/en/glossary/#decoder-only), [BERT](https://dmxsf.com/en/glossary/#bert), [Causal mask](https://dmxsf.com/en/glossary/#causal-mask)

### Engram

A conditional-memory module that separates memorization from computation: hashed n-gram lookups into huge embedding tables, merged into the hidden state by context-aware gating. Addresses depend only on input tokens, so embeddings can be prefetched from host memory. DeepSeek-V4.1-Flash has one module at layer 1 and one at layer 14 (n-gram orders 2 to 4), 196B parameters in total, in FP8.

- Paper notes: [DeepSeek-V4.1-Flash: Getting the Global KV Cache Down to 890 Bytes per Token](https://dmxsf.com/en/blog/deepseek-v41-flash-pushing-the-limits-of-kv-cache-compression/)
- See also: [Sinkhorn-balanced update](https://dmxsf.com/en/glossary/#sinkhorn-balanced-update), [Mixture of Experts](https://dmxsf.com/en/glossary/#moe)

### Evolution strategies (ES)

A family of gradient-free black-box optimizers: keep a distribution over parameters, repeatedly sample a population of candidates, rank them by return and move the distribution toward the best ones; CMA-ES also adapts the covariance. They need only the final cumulative return and parallelize easily, which suits policies with a modest number of parameters.

- Paper notes: [World Models: Compress the World into a Generative Model and Let the Agent Train in Its Own Dream](https://dmxsf.com/en/blog/world-models-ha-schmidhuber/)

### Expected calibration error (ECE)

Bin predictions by confidence, take in each bin the absolute difference between average confidence and actual accuracy, and average these differences weighted by bin size. Lower is better and 0 means every bin is calibrated; the value depends on the binning (10 to 15 bins is common) and is noisy with few samples.

- Read the lesson: [Hallucination and Calibration: Why Models Sound Sure and Are Wrong](https://dmxsf.com/en/wiki/safety/hallucination-and-calibration/)
- See also: [Calibration](https://dmxsf.com/en/glossary/#calibration), [Reliability diagram](https://dmxsf.com/en/glossary/#reliability-diagram), [Temperature scaling](https://dmxsf.com/en/glossary/#temperature-scaling)

### Experience replay

Store each step of the agent's experience (state, action, reward, next state) in a fixed-size buffer and train on uniformly sampled minibatches from it. Each experience is reused many times, the strong correlation between consecutive samples is broken, and changes in the behavior distribution are averaged out. The price is that it only works with off-policy algorithms such as Q-learning.

- Paper notes: [DQN: Learning to Play Atari from Pixels with a Convolutional Q-Network and Experience Replay](https://dmxsf.com/en/blog/dqn-playing-atari-with-deep-reinforcement-learning/)
- See also: [Deep Q-network](https://dmxsf.com/en/glossary/#dqn)

### Expert dropout

A regularization method for fine-tuning sparse models: keep dropout small (for example 0.1) in the non-expert layers and raise it only inside the experts' feed-forward layers (for example 0.4), which eases the overfitting caused by many expert parameters and little fine-tuning data. Introduced in the Switch Transformer.

- Paper notes: [Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity](https://dmxsf.com/en/blog/switch-transformers-scaling-to-trillion-parameter-models/)
- See also: [Mixture of Experts](https://dmxsf.com/en/glossary/#moe)

### Expert load balancing

Keeping the number of tokens each expert of a mixture-of-experts model receives roughly equal, which avoids routing collapse and keeps the busiest expert from slowing down a whole layer under expert parallelism. Common methods are an auxiliary balancing loss, capacity limits with dropping, and DeepSeek-V3's bias method.

- Read the lesson: [Mixture of Experts (MoE): Routing, Load Balancing and Sparse Activation](https://dmxsf.com/en/wiki/architecture/mixture-of-experts/)
- Paper notes: [Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity](https://dmxsf.com/en/blog/switch-transformers-scaling-to-trillion-parameter-models/)
- See also: [Mixture of Experts](https://dmxsf.com/en/glossary/#moe), [Router](https://dmxsf.com/en/glossary/#router), [Capacity factor](https://dmxsf.com/en/glossary/#capacity-factor)

### Expert parallelism

A way of parallelizing a mixture-of-experts model by placing different experts on different GPUs. After routing, tokens are dispatched to the GPUs that hold their experts and combined back afterwards, which takes two all-to-all communications.

- Also called: EP
- Read the lesson: [Mixture of Experts (MoE): Routing, Load Balancing and Sparse Activation](https://dmxsf.com/en/wiki/architecture/mixture-of-experts/)
- Paper notes: [DeepSeek-V3 Technical Report: MoE, MLA, FP8 and Low-Cost Training](https://dmxsf.com/en/blog/deepseek-v3-technical-report/)
- See also: [Mixture of Experts](https://dmxsf.com/en/glossary/#moe), [Tensor parallelism](https://dmxsf.com/en/glossary/#tensor-parallelism), [Data parallelism](https://dmxsf.com/en/glossary/#data-parallelism)

### Exposure

A memorization metric from Carlini et al. (2018): insert a random secret (a canary) into the training set, rank all possible values by the model's score, and compute log2(number of candidates) minus log2(rank of the true secret). It ranges from 0 to log2(number of candidates); a model that knows nothing gets a bit or two, and each extra bit halves the candidates an attacker must check.

- Also called: Canary exposure
- Read the lesson: [Memorization and Privacy: What Models Remember, How to Measure and Reduce It](https://dmxsf.com/en/wiki/safety/memorization-and-privacy/)
- See also: [Memorization](https://dmxsf.com/en/glossary/#memorization), [Canary string](https://dmxsf.com/en/glossary/#canary-string), [Extractable memorization](https://dmxsf.com/en/glossary/#extractable-memorization)

### Extractable memorization

Definition of Carlini et al. (2022): a string s is extractable with k tokens of context if some length-k prefix p exists such that p followed by s occurs in the training data and greedy decoding from p writes s. It needs only generation, so it became the standard at scale, but it counts only fully correct outputs, misses partial memory and depends on the prompt and decoding.

- Also called: k-extractable
- Read the lesson: [Memorization and Privacy: What Models Remember, How to Measure and Reduce It](https://dmxsf.com/en/wiki/safety/memorization-and-privacy/)
- See also: [Memorization](https://dmxsf.com/en/glossary/#memorization), [Exposure](https://dmxsf.com/en/glossary/#canary-exposure), [Training data extraction](https://dmxsf.com/en/glossary/#training-data-extraction)

## F

### Feature alignment

The first stage of multimodal training: freeze the vision encoder and the language model and train only the projector between them, so that visual features land in a word-embedding space the language model can read. LLaVA treats it as training a visual tokenizer for the frozen language model: 595K CC3M pairs, about 5.25 million trainable parameters (0.04%).

- Read the lesson: [Multimodal LLMs: How an Image Becomes Tokens](https://dmxsf.com/en/wiki/multimodal/multimodal-llms/)
- Paper notes: [LLaVA: Text-Only GPT-4 Writes 158K Visual Instructions and a Language Model Learns to See](https://dmxsf.com/en/blog/llava-visual-instruction-tuning/)
- See also: [Projector](https://dmxsf.com/en/glossary/#projector), [Vision-language model](https://dmxsf.com/en/glossary/#vlm), [Visual token](https://dmxsf.com/en/glossary/#visual-token)

### Feed-forward network (FFN)

The fully connected network applied to each token independently in every Transformer layer. It holds most of the model's parameters, and some research suggests it acts like a key-value memory.

- Read the lesson: [Transformer Block Explained: Attention, FFN, Residuals and LayerNorm](https://dmxsf.com/en/wiki/architecture/transformer-block/)
- See also: [SwiGLU](https://dmxsf.com/en/glossary/#swiglu), [Mixture of Experts](https://dmxsf.com/en/glossary/#moe), [Transformer](https://dmxsf.com/en/glossary/#transformer)

### Few-shot prompting

Putting a few input-output examples in the prompt so the model completes a new input in the same way.

- Read the lesson: [Prompt Engineering: A Systematic Guide to Specs, Layers, Examples and Evaluation](https://dmxsf.com/en/wiki/applications/prompt-engineering/)
- See also: [In-context learning](https://dmxsf.com/en/glossary/#in-context-learning), [Prompt engineering](https://dmxsf.com/en/glossary/#prompt-engineering)

### Fine-tuning

Continuing to train a pretrained model on data from a specific task or domain so that it adapts to it.

- Read the lesson: [LoRA Fine-Tuning in Practice](https://dmxsf.com/en/wiki/post-training/lora-finetuning/)
- See also: [Supervised fine-tuning](https://dmxsf.com/en/glossary/#sft), [LoRA](https://dmxsf.com/en/glossary/#lora), [Parameter-efficient fine-tuning](https://dmxsf.com/en/glossary/#peft)

### FineWeb

An open English web pretraining corpus released by Hugging Face in 2024: 96 Common Crawl snapshots processed with datatrove, about 15T tokens under the GPT-2 tokenizer. FineWeb-Edu is a 1.3T-token subset picked by an educational-value classifier. Each step (extraction, deduplication, filtering) is backed by ablations on a 1.71B model; code, data and ablation models are all public.

- Also called: FineWeb-Edu
- Paper notes: [FineWeb: Extracting, Deduplicating and Filtering a 15T-Token Open Web Corpus, One Ablation at a Time](https://dmxsf.com/en/blog/the-fineweb-datasets-decanting-the-web-for-the-finest-text-data-at-scale/)
- See also: [Common Crawl](https://dmxsf.com/en/glossary/#common-crawl), [Deduplication](https://dmxsf.com/en/glossary/#deduplication), [Heuristic filtering](https://dmxsf.com/en/glossary/#heuristic-filter), [Model-based filtering](https://dmxsf.com/en/glossary/#model-based-filtering), [Data ablation](https://dmxsf.com/en/glossary/#data-ablation)

### FlashAttention

An exact attention algorithm that uses tiling and an online softmax so the n×n attention matrix is never written to GPU memory (HBM). It cuts memory traffic sharply, runs faster, and its memory use grows linearly with sequence length. Proposed by Dao et al. in 2022.

- Paper notes: [FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness](https://dmxsf.com/en/blog/flashattention-fast-and-memory-efficient-exact-attention/)
- See also: [KV cache](https://dmxsf.com/en/glossary/#kv-cache), [Memory-bound](https://dmxsf.com/en/glossary/#memory-bound), [Self-attention](https://dmxsf.com/en/glossary/#self-attention)

### FLOPs

The number of floating-point operations, a measure of compute. Training a dense Transformer costs roughly 6·N·D, where N is the number of parameters that take part in matrix multiplications and D the number of training tokens.

- Also called: Floating-point operations
- Read the lesson: [The Compute and Memory Ledger of Training: FLOPs, MFU and Memory Budgets](https://dmxsf.com/en/wiki/pretraining/compute-and-memory/)
- See also: [Scaling law](https://dmxsf.com/en/glossary/#scaling-law), [Model FLOPs utilization](https://dmxsf.com/en/glossary/#mfu)

### Flow matching

A training method for generative models: fix a probability path from a noise distribution to the data distribution, regress the vector field that generates it, and sample by integrating an ODE. Training needs no ODE solves, because a per-sample conditional target (such as x1 − x0) has the same gradient as the intractable original objective; diffusion paths are one special case.

- Read the lesson: [Diffusion Models and Flow Matching: Generating Images, Actions and Text from Noise](https://dmxsf.com/en/wiki/multimodal/diffusion-and-flow-matching/)
- Paper notes: [Flow Matching: Regress a Fixed Path's Vector Field and Train Continuous Normalizing Flows Without Simulation](https://dmxsf.com/en/blog/flow-matching-for-generative-modeling/)
- See also: [Diffusion model](https://dmxsf.com/en/glossary/#diffusion-model), [Continuous normalizing flow](https://dmxsf.com/en/glossary/#continuous-normalizing-flow)

### FP4 KV cache

DeepSeek-V4.1-Flash stores the main KV in 4-bit floating point (E2M1) with one E4M3 scale per 16 channels and no second-level global scale. QAT starts in post-training, quantization follows RoPE, and sliding-window KV stays FP8. Values are dequantized before attention, so it saves storage, not matmul time. Channel magnitudes stay below about 22.6, far under the 448×6=2688 the format reaches.

- Paper notes: [DeepSeek-V4.1-Flash: Getting the Global KV Cache Down to 890 Bytes per Token](https://dmxsf.com/en/blog/deepseek-v41-flash-pushing-the-limits-of-kv-cache-compression/)
- See also: [Quantization](https://dmxsf.com/en/glossary/#quantization), [KV cache](https://dmxsf.com/en/glossary/#kv-cache), [FP8 training](https://dmxsf.com/en/glossary/#fp8-training)

### FP8 training

Training with 8-bit floating-point matrix multiplications, which in theory doubles the throughput of BF16. The range is narrow, so it needs fine-grained scaling: DeepSeek-V3 uses one scale per 1×128 tile of activations and per 128×128 block of weights, and promotes partial sums to FP32 while accumulating. Embeddings, the output head, MoE gating, normalization and attention stay in BF16/FP32.

- Also called: FP8 mixed-precision training
- Paper notes: [DeepSeek-V3 Technical Report: MoE, MLA, FP8 and Low-Cost Training](https://dmxsf.com/en/blog/deepseek-v3-technical-report/)
- See also: [Mixed-precision training](https://dmxsf.com/en/glossary/#mixed-precision), [BF16](https://dmxsf.com/en/glossary/#bf16)

### Function calling

The model emits the name of a function and JSON arguments in an agreed format, the application actually runs it, and the result is handed back to the model.

- Also called: Tool use
- Read the lesson: [Structured Outputs and Function Calling: From JSON Mode to Constrained Decoding](https://dmxsf.com/en/wiki/applications/structured-output-and-function-calling/)
- Paper notes: [Toolformer: Scoring Tool Calls by How Much They Cut the Loss, So a Language Model Learns When to Ask for Help](https://dmxsf.com/en/blog/toolformer-self-supervised-tool-use-for-language-models/)
- See also: [Agent](https://dmxsf.com/en/glossary/#agent), [Structured output](https://dmxsf.com/en/glossary/#structured-output), [JSON Schema](https://dmxsf.com/en/glossary/#json-schema), [Model Context Protocol](https://dmxsf.com/en/glossary/#mcp)

## G

### Gated DeltaNet

Gated DeltaNet (Yang et al., 2024) adds an input-dependent decay gate α_t to the delta rule: S_t = α_t (I − β_t k_t k_tᵀ) S_{t−1} + β_t k_t v_tᵀ. The gate erases memory in bulk, while the delta rule updates a single association, and the two are complementary. Qwen3-Next interleaves it with attention layers at a ratio of 3 to 1.

- Read the lesson: [State Space Models and Hybrids: Trading the KV Cache for a Fixed-Size State](https://dmxsf.com/en/wiki/architecture/state-space-and-hybrid/)
- See also: [Delta rule](https://dmxsf.com/en/glossary/#delta-rule), [Hybrid architecture](https://dmxsf.com/en/glossary/#hybrid-architecture), [Linear attention](https://dmxsf.com/en/glossary/#linear-attention)

### Generalized advantage estimation (GAE)

An advantage estimator that trades bias against variance with one parameter λ: it sums the one-step temporal-difference errors δ_t = r_t + γV(s_(t+1)) − V(s_t) with geometric weights (γλ). λ=0 uses a single step (low variance, more bias) and λ=1 equals the Monte Carlo return minus the value baseline (high variance). The PPO paper uses λ=0.95 in all its experiments.

- Read the lesson: [Reinforcement Learning Basics: Policy Gradients, Advantages and PPO](https://dmxsf.com/en/wiki/post-training/rl-fundamentals/)
- Paper notes: [PPO: Clipping the Policy Update So One Batch of Data Can Be Reused for Many Epochs](https://dmxsf.com/en/blog/ppo-proximal-policy-optimization-algorithms/)
- See also: [Proximal policy optimization](https://dmxsf.com/en/glossary/#ppo), [Group relative policy optimization](https://dmxsf.com/en/glossary/#grpo), [Advantage](https://dmxsf.com/en/glossary/#advantage), [Value function](https://dmxsf.com/en/glossary/#value-function)

### Generative adversarial network

An implicit generative model trained by a generator that synthesizes samples from noise and a discriminator that distinguishes them from data, ideally reaching matching distributions.

- Paper notes: [GAN: Learning a data distribution through a minimax game](https://dmxsf.com/en/blog/generative-adversarial-nets/)
- See also: [Diffusion model](https://dmxsf.com/en/glossary/#diffusion-model)

### Generative Pre-trained Transformer (GPT)

OpenAI's line of decoder-only Transformer language models since 2018. GPT-1 has about 117 million parameters and is fine-tuned per task; the largest GPT-2 has about 1.56 billion and is used zero-shot; GPT-3 has 175 billion and gets its task and examples in the prompt, with no weight updates. The backbone barely changed; scale and the way a task enters the model did.

- Read the lesson: [The LLM Training Pipeline: From Data to Deployment](https://dmxsf.com/en/wiki/pretraining/training-pipeline/)
- Paper notes: [GPT-1, GPT-2, GPT-3: From Fine-Tuning to In-Context Learning, Recomputed from the Papers](https://dmxsf.com/en/blog/gpt-series-evolution/)
- See also: [Decoder-only model](https://dmxsf.com/en/glossary/#decoder-only), [Generative pre-training](https://dmxsf.com/en/glossary/#generative-pre-training), [In-context learning](https://dmxsf.com/en/glossary/#in-context-learning), [Scaling law](https://dmxsf.com/en/glossary/#scaling-law)

### Generative pre-training

GPT-1's (2018) two-stage recipe: pre-train a 12-layer decoder Transformer on unlabeled text with a language-modeling loss, then fine-tune on each labeled task. Structured inputs are packed into one sequence with start, delimiter and extract tokens, a linear output layer is added, and the language-modeling loss stays as an auxiliary term (weight 0.5). State of the art on 9 of 12 tasks.

- Read the lesson: [The LLM Training Pipeline: From Data to Deployment](https://dmxsf.com/en/wiki/pretraining/training-pipeline/)
- Paper notes: [GPT-1, GPT-2, GPT-3: From Fine-Tuning to In-Context Learning, Recomputed from the Papers](https://dmxsf.com/en/blog/gpt-series-evolution/)
- See also: [Generative Pre-trained Transformer](https://dmxsf.com/en/glossary/#gpt), [Fine-tuning](https://dmxsf.com/en/glossary/#fine-tuning), [Decoder-only model](https://dmxsf.com/en/glossary/#decoder-only), [Next-token prediction](https://dmxsf.com/en/glossary/#next-token-prediction)

### Goldfish loss

A training objective of Hans et al. (2024) that reduces memorization by leaving some tokens out of the loss: a position is dropped when a hash of the h preceding tokens falls in a 1/k share of the range (the paper uses k=4, h=13), so all copies of a passage drop the same positions. Long verbatim recitation becomes exponentially harder; a short secret gets limited protection.

- Read the lesson: [Memorization and Privacy: What Models Remember, How to Measure and Reduce It](https://dmxsf.com/en/wiki/safety/memorization-and-privacy/)
- See also: [Memorization](https://dmxsf.com/en/glossary/#memorization), [Deduplication](https://dmxsf.com/en/glossary/#deduplication)

### Goodhart’s law

“When a measure becomes a target, it ceases to be a good measure.” In machine learning, the harder you optimize a learned proxy such as a reward model, the more the proxy’s relationship to the true objective tends to break. Manheim and Garrabrant (2018) split it into regressional (noise), extremal (outside the training distribution), causal and adversarial variants.

- Read the lesson: [Reward Models: Turning Human Preferences into a Score to Optimize](https://dmxsf.com/en/wiki/post-training/reward-models/)
- See also: [Reward overoptimization](https://dmxsf.com/en/glossary/#reward-overoptimization), [Reward hacking](https://dmxsf.com/en/glossary/#reward-hacking), [Reward model](https://dmxsf.com/en/glossary/#reward-model)

### Goodput

The number of successful requests per unit time that meet all service-level objectives. Streaming LLM inference commonly checks both time to first token and mean inter-token latency per request.

- Read the lesson: [LLM Inference Serving: Latency Metrics, Measuring, and Choosing an Engine](https://dmxsf.com/en/wiki/inference/serving/)
- See also: [Throughput](https://dmxsf.com/en/glossary/#throughput), [Time to first token](https://dmxsf.com/en/glossary/#ttft), [Time per output token](https://dmxsf.com/en/glossary/#tpot)

### GPTQ

A post-training weight quantization method that goes layer by layer and uses approximate second-order (Hessian) information to minimize quantization error, often down to 4 bits.

- Read the lesson: [Model Quantization: INT8, INT4, GPTQ and AWQ Explained and Measured](https://dmxsf.com/en/wiki/inference/quantization/)
- See also: [Quantization](https://dmxsf.com/en/glossary/#quantization), [AWQ](https://dmxsf.com/en/glossary/#awq)

### GPU tiling

Partitioning a tensor operation into blocks that fit on-chip storage so threads can load and reuse data cooperatively. Output tiles determine accumulator size and reuse, while reduction tiles determine the work per iteration.

- Also called: Tiling
- Read the lesson: [GPU kernels: from tiled matrix multiplication to fusion](https://dmxsf.com/en/wiki/systems/gpu-kernels/)
- See also: [Roofline model](https://dmxsf.com/en/glossary/#roofline-model), [Arithmetic intensity](https://dmxsf.com/en/glossary/#arithmetic-intensity), [Kernel fusion](https://dmxsf.com/en/glossary/#kernel-fusion)

### Gradient accumulation

Splitting a large batch into micro-batches that are run forward and backward one after another, summing the gradients and updating the parameters only once enough have accumulated, which trades time for memory. When micro-batches have different numbers of valid tokens, normalize by the global token count, otherwise it is not equivalent to a true large batch.

- Read the lesson: [Distributed Training: Data, Tensor and Pipeline Parallelism](https://dmxsf.com/en/wiki/pretraining/distributed-training/)
- See also: [Data parallelism](https://dmxsf.com/en/glossary/#data-parallelism), [All-reduce](https://dmxsf.com/en/glossary/#all-reduce)

### Gradient check

The standard way to verify a backpropagation implementation: perturb each parameter slightly, estimate the gradient with the central difference (L(θ+ε)−L(θ−ε))/2ε, and compare it with the backpropagated one. N parameters cost 2N forward passes, so it is for checking implementations, not for training, and should be run in float64.

- Read the lesson: [Neural Network Basics: From Linear Layers to Backpropagation](https://dmxsf.com/en/wiki/foundations/neural-network-basics/)
- See also: [Backpropagation](https://dmxsf.com/en/glossary/#backpropagation)

### Gradient clipping

Scaling the gradient down when its norm exceeds a threshold, so an occasional huge gradient cannot make training diverge. A threshold of 1.0 is common in LLM training.

- Read the lesson: [Optimizers and Training Stability: AdamW, Warmup, Mixed Precision, Loss Spikes](https://dmxsf.com/en/wiki/foundations/optimizers-and-training-stability/)
- See also: [AdamW](https://dmxsf.com/en/glossary/#adamw), [Learning-rate schedule](https://dmxsf.com/en/glossary/#lr-schedule)

### Greedy decoding

Picking the most probable token at every step. It is deterministic and fast, but tends to repeat itself and does not guarantee the most probable overall sequence.

- Read the lesson: [Decoding and Sampling: Temperature, Top-k, Top-p and Beam Search](https://dmxsf.com/en/wiki/inference/decoding-and-sampling/)
- See also: [Beam search](https://dmxsf.com/en/glossary/#beam-search), [Temperature](https://dmxsf.com/en/glossary/#temperature)

### Group relative policy optimization (GRPO)

Samples a group of responses to the same prompt and normalizes their rewards by the group mean and standard deviation to get advantages, which removes the value model PPO needs. Introduced in DeepSeekMath and used by DeepSeek-R1.

- Read the lesson: [Reinforcement Learning for Reasoning: RLVR and GRPO](https://dmxsf.com/en/wiki/post-training/reasoning-rl/)
- Paper notes: [DeepSeekMath: Math Corpus, GRPO and a Unified View of Reinforcement Learning](https://dmxsf.com/en/blog/deepseekmath-pushing-the-limits-of-mathematical-reasoning/)
- See also: [Proximal policy optimization](https://dmxsf.com/en/glossary/#ppo), [Reinforcement learning with verifiable rewards](https://dmxsf.com/en/glossary/#rlvr), [Reasoning model](https://dmxsf.com/en/glossary/#reasoning-model), [REINFORCE Leave-One-Out](https://dmxsf.com/en/glossary/#rloo), [Baseline (policy gradient)](https://dmxsf.com/en/glossary/#rl-baseline)

### Group reward-Decoupled Normalization Policy Optimization (GDPO)

A multi-reward RL method from NVIDIA (2026). GRPO sums the rewards and normalizes the total inside the group, which can give different reward combinations the same advantage (reward collapse). GDPO normalizes each reward inside the group first, sums them with weights and normalizes once over the batch, so the advantage scale does not grow with the number of rewards.

- Read the lesson: [Reinforcement Learning for Reasoning: RLVR and GRPO](https://dmxsf.com/en/wiki/post-training/reasoning-rl/)
- Paper notes: [GDPO: Why Multi-Reward RL Should Normalize Each Reward on Its Own](https://dmxsf.com/en/blog/gdpo-group-reward-decoupled-normalization-policy-optimization/)
- See also: [Group relative policy optimization](https://dmxsf.com/en/glossary/#grpo), [DAPO](https://dmxsf.com/en/glossary/#dapo), [Reward hacking](https://dmxsf.com/en/glossary/#reward-hacking)

### Group sequence policy optimization (GSPO)

A reinforcement learning algorithm from the Qwen team (2025). Like GRPO it uses group-normalized advantages and no value model, but it changes the unit of the importance ratio: one ratio per response (the sequence likelihood ratio to the power 1/length), clipped as a whole, instead of one per token. The paper reports more stable training and no Routing Replay for MoE models.

- Read the lesson: [Reinforcement Learning for Reasoning: RLVR and GRPO](https://dmxsf.com/en/wiki/post-training/reasoning-rl/)
- Paper notes: [GSPO: Moving Importance Ratios and Clipping From Tokens to Whole Responses](https://dmxsf.com/en/blog/gspo-group-sequence-policy-optimization/)
- See also: [Group relative policy optimization](https://dmxsf.com/en/glossary/#grpo), [DAPO](https://dmxsf.com/en/glossary/#dapo), [Importance sampling](https://dmxsf.com/en/glossary/#importance-sampling), [Routing Replay](https://dmxsf.com/en/glossary/#routing-replay), [Mixture of Experts](https://dmxsf.com/en/glossary/#moe)

### Grouped-query attention (GQA)

Query heads are split into groups and each group shares one key/value head, a middle ground between multi-head and multi-query attention. Used by Llama 2 70B, Llama 3 and Mistral 7B, among others.

- Read the lesson: [Modern LLM Architecture: From GPT-2 to Llama, Qwen and DeepSeek](https://dmxsf.com/en/wiki/architecture/modern-llm-architecture/)
- Paper notes: [GQA: Turning Multi-Head Checkpoints into Grouped-Query Attention for 5% of Pretraining Compute](https://dmxsf.com/en/blog/gqa-grouped-query-attention/)
- See also: [Multi-query attention](https://dmxsf.com/en/glossary/#mqa), [Multi-head attention](https://dmxsf.com/en/glossary/#multi-head-attention), [Multi-head latent attention](https://dmxsf.com/en/glossary/#mla), [KV cache](https://dmxsf.com/en/glossary/#kv-cache)

### GSM8K

A dataset of grade-school math word problems by Cobbe et al.: about 8.5K problems, each needing 2 to 8 reasoning steps and ending in a number; the official repository has 7,473 training and 1,319 test problems.

- Read the lesson: [LLM Evaluation Methodology: Benchmarks, Contamination and a Workflow](https://dmxsf.com/en/wiki/evaluation/llm-evaluation/)
- See also: [Benchmark](https://dmxsf.com/en/glossary/#benchmark), [Chain of thought](https://dmxsf.com/en/glossary/#chain-of-thought)

### Guardrail

A layer of input and output checks outside the model: rules or classifier models that filter disallowed requests, block harmful output and validate format. It lowers risk but can itself be bypassed, so it should be combined with structural measures such as least privilege.

- Read the lesson: [Prompt Injection and Jailbreaks: The Security Boundaries of LLM Applications](https://dmxsf.com/en/wiki/safety/prompt-injection-and-jailbreaks/)
- See also: [Prompt injection](https://dmxsf.com/en/glossary/#prompt-injection), [Jailbreak](https://dmxsf.com/en/glossary/#jailbreak), [Red teaming](https://dmxsf.com/en/glossary/#red-teaming)

## H

### Hallucination

Output that reads fluently but contradicts the facts or the supplied sources. Retrieval, citations and post-hoc verification reduce it, but none eliminates it.

- Read the lesson: [Hallucination and Calibration: Why Models Sound Sure and Are Wrong](https://dmxsf.com/en/wiki/safety/hallucination-and-calibration/)
- See also: [Retrieval-augmented generation](https://dmxsf.com/en/glossary/#rag), [Benchmark](https://dmxsf.com/en/glossary/#benchmark)

### Hardware FLOPs utilization (HFU)

The FLOPs the hardware actually executes divided by its theoretical peak, with recomputed operations counted. With activation recomputation, HFU is higher than MFU for the same run: PaLM 540B has an MFU of 46.2% and an HFU of 57.8%.

- Read the lesson: [The Compute and Memory Ledger of Training: FLOPs, MFU and Memory Budgets](https://dmxsf.com/en/wiki/pretraining/compute-and-memory/)
- See also: [Model FLOPs utilization](https://dmxsf.com/en/glossary/#mfu), [Activation checkpointing](https://dmxsf.com/en/glossary/#activation-checkpointing)

### Heuristic filtering

Filtering low-quality pages with hand-designed statistical rules: drop lines without terminal punctuation, short documents, documents full of repeated lines. Rules are cheap and can be ablated one by one, but thresholds depend on the data and benchmarks. FineWeb found that C4's terminal-punctuation rule alone removes about 30% of tokens, and that dropping it and keeping the rest works better.

- Read the lesson: [Pretraining Data Engineering: Filtering, Deduplication and Mixing](https://dmxsf.com/en/wiki/pretraining/data-engineering/)
- Paper notes: [FineWeb: Extracting, Deduplicating and Filtering a 15T-Token Open Web Corpus, One Ablation at a Time](https://dmxsf.com/en/blog/the-fineweb-datasets-decanting-the-web-for-the-finest-text-data-at-scale/)
- See also: [FineWeb](https://dmxsf.com/en/glossary/#fineweb), [Model-based filtering](https://dmxsf.com/en/glossary/#model-based-filtering), [Deduplication](https://dmxsf.com/en/glossary/#deduplication)

### Hierarchical sparse indexer

The indexing scheme in the DeepSeek-V4.1-Flash decoder. The first Full layer scores every visible position and also keeps the 2,048 best blocks of 8 positions, a pool of 16,384 candidates; later Reindex layers score only inside that pool and pick their own top-512, so their cost no longer grows with context length. The linear term is confined to one layer, not removed.

- Paper notes: [DeepSeek-V4.1-Flash: Getting the Global KV Cache Down to 890 Bytes per Token](https://dmxsf.com/en/blog/deepseek-v41-flash-pushing-the-limits-of-kv-cache-compression/)
- See also: [Compressed Sparse Attention 2](https://dmxsf.com/en/glossary/#csa2), [Lightning indexer](https://dmxsf.com/en/glossary/#lightning-indexer), [Top-k sampling](https://dmxsf.com/en/glossary/#top-k)

### High Bandwidth Memory (HBM)

Memory built from stacked DRAM dies placed next to the GPU in the same package. It offers bandwidth of several terabytes per second, far above ordinary GPU memory, but capacity is limited, from tens of gigabytes to nearly two hundred per device. Weights, KV cache and activations live there, so inference speed often depends on how fast data is read from it.

- Read the lesson: [GPUs and the Roofline Model: Why Big Models Are Bound by Memory Bandwidth](https://dmxsf.com/en/wiki/systems/gpu-and-roofline/)
- See also: [Memory-bound](https://dmxsf.com/en/glossary/#memory-bound), [Arithmetic intensity](https://dmxsf.com/en/glossary/#arithmetic-intensity), [KV cache](https://dmxsf.com/en/glossary/#kv-cache)

### HumanEval

A code benchmark released with the Codex paper by Chen et al.: 164 hand-written Python problems, each giving a function signature and docstring, with unit tests that check the generated function; results are reported as pass@k.

- Read the lesson: [LLM Evaluation Methodology: Benchmarks, Contamination and a Workflow](https://dmxsf.com/en/wiki/evaluation/llm-evaluation/)
- See also: [pass@k](https://dmxsf.com/en/glossary/#pass-at-k), [Benchmark](https://dmxsf.com/en/glossary/#benchmark), [Benchmark contamination](https://dmxsf.com/en/glossary/#contamination)

### Hybrid architecture

A model that interleaves a few attention layers with many recurrent layers (Mamba, linear attention, Gated DeltaNet). The recurrent layers mix information cheaply through a fixed-size state, the attention layers recall verbatim, and the cache grows only with the attention layers. Jamba has 1 attention layer in every 8, so its KV cache at 256K tokens is 1/8 of a same-shape full-attention model.

- Read the lesson: [State Space Models and Hybrids: Trading the KV Cache for a Fixed-Size State](https://dmxsf.com/en/wiki/architecture/state-space-and-hybrid/)
- See also: [State space model](https://dmxsf.com/en/glossary/#ssm), [Mamba](https://dmxsf.com/en/glossary/#mamba), [Gated DeltaNet](https://dmxsf.com/en/glossary/#gated-deltanet), [KV cache](https://dmxsf.com/en/glossary/#kv-cache)

### Hyper-connections (HC)

A residual connection with n parallel streams (an n×C hidden state) and three learned mappings: H_pre merges the streams into one sub-layer input, H_post spreads the output back, and H_res is an n×n matrix mixing the streams. It widens the residual stream without extra FLOPs, but the unconstrained mappings can make the gain over many layers unbounded, which mHC addresses (Zhu et al., 2024).

- Paper notes: [mHC: Keeping a Wider Residual Stream Stable With Doubly Stochastic Mixing](https://dmxsf.com/en/blog/mhc-manifold-constrained-hyper-connections/)
- See also: [Residual connection](https://dmxsf.com/en/glossary/#residual-connection), [Manifold-constrained hyper-connections](https://dmxsf.com/en/glossary/#mhc), [Doubly stochastic matrix](https://dmxsf.com/en/glossary/#doubly-stochastic-matrix)

### Hypothetical Document Embeddings (HyDE)

Ask an LLM to write a hypothetical answer document, then retrieve real documents with its embedding, so retrieval compares answer with answer instead of question with answer. Facts in the hypothetical document may be wrong, so it only produces a search vector; the cost is an extra generation, and model mistakes can leak into retrieval. Proposed by Gao et al. in 2022 (arXiv:2212.10496).

- Read the lesson: [RAG in Practice: Chunking, Hybrid Retrieval, Reranking and Evaluation](https://dmxsf.com/en/wiki/applications/rag/)
- Paper notes: [RAG survey: three paradigms, four abilities, and a recount of the paper's tables](https://dmxsf.com/en/blog/rag-survey/)
- See also: [Query rewriting](https://dmxsf.com/en/glossary/#query-rewriting), [Embedding](https://dmxsf.com/en/glossary/#embedding), [Retrieval-augmented generation](https://dmxsf.com/en/glossary/#rag)

## I

### Implicit reward

The reward that DPO defines through the log-ratio of the policy and the reference model: r(x, y) = beta * log(pi(y|x) / pi_ref(y|x)). It is never trained as a separate model, yet under the Bradley-Terry model minimizing the DPO loss fits exactly this reward, which differs from the true reward only by a term that depends on the prompt alone (the partition function).

- Read the lesson: [Preference Optimization: From RLHF to DPO](https://dmxsf.com/en/wiki/post-training/preference-optimization/)
- Paper notes: [Direct Preference Optimization: Your Language Model is Secretly a Reward Model](https://dmxsf.com/en/blog/dpo-direct-preference-optimization/)
- See also: [Direct preference optimization](https://dmxsf.com/en/glossary/#dpo), [Reward model](https://dmxsf.com/en/glossary/#reward-model), [Bradley–Terry model](https://dmxsf.com/en/glossary/#bradley-terry), [Reference model](https://dmxsf.com/en/glossary/#reference-model)

### Importance sampling

Estimating an expectation under a target distribution from samples of another (behavior) distribution by weighting each sample by the ratio of the two probabilities. PPO-style algorithms weight old-policy samples by the new-to-old probability ratio and clip it. The weight corrects the mismatch only when averaged over many samples, which is GSPO's argument against per-token ratios.

- Also called: Importance ratio, Importance weight
- Read the lesson: [Reinforcement Learning Basics: Policy Gradients, Advantages and PPO](https://dmxsf.com/en/wiki/post-training/rl-fundamentals/)
- Paper notes: [GSPO: Moving Importance Ratios and Clipping From Tokens to Whole Responses](https://dmxsf.com/en/blog/gspo-group-sequence-policy-optimization/)
- See also: [Proximal policy optimization](https://dmxsf.com/en/glossary/#ppo), [Group relative policy optimization](https://dmxsf.com/en/glossary/#grpo), [Group sequence policy optimization](https://dmxsf.com/en/glossary/#gspo)

### In-context learning

The ability to pick up a new task from examples or instructions in the prompt alone, without updating any parameters. GPT-3 demonstrated it systematically.

- Read the lesson: [Prompt Engineering: A Systematic Guide to Specs, Layers, Examples and Evaluation](https://dmxsf.com/en/wiki/applications/prompt-engineering/)
- See also: [Few-shot prompting](https://dmxsf.com/en/glossary/#few-shot), [Prompt engineering](https://dmxsf.com/en/glossary/#prompt-engineering)

### Indirect object identification (IOI)

A task widely used in interpretability: given 'When Mary and John went to the store, John gave a drink to', the model should complete the indirect object Mary, not the repeated subject John. Wang et al. (2022) found its circuit in GPT-2 small by causal interventions: 26 attention heads in 7 classes, including name movers and S-inhibition heads. Metric: logit(IO) − logit(S).

- Read the lesson: [Mechanistic Interpretability: Superposition, Sparse Autoencoders and Circuits](https://dmxsf.com/en/wiki/frontier/interpretability/)
- See also: [Circuit](https://dmxsf.com/en/glossary/#circuit), [Activation patching](https://dmxsf.com/en/glossary/#activation-patching)

### Indirect prompt injection

The attacker plants instructions in external content the model will read, such as web pages, emails, documents or tool outputs, instead of speaking to the model directly; the model treats data as instructions and the user does not know. Greshake et al. (2023) named and studied it systematically for applications that integrate retrieval and tools.

- Read the lesson: [Prompt Injection and Jailbreaks: The Security Boundaries of LLM Applications](https://dmxsf.com/en/wiki/safety/prompt-injection-and-jailbreaks/)
- See also: [Prompt injection](https://dmxsf.com/en/glossary/#prompt-injection), [Lethal trifecta](https://dmxsf.com/en/glossary/#lethal-trifecta), [Agent](https://dmxsf.com/en/glossary/#agent), [Model Context Protocol](https://dmxsf.com/en/glossary/#mcp)

### Induction head

An attention circuit in Transformers: after [A][B] appeared earlier, a later [A] makes the model attend to the token that followed the previous [A] and copy it as the prediction. Olsson et al. (2022) tie induction heads to the emergence of in-context learning. The Mamba paper tests a synthetic version (trained at length 256, tested up to 1,048,576), and Mamba is perfect at every length.

- Read the lesson: [State Space Models and Hybrids: Trading the KV Cache for a Fixed-Size State](https://dmxsf.com/en/wiki/architecture/state-space-and-hybrid/)
- Paper notes: [Mamba: linear-time sequence modeling with selective state spaces](https://dmxsf.com/en/blog/mamba-linear-time-sequence-modeling-with-selective-state-spaces/)
- See also: [In-context learning](https://dmxsf.com/en/glossary/#in-context-learning), [Selective Copying](https://dmxsf.com/en/glossary/#selective-copying), [Mamba](https://dmxsf.com/en/glossary/#mamba)

### Inference budget

The compute and memory cost a deployment can afford when serving requests. Each generated token costs about 2N floating-point operations, where N is the parameter count. The LLaMA paper points out that choosing a model only by training compute ignores this term: for a target quality, prefer the model that is cheapest at inference, which is a smaller model trained for longer.

- Read the lesson: [Scaling Laws: How to Split Compute Between Parameters and Data](https://dmxsf.com/en/wiki/pretraining/scaling-laws/)
- Paper notes: [LLaMA: Train Smaller Models for Longer, on Public Data Only](https://dmxsf.com/en/blog/llama-open-and-efficient-foundation-language-models/)
- See also: [Chinchilla-optimal training](https://dmxsf.com/en/glossary/#chinchilla), [Overtraining](https://dmxsf.com/en/glossary/#overtraining)

### Inference runtime

Software that loads model configuration and weights, allocates memory, executes inference operations, and emits tokens according to decoding rules. A surrounding service handles requests and responses.

- Read the lesson: [Your first inference service: put a model function behind HTTP](https://dmxsf.com/en/wiki/inference/first-inference-service/)
- See also: [Device memory](https://dmxsf.com/en/glossary/#device-memory), [KV cache](https://dmxsf.com/en/glossary/#kv-cache)

### InfoNCE loss

A loss widely used in contrastive learning: the pairwise similarities of the N matched pairs in a batch form an N×N matrix whose diagonal holds the positives and everything else the negatives, and a softmax cross-entropy is taken over every row (and column). CLIP uses its symmetric form, with the similarities divided by a temperature.

- Read the lesson: [Multimodal LLMs: How an Image Becomes Tokens](https://dmxsf.com/en/wiki/multimodal/multimodal-llms/)
- See also: [Contrastive learning](https://dmxsf.com/en/glossary/#contrastive-learning), [Cross-entropy](https://dmxsf.com/en/glossary/#cross-entropy), [Temperature](https://dmxsf.com/en/glossary/#temperature)

### Information integration

One of the four RAG abilities: answering complex questions that need several documents, for example when two facts sit in two documents and both must be found and merged. RGB builds questions that can only be answered from multiple documents, and finds models do clearly worse on them than on single-document questions.

- Read the lesson: [RAG in Practice: Chunking, Hybrid Retrieval, Reranking and Evaluation](https://dmxsf.com/en/wiki/applications/rag/)
- Paper notes: [RAG survey: three paradigms, four abilities, and a recount of the paper's tables](https://dmxsf.com/en/blog/rag-survey/)
- See also: [Noise robustness](https://dmxsf.com/en/glossary/#noise-robustness), [Counterfactual robustness](https://dmxsf.com/en/glossary/#counterfactual-robustness), [Retrieval-augmented generation](https://dmxsf.com/en/glossary/#rag)

### Instruction hierarchy

Training a model to rank instructions by source: the system prompt over the user message, the user message over third-party content such as tool outputs and web pages; when they conflict it obeys the higher level and ignores privileged-looking instructions at a lower one. Introduced by OpenAI in 2024; it improves robustness but remains a probabilistic defense.

- Read the lesson: [Prompt Injection and Jailbreaks: The Security Boundaries of LLM Applications](https://dmxsf.com/en/wiki/safety/prompt-injection-and-jailbreaks/)
- See also: [Prompt injection](https://dmxsf.com/en/glossary/#prompt-injection), [Jailbreak](https://dmxsf.com/en/glossary/#jailbreak), [Reinforcement learning from human feedback](https://dmxsf.com/en/glossary/#rlhf)

### Instruction tuning

Supervised fine-tuning on instruction data covering many tasks, so the model can follow unseen instructions zero-shot. FLAN and InstructGPT are representative.

- Read the lesson: [SFT Data: Construction and Quality Control](https://dmxsf.com/en/wiki/post-training/sft-data/)
- See also: [Supervised fine-tuning](https://dmxsf.com/en/glossary/#sft), [In-context learning](https://dmxsf.com/en/glossary/#in-context-learning)

### Inter-annotator agreement

How often several annotators give the same label to the same items, a measure of label quality. Common measures are raw agreement p_o and Cohen's kappa, but class imbalance inflates raw agreement and deflates kappa: two annotators who each err 5% of the time score kappa 0.811 with balanced classes and 0.144 with 99% positives. Report agreement, class balance and per-class agreement together.

- Read the lesson: [Building Evaluation Sets: Question Sources, Label Quality and Item Information](https://dmxsf.com/en/wiki/evaluation/building-eval-sets/)
- See also: [Cohen's kappa](https://dmxsf.com/en/glossary/#cohens-kappa), [Label noise](https://dmxsf.com/en/glossary/#label-noise)

### Inverse dynamics model (IDM)

A model that infers which action was taken between two observations, such as the current and a future frame, the reverse of a forward model that predicts the next state. It can label videos without actions: the GR00T N1 IDM outputs the action chunk between two frames, using the System 1 DiT with SigLIP-2 embeddings, trained 30K or 60K steps per embodiment to label neural trajectories.

- Paper notes: [GR00T N1: A Data Pyramid and a Dual-System Model for Generalist Humanoid Robots](https://dmxsf.com/en/blog/gr00t-n1-an-open-foundation-model-for-generalist-humanoid-robots/)
- See also: [Latent action](https://dmxsf.com/en/glossary/#latent-action), [Neural trajectory](https://dmxsf.com/en/glossary/#neural-trajectory)

### IsoFLOPs curve

Fix the training compute C, vary the parameter count (tokens follow as C / 6N) and plot the final loss; the curve's minimum is the compute-optimal model for that budget. Fit a parabola per budget, then a power law of optimal size against compute: Chinchilla's second approach, also used by Llama 3, which notes that the curves flatten near the optimum as compute grows.

- Read the lesson: [Scaling Laws: How to Split Compute Between Parameters and Data](https://dmxsf.com/en/wiki/pretraining/scaling-laws/)
- Paper notes: [The Llama 3 Herd of Models: data, scale and the engineering recipe of a 405B dense model](https://dmxsf.com/en/blog/the-llama-3-herd-of-models/)
- See also: [Scaling law](https://dmxsf.com/en/glossary/#scaling-law), [Chinchilla-optimal training](https://dmxsf.com/en/glossary/#chinchilla), [FLOPs](https://dmxsf.com/en/glossary/#flops)

### Item discrimination

How well one item separates strong models from weak ones. In IRT it is the steepness a of the success-probability curve; an item's information is a²P(1−P), peaking at a²/4, so doubling a quadruples it. It is often estimated by the item–rest correlation, the item's correlation with the total on the other items: near 0 adds nothing to the ranking, negative usually means a wrong reference answer.

- Read the lesson: [Building Evaluation Sets: Question Sources, Label Quality and Item Information](https://dmxsf.com/en/wiki/evaluation/building-eval-sets/)
- See also: [Item response theory](https://dmxsf.com/en/glossary/#item-response-theory), [Benchmark](https://dmxsf.com/en/glossary/#benchmark)

### Item response theory (IRT)

A psychometric model of items and test-takers: each test-taker (here a model) has an ability θ, each item a difficulty b and a discrimination a, and the two-parameter model gives the chance of a correct answer as σ(a(θ−b)). On evaluation sets it finds informative items and items with negative discrimination, usually mislabeled; tinyBenchmarks uses it to shrink each benchmark to 100 items.

- Read the lesson: [Building Evaluation Sets: Question Sources, Label Quality and Item Information](https://dmxsf.com/en/wiki/evaluation/building-eval-sets/)
- See also: [Item discrimination](https://dmxsf.com/en/glossary/#item-discrimination), [Benchmark](https://dmxsf.com/en/glossary/#benchmark)

### Iterative retrieval

Alternating retrieval and generation: the knowledge base is searched repeatedly using the initial query and the text generated so far, giving the model richer, more targeted context each round. The survey notes it can suffer from semantic discontinuity and accumulating irrelevant information. Example: ITER-RETGEN. Recursive retrieval refines the query or splits it into sub-questions (IRCoT).

- Also called: Recursive retrieval
- Read the lesson: [RAG in Practice: Chunking, Hybrid Retrieval, Reranking and Evaluation](https://dmxsf.com/en/wiki/applications/rag/)
- Paper notes: [RAG survey: three paradigms, four abilities, and a recount of the paper's tables](https://dmxsf.com/en/blog/rag-survey/)
- See also: [Adaptive retrieval](https://dmxsf.com/en/glossary/#adaptive-retrieval), [Modular RAG](https://dmxsf.com/en/glossary/#modular-rag), [ReAct](https://dmxsf.com/en/glossary/#react)

## J

### Jaccard similarity

The size of the intersection of two sets divided by the size of their union, between 0 and 1. For documents it is computed on word n-gram sets, and the chance that a MinHash signature agrees at one position equals it exactly. It is sensitive to size: a short text pasted into a long document scores low, so catching that needs containment (intersection over the smaller set) or substring matching.

- Also called: Jaccard index
- Read the lesson: [Pretraining Data Engineering: Filtering, Deduplication and Mixing](https://dmxsf.com/en/wiki/pretraining/data-engineering/)
- See also: [MinHash](https://dmxsf.com/en/glossary/#minhash), [Locality-sensitive hashing](https://dmxsf.com/en/glossary/#locality-sensitive-hashing), [Deduplication](https://dmxsf.com/en/glossary/#deduplication)

### Jailbreak

An input crafted by the user to make a safety-trained model violate its own policy and produce content it should refuse. The adversary is the user; in prompt injection the instructions hide in third-party data the model reads and the victim is another user or the system, so the defenses differ.

- Read the lesson: [Prompt Injection and Jailbreaks: The Security Boundaries of LLM Applications](https://dmxsf.com/en/wiki/safety/prompt-injection-and-jailbreaks/)
- See also: [Prompt injection](https://dmxsf.com/en/glossary/#prompt-injection), [Red teaming](https://dmxsf.com/en/glossary/#red-teaming), [Many-shot jailbreaking](https://dmxsf.com/en/glossary/#many-shot-jailbreaking), [Reinforcement learning from human feedback](https://dmxsf.com/en/glossary/#rlhf)

### JSON mode

An API switch that guarantees the model's output is valid JSON, but not that it matches your schema. OpenAI's documentation recommends Structured Outputs over it whenever possible.

- Read the lesson: [Structured Outputs and Function Calling: From JSON Mode to Constrained Decoding](https://dmxsf.com/en/wiki/applications/structured-output-and-function-calling/)
- See also: [Structured output](https://dmxsf.com/en/glossary/#structured-output), [JSON Schema](https://dmxsf.com/en/glossary/#json-schema)

### JSON Schema

A standard format for describing the structure of JSON data: fields, types, enums and required keys. Structured outputs and function calling use it to constrain model output, and each provider supports only a subset of it.

- Read the lesson: [Structured Outputs and Function Calling: From JSON Mode to Constrained Decoding](https://dmxsf.com/en/wiki/applications/structured-output-and-function-calling/)
- See also: [Structured output](https://dmxsf.com/en/glossary/#structured-output), [Function calling](https://dmxsf.com/en/glossary/#function-calling), [Constrained decoding](https://dmxsf.com/en/glossary/#constrained-decoding)

### JSON-RPC

A lightweight remote-call protocol encoded in JSON: a request carries method, params and id, a response carries result or error, and a message without an id is a notification that needs no reply. Errors use integer codes, for example -32602 for invalid params. MCP and the Language Server Protocol (LSP) are both built on it.

- Also called: JSON-RPC 2.0
- Read the lesson: [MCP and the Tool Ecosystem: How It Works and What to Do When Tools Pile Up](https://dmxsf.com/en/wiki/applications/mcp-and-tool-ecosystem/)
- See also: [Model Context Protocol](https://dmxsf.com/en/glossary/#mcp), [Streamable HTTP](https://dmxsf.com/en/glossary/#streamable-http)

## K

### K3 estimator

A single-sample KL estimate: with r = π_ref/π_θ it is r − 1 − log r, non-negative and low-variance; GRPO uses it as the KL penalty. It is biased for samples from an old policy, so DeepSeek-V3.2 multiplies it by the importance ratio π_θ/π_old. Exact enumeration in the V3.2 post: the corrected gradient equals that of KL(π_θ‖π_ref), the uncorrected K3 gradient that of the reverse KL.

- Read the lesson: [Reinforcement Learning for Reasoning: RLVR and GRPO](https://dmxsf.com/en/wiki/post-training/reasoning-rl/)
- Paper notes: [DeepSeek-V3.2: Sparse Attention, Scaled-Up Reinforcement Learning and Synthetic Agent Tasks](https://dmxsf.com/en/blog/deepseek-v32-pushing-the-frontier-of-open-large-language-models/)
- See also: [KL divergence](https://dmxsf.com/en/glossary/#kl-divergence), [Group relative policy optimization](https://dmxsf.com/en/glossary/#grpo), [Importance sampling](https://dmxsf.com/en/glossary/#importance-sampling)

### Kernel fusion

Merging several adjacent GPU operations into one kernel so intermediate results stay in on-chip registers and shared memory instead of being written to memory and read back. For bandwidth-bound elementwise operations the saving is memory traffic, and time falls with it. FlashAttention fuses attention into a single kernel.

- Also called: Operator fusion
- Read the lesson: [GPU kernels: from tiled matrix multiplication to fusion](https://dmxsf.com/en/wiki/systems/gpu-kernels/)
- See also: [Memory-bound](https://dmxsf.com/en/glossary/#memory-bound), [FlashAttention](https://dmxsf.com/en/glossary/#flashattention), [Arithmetic intensity](https://dmxsf.com/en/glossary/#arithmetic-intensity)

### KL divergence

An asymmetric measure of how two probability distributions differ: KL(p ‖ q) = Σ p log(p / q). RLHF and DPO use it to keep the new model from drifting too far from the reference model.

- Read the lesson: [Information Theory Refresher: Entropy, Cross-Entropy and KL Divergence](https://dmxsf.com/en/wiki/foundations/information-theory/)
- See also: [Cross-entropy](https://dmxsf.com/en/glossary/#cross-entropy), [Reinforcement learning from human feedback](https://dmxsf.com/en/glossary/#rlhf), [Direct preference optimization](https://dmxsf.com/en/glossary/#dpo)

### KL estimators k1, k2, k3

Three per-token estimators of KL(π_θ‖π_ref) from tokens sampled under π_θ (Schulman, 2020). With r = π_ref/π_θ: k1 = −log r is unbiased but noisy, k2 = ½(log r)² is slightly biased and low-variance, k3 = r − 1 − log r is unbiased and non-negative. GRPO adds k3 to the loss; differentiating an estimator used as a loss need not give the gradient of the sequence-level KL.

- Read the lesson: [Reinforcement Learning Basics: Policy Gradients, Advantages and PPO](https://dmxsf.com/en/wiki/post-training/rl-fundamentals/)
- Paper notes: [DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning](https://dmxsf.com/en/blog/deepseek-r1-reasoning-via-reinforcement-learning/)
- See also: [KL divergence](https://dmxsf.com/en/glossary/#kl-divergence), [Proximal policy optimization](https://dmxsf.com/en/glossary/#ppo), [Group relative policy optimization](https://dmxsf.com/en/glossary/#grpo)

### KV cache

Storing the keys and values of every processed token in every layer during autoregressive generation, so later steps compute attention only for the new token. The price is memory that grows linearly with sequence length and concurrency.

- Read the lesson: [KV Cache and Inference Performance](https://dmxsf.com/en/wiki/inference/kv-cache/)
- See also: [Prefill and decode](https://dmxsf.com/en/glossary/#prefill-decode), [Grouped-query attention](https://dmxsf.com/en/glossary/#gqa), [PagedAttention](https://dmxsf.com/en/glossary/#pagedattention), [Context window](https://dmxsf.com/en/glossary/#context-window)

### KV cache fragmentation

The three kinds of waste when contiguous memory is reserved for each request at its maximum length: slots held in advance for tokens not yet generated, internal fragmentation (the real length is shorter than the reservation) and external fragmentation left by the allocator. The vLLM paper measured only 20.4%-38.2% of the KV cache in existing systems holding actual token states.

- Also called: Reservation, internal and external fragmentation
- Paper notes: [vLLM and PagedAttention: Managing the KV Cache Like Paged Memory](https://dmxsf.com/en/blog/vllm-pagedattention/)
- See also: [KV cache](https://dmxsf.com/en/glossary/#kv-cache), [PagedAttention](https://dmxsf.com/en/glossary/#pagedattention), [Block table](https://dmxsf.com/en/glossary/#block-table)

## L

### Label noise

Wrong labels in the training data, or the overall share of them. Uniform noise replaces labels with a random other class; real annotation errors usually concentrate between neighboring classes. Neural networks can memorize wrong labels (Zhang et al., 2017), so noise is not averaged away on its own; it is found by spot checks or by flagging examples where a model disagrees with the label.

- Read the lesson: [SFT Data: Construction and Quality Control](https://dmxsf.com/en/wiki/post-training/sft-data/)
- See also: [Supervised fine-tuning](https://dmxsf.com/en/glossary/#sft), [Loss masking](https://dmxsf.com/en/glossary/#loss-masking)

### Label smoothing

Replacing the one-hot training target with a mixture: (1−ε) times the one-hot label plus ε times a uniform distribution, so the model is not pushed to put all probability on one class. The Transformer paper used ε=0.1 and notes that it hurts perplexity but improves accuracy and BLEU.

- Paper notes: [Attention Is All You Need: the Transformer, with self-attention instead of recurrence and convolution](https://dmxsf.com/en/blog/attention-is-all-you-need/)
- See also: [Cross-entropy](https://dmxsf.com/en/glossary/#cross-entropy), [Perplexity](https://dmxsf.com/en/glossary/#perplexity), [Softmax](https://dmxsf.com/en/glossary/#softmax)

### Language model

A model that estimates the probability of a piece of text. Modern LLMs use the chain rule to split the joint probability into per-token conditional probabilities P(x_t | x_<t).

- Read the lesson: [From Language Modeling to Next-Token Prediction](https://dmxsf.com/en/wiki/foundations/next-token-prediction/)
- See also: [Next-token prediction](https://dmxsf.com/en/glossary/#next-token-prediction), [Perplexity](https://dmxsf.com/en/glossary/#perplexity)

### Language-consistency reward

A reward term DeepSeek-R1 adds in its first RL stage: the share of target-language words in the chain of thought, which discourages mixing Chinese and English. The paper's own ablation shows it lowers performance slightly in exchange for output that reads better and matches human preference; it is applied to both reasoning and non-reasoning data.

- Read the lesson: [Reinforcement Learning for Reasoning: RLVR and GRPO](https://dmxsf.com/en/wiki/post-training/reasoning-rl/)
- Paper notes: [DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning](https://dmxsf.com/en/blog/deepseek-r1-reasoning-via-reinforcement-learning/)
- See also: [R1-Zero](https://dmxsf.com/en/glossary/#r1-zero), [Reinforcement learning with verifiable rewards](https://dmxsf.com/en/glossary/#rlvr), [Reward hacking](https://dmxsf.com/en/glossary/#reward-hacking)

### Latent action

An action representation learned from video when no action labels exist. GR00T N1 trains a VQ-VAE whose encoder reads the current and a future frame and outputs a latent action; the decoder rebuilds the future frame from it. The encoder then acts as an inverse dynamics model, and its continuous embedding before quantization is the pretraining action label, for a virtual embodiment called LAPA.

- Paper notes: [GR00T N1: A Data Pyramid and a Dual-System Model for Generalist Humanoid Robots](https://dmxsf.com/en/blog/gr00t-n1-an-open-foundation-model-for-generalist-humanoid-robots/)
- See also: [Inverse dynamics model](https://dmxsf.com/en/glossary/#inverse-dynamics-model), [Vision-language-action model](https://dmxsf.com/en/glossary/#vla)

### Latent diffusion model (LDM)

Rombach et al. (2021): a pretrained autoencoder compresses images into low-dimensional latents, the diffusion model is trained only in that latent space, and a decoder maps the result back to pixels. The latent grid is smaller (a 256×256×3 image becomes 32×32×4), so each denoising step is far cheaper; Stable Diffusion works this way. Image quality is capped by the autoencoder's reconstruction.

- Read the lesson: [Diffusion Models and Flow Matching: Generating Images, Actions and Text from Noise](https://dmxsf.com/en/wiki/multimodal/diffusion-and-flow-matching/)
- See also: [Diffusion model](https://dmxsf.com/en/glossary/#diffusion-model), [Variational autoencoder](https://dmxsf.com/en/glossary/#vae)

### Layer normalization

Normalizing each token's feature vector to zero mean and unit variance, then applying a learned scale and shift, to stabilize training. Modern LLMs usually apply it before each sublayer (Pre-LN).

- Also called: LayerNorm
- Read the lesson: [Transformer Block Explained: Attention, FFN, Residuals and LayerNorm](https://dmxsf.com/en/wiki/architecture/transformer-block/)
- See also: [RMSNorm](https://dmxsf.com/en/glossary/#rmsnorm), [Residual connection](https://dmxsf.com/en/glossary/#residual-connection)

### Learning-rate schedule

How the learning rate changes over training steps. LLMs commonly use linear warmup followed by cosine decay: a rise to the peak over a few hundred to a few thousand steps, then a slow decline to about 10% of the peak.

- Read the lesson: [Optimizers and Training Stability: AdamW, Warmup, Mixed Precision, Loss Spikes](https://dmxsf.com/en/wiki/foundations/optimizers-and-training-stability/)
- See also: [AdamW](https://dmxsf.com/en/glossary/#adamw), [Gradient clipping](https://dmxsf.com/en/glossary/#gradient-clipping)

### Learning-rate warmup

Starting training with a very small learning rate that rises to a peak before the decay schedule begins. A common explanation is that Adam's early second-moment estimates are unreliable, so large steps can diverge; deep post-norm models depend on it most. The Transformer paper's schedule is d_model^-0.5 · min(step^-0.5, step · warmup^-1.5), with 4000 warmup steps.

- Also called: Warmup
- Read the lesson: [Optimizers and Training Stability: AdamW, Warmup, Mixed Precision, Loss Spikes](https://dmxsf.com/en/wiki/foundations/optimizers-and-training-stability/)
- Paper notes: [Attention Is All You Need: the Transformer, with self-attention instead of recurrence and convolution](https://dmxsf.com/en/blog/attention-is-all-you-need/)
- See also: [Learning-rate schedule](https://dmxsf.com/en/glossary/#lr-schedule), [AdamW](https://dmxsf.com/en/glossary/#adamw), [Post-norm](https://dmxsf.com/en/glossary/#post-norm)

### Length extrapolation

The ability of a model to keep working on sequences longer than any seen in training. Learned absolute position embeddings have no trained vector for unseen positions and simply fail; sinusoidal encodings and RoPE can compute any position, but being computable is not the same as being usable, and position interpolation, YaRN or further training are usually needed.

- Read the lesson: [Long Context: Position Extrapolation, Training Recipes and Cost](https://dmxsf.com/en/wiki/architecture/long-context/)
- Paper notes: [Attention Is All You Need: the Transformer, with self-attention instead of recurrence and convolution](https://dmxsf.com/en/blog/attention-is-all-you-need/)
- See also: [Positional encoding](https://dmxsf.com/en/glossary/#positional-encoding), [Rotary position embedding](https://dmxsf.com/en/glossary/#rope), [Position interpolation](https://dmxsf.com/en/glossary/#position-interpolation), [YaRN](https://dmxsf.com/en/glossary/#yarn), [Context window](https://dmxsf.com/en/glossary/#context-window)

### Lethal trifecta

A summary due to Simon Willison (2025): an agent that can read private data, is exposed to untrusted content and can communicate externally can be steered by indirect prompt injection into sending the private data out. Remove any one of the three and the theft chain breaks.

- Read the lesson: [Prompt Injection and Jailbreaks: The Security Boundaries of LLM Applications](https://dmxsf.com/en/wiki/safety/prompt-injection-and-jailbreaks/)
- See also: [Indirect prompt injection](https://dmxsf.com/en/glossary/#indirect-prompt-injection), [Prompt injection](https://dmxsf.com/en/glossary/#prompt-injection), [Agent](https://dmxsf.com/en/glossary/#agent)

### Lightning indexer

The scoring module inside DSA: for a query token t and an earlier token s, I(t,s) = Σ_j w(t,j)·ReLU(q(t,j)·k(s)). In V3.2 it has 64 heads of 128 dimensions and can run in FP8. It uses ReLU and per-head weights instead of a softmax, which makes it fast; it is trained with a KL divergence to match the dense attention distribution, and at inference the top-k tokens are kept.

- Read the lesson: [Efficient Attention: MQA, GQA, MLA and FlashAttention](https://dmxsf.com/en/wiki/architecture/efficient-attention/)
- Paper notes: [DeepSeek-V3.2: Sparse Attention, Scaled-Up Reinforcement Learning and Synthetic Agent Tasks](https://dmxsf.com/en/blog/deepseek-v32-pushing-the-frontier-of-open-large-language-models/)
- See also: [DeepSeek Sparse Attention](https://dmxsf.com/en/glossary/#dsa), [Top-k sampling](https://dmxsf.com/en/glossary/#top-k), [KL divergence](https://dmxsf.com/en/glossary/#kl-divergence)

### Likelihood displacement

In DPO training the probability of the chosen answer often falls too, because the loss drops whenever the gap between chosen and rejected probabilities widens. Mass can move to other answers, even ones of opposite meaning (Razin et al., 2024), most easily when a pair has a small edit distance (Pal et al., 2024). Remedies: an NLL term on the chosen answer (Llama 3 uses 0.2) or DPO-Positive.

- Read the lesson: [Preference Optimization: From RLHF to DPO](https://dmxsf.com/en/wiki/post-training/preference-optimization/)
- Paper notes: [Direct Preference Optimization: Your Language Model is Secretly a Reward Model](https://dmxsf.com/en/blog/dpo-direct-preference-optimization/)
- See also: [Direct preference optimization](https://dmxsf.com/en/glossary/#dpo), [Implicit reward](https://dmxsf.com/en/glossary/#implicit-reward), [Reward overoptimization](https://dmxsf.com/en/glossary/#reward-overoptimization)

### Linear attention

Attention without the softmax. The history accumulates into a fixed-size state matrix, S_t = S_{t−1} + k_t v_tᵀ, and the output is o_t = S_tᵀ q_t, so the cost per step at inference does not depend on how much has been read, and training can use parallel or chunkwise matrix operations. The price is limited capacity, about the key dimension: items beyond it interfere with each other.

- Read the lesson: [State Space Models and Hybrids: Trading the KV Cache for a Fixed-Size State](https://dmxsf.com/en/wiki/architecture/state-space-and-hybrid/)
- See also: [State space model](https://dmxsf.com/en/glossary/#ssm), [Delta rule](https://dmxsf.com/en/glossary/#delta-rule), [KV cache](https://dmxsf.com/en/glossary/#kv-cache)

### Linear probe

The standard way to evaluate a pre-trained representation: freeze the model, train only a linear classifier (often L2-regularized logistic regression) on the features it outputs, and read the test accuracy as a measure of the features themselves, so fine-tuning cannot paper over weak features. The CLIP paper uses it to compare 66 models on 27 datasets.

- Read the lesson: [Multimodal LLMs: How an Image Becomes Tokens](https://dmxsf.com/en/wiki/multimodal/multimodal-llms/)
- Paper notes: [CLIP: Contrastive Learning on 400 Million Image-Text Pairs, and a Classifier You Define in One Sentence](https://dmxsf.com/en/blog/clip-learning-transferable-visual-models/)
- See also: [CLIP](https://dmxsf.com/en/glossary/#clip), [Zero-shot](https://dmxsf.com/en/glossary/#zero-shot), [Few-shot prompting](https://dmxsf.com/en/glossary/#few-shot)

### LLaVA-Bench

The multimodal chat benchmark from the LLaVA paper: a COCO subset (30 images, 90 questions) and an In-the-Wild subset (24 images, 60 questions). A text-only GPT-4 judge, given ground-truth descriptions, scores a candidate and a reference answer from 1 to 10; the benchmark reports the relative score, not accuracy. It is small: one model's overall score varies by 2.0 points (std) over three runs.

- Paper notes: [LLaVA: Text-Only GPT-4 Writes 158K Visual Instructions and a Language Model Learns to See](https://dmxsf.com/en/blog/llava-visual-instruction-tuning/)
- See also: [Benchmark](https://dmxsf.com/en/glossary/#benchmark), [LLM-as-a-judge](https://dmxsf.com/en/glossary/#llm-as-a-judge), [MT-Bench](https://dmxsf.com/en/glossary/#mt-bench)

### LLM workflow

An LLM application whose step order is fixed in code, with the model handling only some of the steps, such as “retrieve, then answer”. The counterpart of an agent, which decides its own next step in a loop; easier to predict, debug and evaluate.

- Read the lesson: [Agents and Tool Calling in Practice: From Function Calling to ReAct Workflows](https://dmxsf.com/en/wiki/applications/agents-and-tool-calling/)
- See also: [Agent](https://dmxsf.com/en/glossary/#agent), [Function calling](https://dmxsf.com/en/glossary/#function-calling), [Retrieval-augmented generation](https://dmxsf.com/en/glossary/#rag)

### LLM-as-a-judge

Using a strong model to score or compare another model's answers. It is far cheaper than human evaluation but suffers from position bias, length preference and self-preference; Zheng et al. analyzed these biases systematically in 2023.

- Read the lesson: [LLM-as-a-Judge: Using a Model as the Grader, Its Biases and Calibration](https://dmxsf.com/en/wiki/evaluation/llm-as-judge/)
- See also: [Benchmark](https://dmxsf.com/en/glossary/#benchmark), [Position bias](https://dmxsf.com/en/glossary/#position-bias), [Chatbot Arena](https://dmxsf.com/en/glossary/#chatbot-arena), [Cohen's kappa](https://dmxsf.com/en/glossary/#cohens-kappa), [Reward model](https://dmxsf.com/en/glossary/#reward-model)

### Locality-sensitive hashing

A family of hashes that put similar objects in the same bucket with high probability, avoiding all-pairs comparison. In the banding scheme for MinHash, k values form b bands of r values and a pair is flagged when any band matches in full: probability 1−(1−s^r)^b at Jaccard similarity s, an S-curve steepest near (1/b)^(1/r). FineWeb's 14 bands of 8 rows flag pairs at 0.75 about 77% of the time.

- Also called: LSH
- Read the lesson: [Pretraining Data Engineering: Filtering, Deduplication and Mixing](https://dmxsf.com/en/wiki/pretraining/data-engineering/)
- Paper notes: [FineWeb: Extracting, Deduplicating and Filtering a 15T-Token Open Web Corpus, One Ablation at a Time](https://dmxsf.com/en/blog/the-fineweb-datasets-decanting-the-web-for-the-finest-text-data-at-scale/)
- See also: [MinHash](https://dmxsf.com/en/glossary/#minhash), [Jaccard similarity](https://dmxsf.com/en/glossary/#jaccard-similarity), [Deduplication](https://dmxsf.com/en/glossary/#deduplication)

### Logit lens

A read-only method (nostalgebraist, 2020): decode an intermediate residual stream with the final norm and the unembedding matrix to see which token the model currently favours. On GPT-2 it approaches the final prediction roughly monotonically, but early layers read out badly; the tuned lens (Belrose et al., 2023) trains an affine map per layer. It only reads, so it cannot prove causation.

- Read the lesson: [Mechanistic Interpretability: Superposition, Sparse Autoencoders and Circuits](https://dmxsf.com/en/wiki/frontier/interpretability/)
- See also: [Residual stream](https://dmxsf.com/en/glossary/#residual-stream), [Logits](https://dmxsf.com/en/glossary/#logits), [KL divergence](https://dmxsf.com/en/glossary/#kl-divergence)

### Logits

The unnormalized scores produced by the final layer, one per vocabulary entry. They become probabilities only after a softmax.

- See also: [Softmax](https://dmxsf.com/en/glossary/#softmax), [Temperature](https://dmxsf.com/en/glossary/#temperature)

### Long short-term memory (LSTM)

A gated recurrent network (Hochreiter and Schmidhuber, 1997): besides the hidden state it has a cell state, with gates (the common version has input, forget and output gates) controlling writing, keeping and reading, so gradients can flow through many steps along the cell state and long dependencies are handled better than in a plain RNN.

- Read the lesson: [From RNNs to Attention: Why the Transformer Appeared](https://dmxsf.com/en/wiki/architecture/from-rnn-to-attention/)
- See also: [Recurrent neural network](https://dmxsf.com/en/glossary/#rnn), [Vanishing gradient](https://dmxsf.com/en/glossary/#vanishing-gradient)

### Lookahead search

A variant of beam search that scores a candidate step by rolling forward k more steps and taking the process reward model's score at the end of the rollout; k=0 is plain beam search. It is Monte Carlo tree search without random exploration and costs about N×(k+1) generations. Snell et al. (2024) find it usually does worse than beam search at equal budget and blame the extra rollout compute.

- Paper notes: [Scaling LLM Test-Time Compute Optimally: Spending Inference Compute by Difficulty Can Beat a Bigger Model](https://dmxsf.com/en/blog/scaling-llm-test-time-compute-optimally-can-be-more-effective-than-scaling-model-parameters/)
- See also: [Beam search](https://dmxsf.com/en/glossary/#beam-search), [Process reward model](https://dmxsf.com/en/glossary/#prm), [Monte Carlo tree search](https://dmxsf.com/en/glossary/#mcts)

### LoRA

Freezes the original weights W and trains only two low-rank matrices A and B, representing the update as ΔW = BA with rank r far smaller than the dimension. The trainable parameters are a tiny fraction of the model, and BA can be merged back into W at inference. Proposed by Hu et al. in 2021.

- Read the lesson: [LoRA Fine-Tuning in Practice](https://dmxsf.com/en/wiki/post-training/lora-finetuning/)
- Paper notes: [LoRA: Freeze the Pretrained Weights, Train Only a Low-Rank Update](https://dmxsf.com/en/blog/lora-low-rank-adaptation/)
- See also: [QLoRA](https://dmxsf.com/en/glossary/#qlora), [Parameter-efficient fine-tuning](https://dmxsf.com/en/glossary/#peft), [Fine-tuning](https://dmxsf.com/en/glossary/#fine-tuning)

### Loss masking

Computing the supervised fine-tuning loss only on the response tokens: the labels of the prompt are set to -100 (PyTorch's cross-entropy skips that value), so the gradient comes only from what the model has to learn to write. The end-of-sequence token after the response normally counts in the loss, because it is how the model learns where to stop.

- Also called: Response-only loss
- Read the lesson: [SFT Data: Construction and Quality Control](https://dmxsf.com/en/wiki/post-training/sft-data/)
- See also: [Supervised fine-tuning](https://dmxsf.com/en/glossary/#sft), [Instruction tuning](https://dmxsf.com/en/glossary/#instruction-tuning)

### Loss scaling

A fix for FP16 training: multiply the loss by a large factor before backpropagation so tiny gradients land inside the FP16 range instead of underflowing to zero, then divide the gradients back before the update. Dynamic loss scaling skips the step and lowers the factor on an inf or NaN, and raises it after a run of normal steps. BF16 has FP32's exponent range and usually does not need it.

- Read the lesson: [Numerical Precision: Three Ways FP16, BF16 and FP8 Training Goes Wrong](https://dmxsf.com/en/wiki/systems/numerical-precision/)
- See also: [Mixed-precision training](https://dmxsf.com/en/glossary/#mixed-precision), [BF16](https://dmxsf.com/en/glossary/#bf16), [Master weights](https://dmxsf.com/en/glossary/#master-weights)

### Loss spike

A sudden jump in training loss that may recover or may diverge. Typical triggers are a learning rate that is too high, a bad batch of data and numerical overflow in low precision; common mitigations are gradient clipping, learning-rate warmup, and skipping the bad batch or rolling back to an earlier checkpoint.

- Read the lesson: [Optimizers and Training Stability: AdamW, Warmup, Mixed Precision, Loss Spikes](https://dmxsf.com/en/wiki/foundations/optimizers-and-training-stability/)
- See also: [Gradient clipping](https://dmxsf.com/en/glossary/#gradient-clipping), [Learning-rate schedule](https://dmxsf.com/en/glossary/#lr-schedule), [AdamW](https://dmxsf.com/en/glossary/#adamw), [Checkpoint](https://dmxsf.com/en/glossary/#checkpoint)

### Lost in the middle

A positional bias in how language models use a long context: information at the beginning or end is used best and information in the middle worst, so accuracy plotted against position forms a U. Liu et al. (2023) measured a 22.0-point gap between the best and worst position for GPT-3.5-Turbo in multi-document QA with 20 documents.

- Also called: U-shaped position effect
- Read the lesson: [Long Context: Position Extrapolation, Training Recipes and Cost](https://dmxsf.com/en/wiki/architecture/long-context/)
- Paper notes: [Lost in the Middle: Models Use the Start and End of a Long Context Best](https://dmxsf.com/en/blog/lost-in-the-middle/)
- See also: [Context window](https://dmxsf.com/en/glossary/#context-window), [Needle in a haystack](https://dmxsf.com/en/glossary/#needle-in-a-haystack), [Closed-book](https://dmxsf.com/en/glossary/#closed-book), [Reranking](https://dmxsf.com/en/glossary/#reranking)

### LTI SSM

A state space model whose parameters (Δ, A, B, C) are the same at every time step. Its output is the input convolved with one fixed kernel, so training can use convolution and inference a recurrence over a fixed-size state; S4, H3 and Hyena are of this kind. It treats inputs by position, not by content: one kernel acts everywhere, so it cannot choose what to remember or forget.

- Also called: Linear time-invariant SSM
- Read the lesson: [State Space Models and Hybrids: Trading the KV Cache for a Fixed-Size State](https://dmxsf.com/en/wiki/architecture/state-space-and-hybrid/)
- Paper notes: [Mamba: linear-time sequence modeling with selective state spaces](https://dmxsf.com/en/blog/mamba-linear-time-sequence-modeling-with-selective-state-spaces/)
- See also: [State space model](https://dmxsf.com/en/glossary/#ssm), [Selection mechanism](https://dmxsf.com/en/glossary/#selection-mechanism), [Selective Copying](https://dmxsf.com/en/glossary/#selective-copying)

## M

### Majority voting

Sample k answers to the same question, take the most frequent final answer as the answer to that question, and report the accuracy; often written maj@k. Unlike pass@k (a question counts as solved if any one of k samples is right), it measures how stable the model's answers are. GSM8K and MATH scores often use majority voting and cannot be compared directly with single-sample scores.

- Also called: maj@k, Maj@K
- Paper notes: [DeepSeekMath: Math Corpus, GRPO and a Unified View of Reinforcement Learning](https://dmxsf.com/en/blog/deepseekmath-pushing-the-limits-of-mathematical-reasoning/)
- See also: [pass@k](https://dmxsf.com/en/glossary/#pass-at-k), [GSM8K](https://dmxsf.com/en/glossary/#gsm8k), [Group relative policy optimization](https://dmxsf.com/en/glossary/#grpo)

### Mamba

A selective state space model proposed by Gu and Dao in 2023: its parameters depend on the input, and sequence modeling cost grows linearly with length.

- Read the lesson: [State Space Models and Hybrids: Trading the KV Cache for a Fixed-Size State](https://dmxsf.com/en/wiki/architecture/state-space-and-hybrid/)
- Paper notes: [Mamba: linear-time sequence modeling with selective state spaces](https://dmxsf.com/en/blog/mamba-linear-time-sequence-modeling-with-selective-state-spaces/)
- See also: [State space model](https://dmxsf.com/en/glossary/#ssm), [Parallel scan](https://dmxsf.com/en/glossary/#parallel-scan), [Hybrid architecture](https://dmxsf.com/en/glossary/#hybrid-architecture)

### Manifold-constrained hyper-connections (mHC)

DeepSeek's late-2025 refinement of hyper-connections: it constrains the matrix that mixes the n residual streams to be doubly stochastic, using a Sinkhorn-Knopp projection, so the gain of composed layers stays bounded and the identity property returns. Kernel fusion, recomputation and communication overlap hold the extra training time to 6.7% at n=4 (as reported).

- Paper notes: [mHC: Keeping a Wider Residual Stream Stable With Doubly Stochastic Mixing](https://dmxsf.com/en/blog/mhc-manifold-constrained-hyper-connections/)
- See also: [Hyper-connections](https://dmxsf.com/en/glossary/#hyper-connections), [Doubly stochastic matrix](https://dmxsf.com/en/glossary/#doubly-stochastic-matrix), [Sinkhorn-Knopp algorithm](https://dmxsf.com/en/glossary/#sinkhorn-knopp), [Residual connection](https://dmxsf.com/en/glossary/#residual-connection)

### Many-shot jailbreaking

A jailbreak that exploits long context: stuffing the prompt with dozens to hundreds of fabricated dialogues in which an assistant complies with harmful requests, then asking the real one. Anthropic reported in 2024 that the success rate rises with the number of examples following a power law.

- Read the lesson: [Prompt Injection and Jailbreaks: The Security Boundaries of LLM Applications](https://dmxsf.com/en/wiki/safety/prompt-injection-and-jailbreaks/)
- See also: [Jailbreak](https://dmxsf.com/en/glossary/#jailbreak), [In-context learning](https://dmxsf.com/en/glossary/#in-context-learning), [Context window](https://dmxsf.com/en/glossary/#context-window)

### Masked language modeling (MLM)

BERT's pre-training objective: pick 15% of the tokens, replace 80% of them with [MASK], 10% with a random token and keep 10% unchanged, then recover the originals from both sides of the context, with the loss only at the chosen positions. It sees both directions, but only about 15% of positions give a training signal, and [MASK] never appears in fine-tuning.

- Read the lesson: [From Language Modeling to Next-Token Prediction](https://dmxsf.com/en/wiki/foundations/next-token-prediction/)
- Paper notes: [BERT: pre-training a bidirectional Transformer by filling in masked words, then one thin output layer per task](https://dmxsf.com/en/blog/bert-pre-training-of-deep-bidirectional-transformers/)
- See also: [BERT](https://dmxsf.com/en/glossary/#bert), [Next-token prediction](https://dmxsf.com/en/glossary/#next-token-prediction), [Encoder-only model](https://dmxsf.com/en/glossary/#encoder-only)

### Master weights

The FP32 copy of the weights that the optimizer keeps in mixed-precision training. Forward and backward passes use a low-precision (FP16 or BF16) copy, while updates accumulate in the FP32 master weights and are cast back down, so the small update of each step is not swallowed by low-precision rounding.

- Read the lesson: [Numerical Precision: Three Ways FP16, BF16 and FP8 Training Goes Wrong](https://dmxsf.com/en/wiki/systems/numerical-precision/)
- See also: [Mixed-precision training](https://dmxsf.com/en/glossary/#mixed-precision), [AdamW](https://dmxsf.com/en/glossary/#adamw), [Loss scaling](https://dmxsf.com/en/glossary/#loss-scaling)

### Mechanistic interpretability

The research program of reverse-engineering a trained neural network into an algorithm people can read: find the features it represents and the circuits of components that read and write them, then test that account with interventions such as patching and ablation. Wang et al. (2022) found a 26-head circuit for indirect object identification in GPT-2 small.

- Read the lesson: [Mechanistic Interpretability: Superposition, Sparse Autoencoders and Circuits](https://dmxsf.com/en/wiki/frontier/interpretability/)
- See also: [Circuit](https://dmxsf.com/en/glossary/#circuit), [Superposition](https://dmxsf.com/en/glossary/#superposition), [Activation patching](https://dmxsf.com/en/glossary/#activation-patching)

### Membership inference

Deciding whether a specific example was in a model's training set, usually by comparing the model's loss or per-token probabilities on it with a reference: trained-on text tends to get a lower loss. Used to audit privacy and to detect benchmark contamination. Duan et al. (2024) found that in large-scale pre-training settings many methods beat guessing only slightly.

- Read the lesson: [Benchmark Contamination: How It Happens, How to Detect It, How to Avoid It](https://dmxsf.com/en/wiki/evaluation/benchmark-contamination/)
- See also: [Min-K% Prob](https://dmxsf.com/en/glossary/#min-k-prob), [Benchmark contamination](https://dmxsf.com/en/glossary/#contamination), [Perplexity](https://dmxsf.com/en/glossary/#perplexity), [Memorization](https://dmxsf.com/en/glossary/#memorization), [Attribute inference](https://dmxsf.com/en/glossary/#attribute-inference)

### Memorization

A model storing specific pieces of its training data in its weights so that a suitable prompt makes it write them out verbatim. Some is harmless (facts, boilerplate), some a privacy or copyright risk (phone numbers, keys, copyrighted text). More copies, larger models, longer prompt context and stronger training make it more visible; an unchanged validation loss does not rule it out.

- Also called: Unintended memorization
- Read the lesson: [Memorization and Privacy: What Models Remember, How to Measure and Reduce It](https://dmxsf.com/en/wiki/safety/memorization-and-privacy/)
- See also: [Training data extraction](https://dmxsf.com/en/glossary/#training-data-extraction), [Exposure](https://dmxsf.com/en/glossary/#canary-exposure), [Membership inference](https://dmxsf.com/en/glossary/#membership-inference), [Deduplication](https://dmxsf.com/en/glossary/#deduplication)

### Memory-bound

Speed that is limited by how fast data (such as weights and the KV cache) can be read, rather than by arithmetic throughput. Small-batch decoding is the classic example.

- Read the lesson: [GPUs and the Roofline Model: Why Big Models Are Bound by Memory Bandwidth](https://dmxsf.com/en/wiki/systems/gpu-and-roofline/)
- See also: [Prefill and decode](https://dmxsf.com/en/glossary/#prefill-decode), [FlashAttention](https://dmxsf.com/en/glossary/#flashattention)

### Min-K% Prob

A membership-inference score that needs no reference model: take the K% lowest per-token log-probabilities of a text (for example the lowest 20%) and average them. Text seen in training rarely contains very unlikely tokens, so its average is higher. Shi et al. (2023) report a 7.4% improvement over earlier methods on their WikiMIA benchmark.

- Read the lesson: [Benchmark Contamination: How It Happens, How to Detect It, How to Avoid It](https://dmxsf.com/en/wiki/evaluation/benchmark-contamination/)
- See also: [Membership inference](https://dmxsf.com/en/glossary/#membership-inference), [Benchmark contamination](https://dmxsf.com/en/glossary/#contamination), [Perplexity](https://dmxsf.com/en/glossary/#perplexity)

### MinHash

A signature method for estimating the Jaccard similarity of two sets: apply several hash functions and keep, for each set, the minimum hash value under each function. The probability that two sets agree at one position of the signature equals their Jaccard similarity exactly. Combined with locality-sensitive hashing (LSH) buckets, it finds near-duplicate texts without comparing every pair.

- Read the lesson: [Pretraining Data Engineering: Filtering, Deduplication and Mixing](https://dmxsf.com/en/wiki/pretraining/data-engineering/)
- Paper notes: [FineWeb: Extracting, Deduplicating and Filtering a 15T-Token Open Web Corpus, One Ablation at a Time](https://dmxsf.com/en/blog/the-fineweb-datasets-decanting-the-web-for-the-finest-text-data-at-scale/)
- See also: [Deduplication](https://dmxsf.com/en/glossary/#deduplication), [Jaccard similarity](https://dmxsf.com/en/glossary/#jaccard-similarity), [Locality-sensitive hashing](https://dmxsf.com/en/glossary/#locality-sensitive-hashing), [Benchmark contamination](https://dmxsf.com/en/glossary/#contamination)

### Mixed-precision training

Running the forward and backward passes in BF16 or FP16 for speed and memory, while keeping FP32 master weights and optimizer states for numerical stability.

- Read the lesson: [Numerical Precision: Three Ways FP16, BF16 and FP8 Training Goes Wrong](https://dmxsf.com/en/wiki/systems/numerical-precision/)
- See also: [BF16](https://dmxsf.com/en/glossary/#bf16), [AdamW](https://dmxsf.com/en/glossary/#adamw)

### Mixture of Experts (MoE)

Replacing the FFN with several expert networks and a router, so each token activates only a few of them. The total parameter count is large while the compute per token stays small. Used by Mixtral, DeepSeek-V3 and others.

- Read the lesson: [Mixture of Experts (MoE): Routing, Load Balancing and Sparse Activation](https://dmxsf.com/en/wiki/architecture/mixture-of-experts/)
- Paper notes: [Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity](https://dmxsf.com/en/blog/switch-transformers-scaling-to-trillion-parameter-models/)
- See also: [Router](https://dmxsf.com/en/glossary/#router), [Active parameters](https://dmxsf.com/en/glossary/#active-parameters), [Expert load balancing](https://dmxsf.com/en/glossary/#load-balancing), [Feed-forward network](https://dmxsf.com/en/glossary/#ffn)

### MMLU

A multitask multiple-choice benchmark by Hendrycks et al. covering 57 subjects, used to measure broad knowledge and problem solving.

- Read the lesson: [LLM Evaluation Methodology: Benchmarks, Contamination and a Workflow](https://dmxsf.com/en/wiki/evaluation/llm-evaluation/)
- See also: [Benchmark](https://dmxsf.com/en/glossary/#benchmark), [Benchmark contamination](https://dmxsf.com/en/glossary/#contamination)

### Model averaging

Average the parameters of several checkpoints or runs to get the final model, which usually improves robustness at no inference cost; the models generally need to start from the same checkpoint. Llama 3 averages checkpoints in pre-training annealing and, at each post-training stage (reward model, SFT, DPO), models trained with different data versions or hyperparameters.

- Paper notes: [The Llama 3 Herd of Models: data, scale and the engineering recipe of a 405B dense model](https://dmxsf.com/en/blog/the-llama-3-herd-of-models/)
- See also: [Annealing](https://dmxsf.com/en/glossary/#annealing), [Checkpoint](https://dmxsf.com/en/glossary/#checkpoint), [Supervised fine-tuning](https://dmxsf.com/en/glossary/#sft)

### Model collapse

What happens when each generation of a model is trained on the previous generation's output: the tail of the distribution vanishes and the output grows uniform. The cause is finite-sample resampling: a symbol of probability p is missing from n samples with probability (1-p)^n, and once gone it stays gone. Accumulating real data, or mixing in fresh real data each generation, prevents it.

- Read the lesson: [Synthetic Data and Self-Improvement: When Models Make Data, and When It Collapses](https://dmxsf.com/en/wiki/frontier/synthetic-data-and-self-improvement/)
- See also: [Synthetic data](https://dmxsf.com/en/glossary/#synthetic-data), [Self-training](https://dmxsf.com/en/glossary/#self-training), [Deduplication](https://dmxsf.com/en/glossary/#deduplication)

### Model Context Protocol (MCP)

An open protocol released by Anthropic in November 2024 (donated in December 2025 to the Linux Foundation's Agentic AI Foundation) that standardizes how AI applications discover and call tools, read resources and use prompt templates from external systems, so a server works with any client. Built on JSON-RPC 2.0, it covers only context exchange; the 2026-07-28 revision made connections stateless.

- Read the lesson: [MCP and the Tool Ecosystem: How It Works and What to Do When Tools Pile Up](https://dmxsf.com/en/wiki/applications/mcp-and-tool-ecosystem/)
- See also: [Function calling](https://dmxsf.com/en/glossary/#function-calling), [Agent](https://dmxsf.com/en/glossary/#agent), [Prompt injection](https://dmxsf.com/en/glossary/#prompt-injection), [JSON-RPC](https://dmxsf.com/en/glossary/#json-rpc), [Streamable HTTP](https://dmxsf.com/en/glossary/#streamable-http), [Progressive tool discovery](https://dmxsf.com/en/glossary/#progressive-tool-discovery)

### Model FLOPs utilization (MFU)

The useful FLOPs implied by the measured training throughput divided by the hardware's theoretical peak. The numerator counts only the operations the model needs for forward and backward, not recomputation. Reported values for large runs are mostly 30% to 50%: 46.2% for PaLM 540B, 38% to 43% for Llama 3 405B.

- Read the lesson: [The Compute and Memory Ledger of Training: FLOPs, MFU and Memory Budgets](https://dmxsf.com/en/wiki/pretraining/compute-and-memory/)
- See also: [FLOPs](https://dmxsf.com/en/glossary/#flops), [Hardware FLOPs utilization](https://dmxsf.com/en/glossary/#hfu), [Data parallelism](https://dmxsf.com/en/glossary/#data-parallelism)

### Model-based filtering

Scoring documents with a model and keeping those above a threshold. A common recipe has a strong LLM label a sample, trains a cheap classifier on the labels (say, a frozen embedding model plus a linear head), then scores everything. FineWeb-Edu had Llama-3-70B-Instruct rate 460,000 pages for educational value (0 to 5); threshold 3 kept 1.3T tokens. The labeler's tastes reshape the topic mix.

- Also called: Quality classifier
- Read the lesson: [Pretraining Data Engineering: Filtering, Deduplication and Mixing](https://dmxsf.com/en/wiki/pretraining/data-engineering/)
- Paper notes: [FineWeb: Extracting, Deduplicating and Filtering a 15T-Token Open Web Corpus, One Ablation at a Time](https://dmxsf.com/en/blog/the-fineweb-datasets-decanting-the-web-for-the-finest-text-data-at-scale/)
- See also: [FineWeb](https://dmxsf.com/en/glossary/#fineweb), [Heuristic filtering](https://dmxsf.com/en/glossary/#heuristic-filter), [DCLM](https://dmxsf.com/en/glossary/#dclm), [Data mixture](https://dmxsf.com/en/glossary/#data-mixture)

### Modular RAG

The third RAG paradigm in Gao et al.'s survey: RAG split into replaceable, re-orderable modules instead of a fixed retrieve-then-read chain. New modules include search, memory, routing, predict and task adapter (plus RAG-Fusion), and flows may loop iteratively, recursively or adaptively. It builds on the first two paradigms and combines more easily with fine-tuning and reinforcement learning.

- Read the lesson: [RAG in Practice: Chunking, Hybrid Retrieval, Reranking and Evaluation](https://dmxsf.com/en/wiki/applications/rag/)
- Paper notes: [RAG survey: three paradigms, four abilities, and a recount of the paper's tables](https://dmxsf.com/en/blog/rag-survey/)
- See also: [Naive RAG](https://dmxsf.com/en/glossary/#naive-rag), [Advanced RAG](https://dmxsf.com/en/glossary/#advanced-rag), [Iterative retrieval](https://dmxsf.com/en/glossary/#iterative-retrieval), [Adaptive retrieval](https://dmxsf.com/en/glossary/#adaptive-retrieval), [Retrieval-augmented generation](https://dmxsf.com/en/glossary/#rag)

### Monte Carlo tree search (MCTS)

A family of decision-search algorithms built on repeated simulation. Each simulation starts at the root, follows a selection rule down to a leaf, evaluates the leaf and backs the result up the path, and the visit counts of the branches finally guide the decision. AlphaZero's selection rule favors moves with a high prior, a high value and few visits, and a neural network evaluates the leaves.

- Read the lesson: [Reinforcement Learning for Reasoning: RLVR and GRPO](https://dmxsf.com/en/wiki/post-training/reasoning-rl/)
- Paper notes: [AlphaZero: Only the Rules, Self-Play from Scratch, Mastering Chess, Shogi and Go](https://dmxsf.com/en/blog/alphazero-mastering-chess-and-shogi-by-self-play/)
- See also: [AlphaZero](https://dmxsf.com/en/glossary/#alphazero)

### MT-Bench

A multi-turn conversation benchmark by Zheng et al.: 80 questions, 10 in each of 8 categories (writing, roleplay, extraction, reasoning, math, coding, STEM knowledge and humanities knowledge), two turns each, scored or compared by a judge model.

- Read the lesson: [LLM Evaluation Methodology: Benchmarks, Contamination and a Workflow](https://dmxsf.com/en/wiki/evaluation/llm-evaluation/)
- See also: [LLM-as-a-judge](https://dmxsf.com/en/glossary/#llm-as-a-judge), [Chatbot Arena](https://dmxsf.com/en/glossary/#chatbot-arena), [Benchmark](https://dmxsf.com/en/glossary/#benchmark)

### Multi-head attention (MHA)

Running attention in several subspaces in parallel, then concatenating the results and applying a linear projection. Different heads can attend to different kinds of relations.

- Read the lesson: [Attention Basics: How a Transformer Reads Context](https://dmxsf.com/en/wiki/architecture/attention-basics/)
- See also: [Multi-query attention](https://dmxsf.com/en/glossary/#mqa), [Grouped-query attention](https://dmxsf.com/en/glossary/#gqa), [Self-attention](https://dmxsf.com/en/glossary/#self-attention)

### Multi-head latent attention (MLA)

An attention variant introduced in DeepSeek-V2 that compresses keys and values into a low-dimensional latent vector before caching them, shrinking the KV cache substantially.

- Read the lesson: [Modern LLM Architecture: From GPT-2 to Llama, Qwen and DeepSeek](https://dmxsf.com/en/wiki/architecture/modern-llm-architecture/)
- Paper notes: [DeepSeek-V3 Technical Report: MoE, MLA, FP8 and Low-Cost Training](https://dmxsf.com/en/blog/deepseek-v3-technical-report/)
- See also: [Grouped-query attention](https://dmxsf.com/en/glossary/#gqa), [KV cache](https://dmxsf.com/en/glossary/#kv-cache)

### Multi-query attention (MQA)

All query heads share a single key/value head, which shrinks the KV cache to 1/h of multi-head attention at a small cost in quality. Proposed by Shazeer in 2019.

- Read the lesson: [Modern LLM Architecture: From GPT-2 to Llama, Qwen and DeepSeek](https://dmxsf.com/en/wiki/architecture/modern-llm-architecture/)
- See also: [Grouped-query attention](https://dmxsf.com/en/glossary/#gqa), [Multi-head attention](https://dmxsf.com/en/glossary/#multi-head-attention), [KV cache](https://dmxsf.com/en/glossary/#kv-cache)

### Multi-token prediction (MTP)

A training objective that predicts not only the next token but also the 2nd, 3rd, ... token after each position. DeepSeek-V3 implements it with sequential MTP modules that keep the full causal chain and uses one extra depth; at inference the modules can be dropped or reused as the draft of speculative decoding.

- Paper notes: [DeepSeek-V3 Technical Report: MoE, MLA, FP8 and Low-Cost Training](https://dmxsf.com/en/blog/deepseek-v3-technical-report/)
- See also: [Next-token prediction](https://dmxsf.com/en/glossary/#next-token-prediction), [Speculative decoding](https://dmxsf.com/en/glossary/#speculative-decoding)

### Multilayer perceptron (MLP)

A network of linear layers alternating with elementwise nonlinear activations. Without the nonlinearity, several linear layers collapse into one; the feed-forward network (FFN) in each Transformer block is a two-layer MLP.

- Read the lesson: [Neural Network Basics: From Linear Layers to Backpropagation](https://dmxsf.com/en/wiki/foundations/neural-network-basics/)
- See also: [Backpropagation](https://dmxsf.com/en/glossary/#backpropagation), [Feed-forward network](https://dmxsf.com/en/glossary/#ffn), [SwiGLU](https://dmxsf.com/en/glossary/#swiglu)

### Multimodal RoPE (M-RoPE)

The position encoding introduced with Qwen2-VL: the RoPE position is split into time, height and width components. A text token has identical components, which makes it equivalent to ordinary RoPE; an image token's height and width components follow its row and column, and video also varies the time component.

- Read the lesson: [Multimodal LLMs: How an Image Becomes Tokens](https://dmxsf.com/en/wiki/multimodal/multimodal-llms/)
- See also: [Rotary position embedding](https://dmxsf.com/en/glossary/#rope), [Dynamic resolution](https://dmxsf.com/en/glossary/#dynamic-resolution), [Positional encoding](https://dmxsf.com/en/glossary/#positional-encoding)

### Muon

An optimizer for 2-D weight matrices (Jordan et al., 2024): average the gradient with momentum, approximately orthogonalize the momentum matrix with a few Newton-Schulz iterations, and use the result as the update. Other parameters, such as norm weights, usually stay on AdamW. Rescaling each update to a fixed RMS (0.18 in DeepSeek-V4.1-Flash) lets it reuse AdamW's learning rate.

- Paper notes: [DeepSeek-V4.1-Flash: Getting the Global KV Cache Down to 890 Bytes per Token](https://dmxsf.com/en/blog/deepseek-v41-flash-pushing-the-limits-of-kv-cache-compression/)
- See also: [AdamW](https://dmxsf.com/en/glossary/#adamw), [Sinkhorn-balanced update](https://dmxsf.com/en/glossary/#sinkhorn-balanced-update)

### MuZero

A reinforcement-learning system that learns planning-relevant latent dynamics, reward, value and policy without known environment rules, then plans with MCTS.

- Paper notes: [MuZero: Planning with a learned model without knowing the rules](https://dmxsf.com/en/blog/muzero-mastering-atari-go-chess-and-shogi-without-rules/)
- See also: [World model](https://dmxsf.com/en/glossary/#world-model), [Monte Carlo tree search](https://dmxsf.com/en/glossary/#mcts)

## N

### N-gram overlap

Flagging an evaluation item as contaminated when any run of N consecutive words (or characters) in it also appears in the training data. A small N flags nearly every item because templates share short spans; a large N misses leaks that were lightly rewritten. The GPT-3 paper chose N per benchmark as the 5th percentile of item length in words, clamped to the range 8 to 13.

- Read the lesson: [Benchmark Contamination: How It Happens, How to Detect It, How to Avoid It](https://dmxsf.com/en/wiki/evaluation/benchmark-contamination/)
- See also: [Decontamination](https://dmxsf.com/en/glossary/#decontamination), [Benchmark contamination](https://dmxsf.com/en/glossary/#contamination), [MinHash](https://dmxsf.com/en/glossary/#minhash)

### Naive RAG

The first RAG paradigm in Gao et al.'s survey: documents are chunked, embedded and stored in a vector database (indexing); the query is embedded and the top-k most similar chunks are fetched (retrieval); query and chunks go into one prompt for the model (generation), in a single pass. Weaknesses: limited retrieval precision and recall, unsupported statements, redundant or disjointed assembly.

- Also called: Retrieve-Read
- Read the lesson: [RAG in Practice: Chunking, Hybrid Retrieval, Reranking and Evaluation](https://dmxsf.com/en/wiki/applications/rag/)
- Paper notes: [RAG survey: three paradigms, four abilities, and a recount of the paper's tables](https://dmxsf.com/en/blog/rag-survey/)
- See also: [Advanced RAG](https://dmxsf.com/en/glossary/#advanced-rag), [Modular RAG](https://dmxsf.com/en/glossary/#modular-rag), [Retrieval-augmented generation](https://dmxsf.com/en/glossary/#rag), [Chunking](https://dmxsf.com/en/glossary/#chunking), [Vector database](https://dmxsf.com/en/glossary/#vector-database)

### Native sparse attention

Attention whose sparse pattern participates in training. NSA combines global compression, selected blocks and a local window with hardware-aligned execution.

- Paper notes: [Native Sparse Attention: Trainable compression, selection and sliding windows](https://dmxsf.com/en/blog/native-sparse-attention/)
- See also: [Transformer](https://dmxsf.com/en/glossary/#transformer)

### Needle in a haystack (NIAH)

A long-context test that hides a trivial fact (the needle) at some depth in a long stretch of distractor text (the haystack) and asks the model to retrieve it. It is cheap and intuitive, but it only tests retrieval and most models score near full marks inside their window, so it is usually paired with multi-task benchmarks such as RULER.

- Read the lesson: [Long Context: Position Extrapolation, Training Recipes and Cost](https://dmxsf.com/en/wiki/architecture/long-context/)
- See also: [Context window](https://dmxsf.com/en/glossary/#context-window), [Benchmark](https://dmxsf.com/en/glossary/#benchmark)

### Negative rejection

One of the four RAG abilities: when the retrieved documents lack the knowledge needed, the model should decline instead of inventing an answer. RGB's test set contains only noise documents, and an instruction asks for a fixed rejection sentence; producing it counts as a rejection, and the share of successes is the rejection rate. Real search often fails to return a document with the answer.

- Read the lesson: [RAG in Practice: Chunking, Hybrid Retrieval, Reranking and Evaluation](https://dmxsf.com/en/wiki/applications/rag/)
- Paper notes: [RAG survey: three paradigms, four abilities, and a recount of the paper's tables](https://dmxsf.com/en/blog/rag-survey/)
- See also: [Noise robustness](https://dmxsf.com/en/glossary/#noise-robustness), [Abstention](https://dmxsf.com/en/glossary/#abstention), [Hallucination](https://dmxsf.com/en/glossary/#hallucination)

### Neural trajectory

A robot trajectory video synthesized by a video generation model: an image-to-video model is fine-tuned on real teleoperation data, prompted with new initial frames and instructions, and the filtered videos get latent-action or IDM labels. GR00T N1 stretches 88 hours of real data into 827 hours (about 300k clips); the paper ablates it only in post-training, adding 4.2 to 8.8 points on RoboCasa.

- Paper notes: [GR00T N1: A Data Pyramid and a Dual-System Model for Generalist Humanoid Robots](https://dmxsf.com/en/blog/gr00t-n1-an-open-foundation-model-for-generalist-humanoid-robots/)
- See also: [World model](https://dmxsf.com/en/glossary/#world-model), [Inverse dynamics model](https://dmxsf.com/en/glossary/#inverse-dynamics-model), [Data pyramid](https://dmxsf.com/en/glossary/#data-pyramid)

### Next-sentence prediction (NSP)

BERT's second pre-training task: given spans A and B, half the time B truly follows A (IsNext) and half the time it is a random span (NotNext); the output at [CLS] makes a binary decision. RoBERTa and others found that dropping it does not hurt: a random span usually has another topic, so the task can be solved by matching topics, without learning sentence order.

- Read the lesson: [From Language Modeling to Next-Token Prediction](https://dmxsf.com/en/wiki/foundations/next-token-prediction/)
- Paper notes: [BERT: pre-training a bidirectional Transformer by filling in masked words, then one thin output layer per task](https://dmxsf.com/en/blog/bert-pre-training-of-deep-bidirectional-transformers/)
- See also: [BERT](https://dmxsf.com/en/glossary/#bert), [Masked language modeling](https://dmxsf.com/en/glossary/#masked-language-modeling)

### Next-token prediction

Predicting the probability distribution of the next token given the preceding text. It is the core task of pretraining, and generating text means repeating this step until the end.

- Read the lesson: [From Language Modeling to Next-Token Prediction](https://dmxsf.com/en/wiki/foundations/next-token-prediction/)
- See also: [Language model](https://dmxsf.com/en/glossary/#language-model), [Autoregressive generation](https://dmxsf.com/en/glossary/#autoregressive), [Cross-entropy](https://dmxsf.com/en/glossary/#cross-entropy)

### Noise robustness

One of four RAG abilities defined by the RGB benchmark: answering correctly when retrieved documents include noise, meaning documents related to the question but without the answer. RGB gives each question 5 documents and raises the noise ratio from 0 to 0.8; models confuse similar information, for example misled by reports on the 2021 Nobel Prize in Literature when asked about 2022.

- Read the lesson: [RAG in Practice: Chunking, Hybrid Retrieval, Reranking and Evaluation](https://dmxsf.com/en/wiki/applications/rag/)
- Paper notes: [RAG survey: three paradigms, four abilities, and a recount of the paper's tables](https://dmxsf.com/en/blog/rag-survey/)
- See also: [Negative rejection](https://dmxsf.com/en/glossary/#negative-rejection), [Information integration](https://dmxsf.com/en/glossary/#information-integration), [Counterfactual robustness](https://dmxsf.com/en/glossary/#counterfactual-robustness), [Lost in the middle](https://dmxsf.com/en/glossary/#lost-in-the-middle)

### Noise schedule

The sequence that sets how much noise each diffusion step adds, written as per-step variances β_t or the cumulative signal fraction ᾱ_t. DDPM uses T=1000 steps with β rising linearly from 1e-4 to 0.02, leaving ᾱ_T near 4e-5, so the data ends up almost pure noise. Improved DDPM noted that the tail of this linear schedule is nearly pure noise already and proposed a gentler cosine schedule.

- Read the lesson: [Diffusion Models and Flow Matching: Generating Images, Actions and Text from Noise](https://dmxsf.com/en/wiki/multimodal/diffusion-and-flow-matching/)
- See also: [Denoising diffusion probabilistic model](https://dmxsf.com/en/glossary/#ddpm), [Signal-to-noise ratio](https://dmxsf.com/en/glossary/#signal-to-noise-ratio)

### Normalized latency

The end-to-end latency of a request divided by its number of output tokens, averaged over all requests. Serving papers plot it against the request rate: once the rate exceeds what the system can handle the queue grows without bound and the curve explodes, so the system that holds out to a higher rate has the higher throughput.

- Paper notes: [vLLM and PagedAttention: Managing the KV Cache Like Paged Memory](https://dmxsf.com/en/blog/vllm-pagedattention/)
- See also: [Throughput](https://dmxsf.com/en/glossary/#throughput), [Time to first token](https://dmxsf.com/en/glossary/#ttft)

## O

### Offline RL

Reinforcement learning from a fixed trajectory dataset, without interacting with the environment. The core difficulty is distribution shift: once the policy takes actions absent from the data, value estimates have nothing to stand on. Remedies include value learning with conservatism (CQL), behavior cloning, and return-conditioned supervised learning as in Decision Transformer.

- Paper notes: [Decision Transformer: Reinforcement Learning as Conditional Sequence Modeling](https://dmxsf.com/en/blog/decision-transformer-reinforcement-learning-via-sequence-modeling/)
- See also: [Behavior cloning](https://dmxsf.com/en/glossary/#behavior-cloning), [Decision Transformer](https://dmxsf.com/en/glossary/#decision-transformer), [Credit assignment](https://dmxsf.com/en/glossary/#credit-assignment)

### On-policy distillation (OPD)

A scheme where the student samples its own sequences, teachers score every position, and the student learns to match them (often with a reverse-KL-type divergence). Because samples come from the student's own distribution, it avoids the mismatch of offline distillation. DeepSeek-V4.1-Flash ends post-training with full-vocabulary OPD from over 40 teachers; the paper does not spell out the loss.

- Paper notes: [DeepSeek-V4.1-Flash: Getting the Global KV Cache Down to 890 Bytes per Token](https://dmxsf.com/en/blog/deepseek-v41-flash-pushing-the-limits-of-kv-cache-compression/)
- See also: [Distillation](https://dmxsf.com/en/glossary/#distillation), [Strong-to-weak distillation](https://dmxsf.com/en/glossary/#strong-to-weak-distillation), [Supervised fine-tuning](https://dmxsf.com/en/glossary/#sft)

### One-shot prompting

Giving exactly one input-output example in the prompt before the new input. The GPT-3 paper separates three settings: zero-shot gives only an instruction in natural language, one-shot adds one demonstration, few-shot adds as many as fit in the context window (typically 10 to 100). None of them updates the weights.

- Read the lesson: [Prompt Engineering: A Systematic Guide to Specs, Layers, Examples and Evaluation](https://dmxsf.com/en/wiki/applications/prompt-engineering/)
- Paper notes: [GPT-1, GPT-2, GPT-3: From Fine-Tuning to In-Context Learning, Recomputed from the Papers](https://dmxsf.com/en/blog/gpt-series-evolution/)
- See also: [Few-shot prompting](https://dmxsf.com/en/glossary/#few-shot), [Zero-shot](https://dmxsf.com/en/glossary/#zero-shot), [In-context learning](https://dmxsf.com/en/glossary/#in-context-learning)

### Open X-Embodiment (OpenX)

A community-built collection that pools several dozen robot datasets from many institutions into one format; the OpenVLA paper says it now holds more than 70 datasets and over 2M robot trajectories across many embodiments, tasks and scenes. OpenVLA keeps only single-arm, end-effector-controlled data with a third-person camera, mixes it with Octo's weights and trains on 970k trajectories.

- Paper notes: [OpenVLA: An Open-Source Vision-Language-Action Model on Llama 2 7B and Two Vision Encoders](https://dmxsf.com/en/blog/openvla-an-open-source-vision-language-action-model/)
- See also: [Vision-language-action model](https://dmxsf.com/en/glossary/#vla), [Behavior cloning](https://dmxsf.com/en/glossary/#behavior-cloning)

### Outcome reward model (ORM)

A reward model trained only on the final outcome of a whole solution, such as whether the answer is right. Labels are cheap and can be obtained automatically, but the signal is sparse for multi-step reasoning because the model has to work out which step went wrong. The counterpart of the process reward model (PRM), which is trained on step-level labels.

- Paper notes: [Let's Verify Step by Step: Scoring Every Reasoning Step Beats Checking Only the Final Answer](https://dmxsf.com/en/blog/lets-verify-step-by-step/)
- See also: [Process reward model](https://dmxsf.com/en/glossary/#prm), [Reward model](https://dmxsf.com/en/glossary/#reward-model), [Best-of-N sampling](https://dmxsf.com/en/glossary/#best-of-n)

### Overtraining

Training a smaller model on far more data than the Chinchilla ratio (about 20 tokens per parameter) to trade extra training compute for cheaper inference. LLaMA-7B saw about 148 tokens per parameter, roughly 7 times that ratio.

- Read the lesson: [Scaling Laws: How to Split Compute Between Parameters and Data](https://dmxsf.com/en/wiki/pretraining/scaling-laws/)
- Paper notes: [LLaMA: Train Smaller Models for Longer, on Public Data Only](https://dmxsf.com/en/blog/llama-open-and-efficient-foundation-language-models/)
- See also: [Chinchilla-optimal training](https://dmxsf.com/en/glossary/#chinchilla), [Inference budget](https://dmxsf.com/en/glossary/#inference-budget)

## P

### Paged optimizer

Allocates optimizer states in pageable memory using NVIDIA unified memory: when the GPU runs out of memory the states are evicted to CPU RAM automatically and paged back for the parameter update. QLoRA uses it to survive the memory spikes that long sequences cause during gradient checkpointing.

- Read the lesson: [LoRA Fine-Tuning in Practice](https://dmxsf.com/en/wiki/post-training/lora-finetuning/)
- Paper notes: [QLoRA: Fine-Tuning a 65B Model on One 48 GB GPU by Quantizing the Base to 4 Bits](https://dmxsf.com/en/blog/qlora-efficient-finetuning-of-quantized-llms/)
- See also: [QLoRA](https://dmxsf.com/en/glossary/#qlora), [AdamW](https://dmxsf.com/en/glossary/#adamw), [Activation checkpointing](https://dmxsf.com/en/glossary/#activation-checkpointing)

### PagedAttention

vLLM's KV cache manager: the cache is cut into fixed-size blocks allocated on demand, like operating-system paging, which nearly eliminates fragmentation and allows prefix sharing.

- Read the lesson: [Continuous Batching and PagedAttention: How a Server Handles Many Requests at Once](https://dmxsf.com/en/wiki/inference/continuous-batching/)
- Paper notes: [vLLM and PagedAttention: Managing the KV Cache Like Paged Memory](https://dmxsf.com/en/blog/vllm-pagedattention/)
- See also: [KV cache](https://dmxsf.com/en/glossary/#kv-cache), [Continuous batching](https://dmxsf.com/en/glossary/#continuous-batching), [Block table](https://dmxsf.com/en/glossary/#block-table), [Copy-on-write](https://dmxsf.com/en/glossary/#copy-on-write), [KV cache fragmentation](https://dmxsf.com/en/glossary/#kv-fragmentation)

### Parallel sampling

Generating several random samples for one prompt so that the user can pick one. The samples share the KV cache of the prompt but not of what each of them generates; the block sharing of vLLM keeps a single copy of the prompt's cache.

- Paper notes: [vLLM and PagedAttention: Managing the KV Cache Like Paged Memory](https://dmxsf.com/en/blog/vllm-pagedattention/)
- See also: [Beam search](https://dmxsf.com/en/glossary/#beam-search), [Copy-on-write](https://dmxsf.com/en/glossary/#copy-on-write), [KV cache](https://dmxsf.com/en/glossary/#kv-cache)

### Parallel scan

A way to evaluate a linear recurrence h_t = a_t h_{t−1} + b_t in parallel. Two consecutive steps merge into one step of the same kind, (a₂, b₂) ∘ (a₁, b₁) = (a₁a₂, a₂b₁ + b₂); the operation is associative, so T steps need about log₂T rounds of pairwise merging. Mamba uses it to train in parallel when its parameters depend on the input and a convolution is not possible.

- Also called: Prefix scan
- Read the lesson: [State Space Models and Hybrids: Trading the KV Cache for a Fixed-Size State](https://dmxsf.com/en/wiki/architecture/state-space-and-hybrid/)
- See also: [State space model](https://dmxsf.com/en/glossary/#ssm), [Mamba](https://dmxsf.com/en/glossary/#mamba)

### Parameter-efficient fine-tuning (PEFT)

A family of fine-tuning methods that train only a small number of added or selected parameters and freeze the rest, including LoRA, adapters and prefix tuning.

- Read the lesson: [LoRA Fine-Tuning in Practice](https://dmxsf.com/en/wiki/post-training/lora-finetuning/)
- See also: [LoRA](https://dmxsf.com/en/glossary/#lora), [Fine-tuning](https://dmxsf.com/en/glossary/#fine-tuning)

### pass@k

A code-generation metric: generate k solutions per problem, count the problem as solved if any one passes all unit tests, and report the fraction of problems solved. HumanEval (164 problems) uses it.

- Read the lesson: [The Statistics of Evaluation: pass@k, Confidence Intervals and Sample Size](https://dmxsf.com/en/wiki/evaluation/eval-statistics/)
- See also: [Benchmark](https://dmxsf.com/en/glossary/#benchmark), [HumanEval](https://dmxsf.com/en/glossary/#humaneval), [Confidence interval](https://dmxsf.com/en/glossary/#confidence-interval)

### pass^k

A reliability metric for agents: run each task k times independently and count it as passed only if all k runs succeed, then average over tasks. The larger k, the stricter it is, the opposite of pass@k (any one success). Proposed by τ-bench.

- Read the lesson: [Agents and Tool Calling in Practice: From Function Calling to ReAct Workflows](https://dmxsf.com/en/wiki/applications/agents-and-tool-calling/)
- See also: [pass@k](https://dmxsf.com/en/glossary/#pass-at-k), [τ-bench](https://dmxsf.com/en/glossary/#tau-bench), [Agent](https://dmxsf.com/en/glossary/#agent)

### PD disaggregation

Deploying prefill (compute-bound, sets the time to first token) and decoding (bandwidth-bound, sets the per-token latency) on separate instance pools, each provisioned for its own resource profile, with the KV cache shipped over the network in between. The gain is measured as goodput under both latency constraints; under light load or tight networks it may not pay off.

- Also called: Prefill/Decode disaggregation
- Read the lesson: [Prefix Caching and PD Disaggregation: Pay for Repeated Compute Once](https://dmxsf.com/en/wiki/inference/prefix-caching/)
- See also: [Prefill and decode](https://dmxsf.com/en/glossary/#prefill-decode), [Prefix caching](https://dmxsf.com/en/glossary/#prefix-caching), [Time to first token](https://dmxsf.com/en/glossary/#ttft)

### Per-word perplexity

Perplexity computed by dividing the total negative log-likelihood of a text by its number of words rather than subword tokens, then exponentiating. Tokenizers cut different numbers of tokens, so per-token perplexities cannot be compared across models and per-word ones can. The WikiText-2 test set has 241,211 words in 4,358 rows; the usual count of 245,569 units adds one end-of-line per row.

- Also called: Word-level perplexity
- Read the lesson: [From Language Modeling to Next-Token Prediction](https://dmxsf.com/en/wiki/foundations/next-token-prediction/)
- Paper notes: [GPT-1, GPT-2, GPT-3: From Fine-Tuning to In-Context Learning, Recomputed from the Papers](https://dmxsf.com/en/blog/gpt-series-evolution/)
- See also: [Perplexity](https://dmxsf.com/en/glossary/#perplexity), [Strided perplexity](https://dmxsf.com/en/glossary/#strided-perplexity), [Bits per byte](https://dmxsf.com/en/glossary/#bits-per-byte), [Tokenizer](https://dmxsf.com/en/glossary/#tokenizer)

### Perplexity

The exponential of the average negative log-likelihood per token: PPL = exp(−(1/N) Σ log P(x_t | x_<t)). Lower means the text is less surprising to the model; it is only comparable between models that share a tokenizer.

- Also called: PPL
- Read the lesson: [From Language Modeling to Next-Token Prediction](https://dmxsf.com/en/wiki/foundations/next-token-prediction/)
- See also: [Cross-entropy](https://dmxsf.com/en/glossary/#cross-entropy), [Language model](https://dmxsf.com/en/glossary/#language-model)

### PF-day

A unit of training compute: running at 10^15 floating-point operations per second for one full day, i.e. 10^15 × 24 × 3600 = 8.64 × 10^19 FLOPs. The scaling-law paper by Kaplan et al. measures training compute in PF-days.

- Also called: PetaFLOP/s-day
- Paper notes: [Scaling Laws for Neural Language Models](https://dmxsf.com/en/blog/scaling-laws-for-neural-language-models/)
- See also: [FLOPs](https://dmxsf.com/en/glossary/#flops), [Scaling law](https://dmxsf.com/en/glossary/#scaling-law)

### Pipeline bubble

The idle time in pipeline parallelism caused by dependencies between stages. With the GPipe schedule, p stages and m micro-batches leave a fraction (p−1)/(m+p−1) of the time idle, so more micro-batches mean a smaller bubble.

- Read the lesson: [Distributed Training: Data, Tensor and Pipeline Parallelism](https://dmxsf.com/en/wiki/pretraining/distributed-training/)
- See also: [Pipeline parallelism](https://dmxsf.com/en/glossary/#pipeline-parallelism), [Data parallelism](https://dmxsf.com/en/glossary/#data-parallelism)

### Pipeline parallelism

Splitting the model by layers into stages on different devices and feeding micro-batches through them so the stages work at the same time, which reduces idle "bubbles".

- Read the lesson: [Distributed Training: Data, Tensor and Pipeline Parallelism](https://dmxsf.com/en/wiki/pretraining/distributed-training/)
- See also: [Data parallelism](https://dmxsf.com/en/glossary/#data-parallelism), [Tensor parallelism](https://dmxsf.com/en/glossary/#tensor-parallelism)

### Policy gradient

Maximizing the expected reward J(θ) by following its gradient with respect to the policy parameters. The key identity is ∇J = E[R·∇log π_θ]: raise the log-probability of responses that scored well and lower it for those that did not. It needs only samples and scores, not a differentiable reward, but the sample estimate is very noisy, so a baseline is always subtracted.

- Read the lesson: [Reinforcement Learning Basics: Policy Gradients, Advantages and PPO](https://dmxsf.com/en/wiki/post-training/rl-fundamentals/)
- See also: [REINFORCE](https://dmxsf.com/en/glossary/#reinforce), [Advantage](https://dmxsf.com/en/glossary/#advantage), [Baseline (policy gradient)](https://dmxsf.com/en/glossary/#rl-baseline), [Proximal policy optimization](https://dmxsf.com/en/glossary/#ppo)

### Policy lag

The gap between the behavior policy that generated a trajectory and the learner's policy when it consumes it. Track version differences separately from probability ratios or other measures of policy drift.

- Read the lesson: [Reasoning RL systems: asynchronous rollouts and policy lag](https://dmxsf.com/en/wiki/post-training/rollout-and-training/)
- See also: [Group relative policy optimization](https://dmxsf.com/en/glossary/#grpo), [Policy gradient](https://dmxsf.com/en/glossary/#policy-gradient)

### Polysemanticity

A neuron that activates on several semantically unrelated inputs or features; the opposite is monosemanticity. Superposition is one explanation: features are directions in activation space spread across many neurons, so no single neuron matches one feature. Sparse autoencoders try to decompose polysemantic activations into monosemantic directions.

- Read the lesson: [Mechanistic Interpretability: Superposition, Sparse Autoencoders and Circuits](https://dmxsf.com/en/wiki/frontier/interpretability/)
- See also: [Superposition](https://dmxsf.com/en/glossary/#superposition), [Sparse autoencoder](https://dmxsf.com/en/glossary/#sparse-autoencoder)

### Position bias

A judge model's tendency to prefer the answer in a certain slot, most often the first. After swapping the order of two similar answers, GPT-4 gave a consistent verdict in only 65.0% of cases. The usual fix is to judge twice with the order swapped and count a win only if both agree.

- Read the lesson: [LLM-as-a-Judge: Using a Model as the Grader, Its Biases and Calibration](https://dmxsf.com/en/wiki/evaluation/llm-as-judge/)
- See also: [LLM-as-a-judge](https://dmxsf.com/en/glossary/#llm-as-a-judge)

### Position interpolation (PI)

Divides every position index by the extension factor s (equivalently, every RoPE frequency by s), so a longer sequence falls back inside the range of angles seen in training, followed by a short fine-tune on long sequences. The price is lower local resolution on the high-frequency dimensions. Proposed by Chen et al. in 2023.

- Read the lesson: [Long Context: Position Extrapolation, Training Recipes and Cost](https://dmxsf.com/en/wiki/architecture/long-context/)
- See also: [Rotary position embedding](https://dmxsf.com/en/glossary/#rope), [YaRN](https://dmxsf.com/en/glossary/#yarn), [Context window](https://dmxsf.com/en/glossary/#context-window)

### Positional encoding

A way to give the model information about token order, which attention alone does not have. Common schemes are sinusoidal, learned, relative and rotary (RoPE) encodings.

- Read the lesson: [Positional Encoding Explained: Absolute, Relative and RoPE](https://dmxsf.com/en/wiki/architecture/positional-encoding/)
- See also: [Rotary position embedding](https://dmxsf.com/en/glossary/#rope), [Self-attention](https://dmxsf.com/en/glossary/#self-attention)

### Post-norm

Placing layer normalization after the residual addition, LayerNorm(x + Sublayer(x)), as in the original Transformer. Deeper post-norm models depend more on learning-rate warmup to train stably; since GPT-2, mainstream models normalize before each sublayer instead (Pre-LN).

- Also called: Post-LN
- Read the lesson: [Transformer Block Explained: Attention, FFN, Residuals and LayerNorm](https://dmxsf.com/en/wiki/architecture/transformer-block/)
- Paper notes: [Attention Is All You Need: the Transformer, with self-attention instead of recurrence and convolution](https://dmxsf.com/en/blog/attention-is-all-you-need/)
- See also: [Layer normalization](https://dmxsf.com/en/glossary/#layer-norm), [Residual connection](https://dmxsf.com/en/glossary/#residual-connection), [PreNorm dilution](https://dmxsf.com/en/glossary/#prenorm-dilution), [Learning-rate warmup](https://dmxsf.com/en/glossary/#learning-rate-warmup)

### Post-training

All the stages after pretraining that make a model useful and controllable, including supervised fine-tuning, preference optimization and reinforcement learning.

- See also: [Supervised fine-tuning](https://dmxsf.com/en/glossary/#sft), [Reinforcement learning from human feedback](https://dmxsf.com/en/glossary/#rlhf), [Alignment](https://dmxsf.com/en/glossary/#alignment)

### Power law

A relation of the form y ∝ x^(-α): every time x grows by a fixed factor, y is multiplied by a fixed factor, which is a straight line on log-log axes. In scaling laws the loss follows power laws in parameters, data and compute; the exponents are small, so returns diminish but stay predictable.

- Read the lesson: [Scaling Laws: How to Split Compute Between Parameters and Data](https://dmxsf.com/en/wiki/pretraining/scaling-laws/)
- Paper notes: [Scaling Laws for Neural Language Models](https://dmxsf.com/en/blog/scaling-laws-for-neural-language-models/)
- See also: [Scaling law](https://dmxsf.com/en/glossary/#scaling-law)

### PPO-ptx (PPO-ptx)

A PPO variant from InstructGPT that, while optimizing the reward, adds the gradient of the log-likelihood on the pretraining distribution, scaled by a coefficient γ (27.8 in the paper), to the same update to reduce the alignment tax. The paper found it more effective than simply raising the KL coefficient.

- Paper notes: [InstructGPT: Training Language Models to Follow Instructions with Human Feedback](https://dmxsf.com/en/blog/instructgpt-rlhf/)
- See also: [Proximal policy optimization](https://dmxsf.com/en/glossary/#ppo), [Alignment tax](https://dmxsf.com/en/glossary/#alignment-tax), [KL divergence](https://dmxsf.com/en/glossary/#kl-divergence)

### Prefill and decode

The two phases of inference: prefill processes the whole prompt in parallel and is compute-bound; decode generates tokens one by one and is limited by memory bandwidth.

- Read the lesson: [KV Cache and Inference Performance](https://dmxsf.com/en/wiki/inference/kv-cache/)
- See also: [KV cache](https://dmxsf.com/en/glossary/#kv-cache), [Time to first token](https://dmxsf.com/en/glossary/#ttft), [Memory-bound](https://dmxsf.com/en/glossary/#memory-bound)

### Prefix caching

Keeping the KV cache of a prompt prefix that has already been computed, so that a later request whose first tokens are identical can reuse it and compute only what follows. The output is unchanged and the time to first token drops sharply.

- Read the lesson: [Prefix Caching and PD Disaggregation: Pay for Repeated Compute Once](https://dmxsf.com/en/wiki/inference/prefix-caching/)
- See also: [KV cache](https://dmxsf.com/en/glossary/#kv-cache), [PagedAttention](https://dmxsf.com/en/glossary/#pagedattention), [PD disaggregation](https://dmxsf.com/en/glossary/#pd-disaggregation), [Time to first token](https://dmxsf.com/en/glossary/#ttft)

### PreNorm dilution

In a PreNorm network only each sublayer's input is normalized; the residual stream is not, and layer outputs are added with weight 1. The Attention Residuals paper argues the stream's magnitude grows with depth (it says O(L)), so later layers must learn ever larger outputs to matter, earlier contributions are diluted, and none can be recovered alone. It motivates weighted aggregation.

- Paper notes: [Attention Residuals: Letting Each Layer Pick What to Read From the Layers Before It](https://dmxsf.com/en/blog/attention-residuals/)
- See also: [Residual connection](https://dmxsf.com/en/glossary/#residual-connection), [Layer normalization](https://dmxsf.com/en/glossary/#layer-norm), [Attention Residuals](https://dmxsf.com/en/glossary/#attention-residuals)

### Pretraining

Training a model on massive amounts of unlabeled text with next-token prediction, producing a base model with broad language and knowledge abilities.

- Read the lesson: [The LLM Training Pipeline: From Data to Deployment](https://dmxsf.com/en/wiki/pretraining/training-pipeline/)
- See also: [Next-token prediction](https://dmxsf.com/en/glossary/#next-token-prediction), [Base model](https://dmxsf.com/en/glossary/#base-model), [Scaling law](https://dmxsf.com/en/glossary/#scaling-law)

### PRM800K

The process supervision dataset released by OpenAI with Let's Verify Step by Step: humans labeled each step of math solutions as positive, negative or neutral, and the training portion has about 800K step labels over 75K solutions to 12K problems. Solutions were picked by active learning, favoring cases the current best PRM rates highly although the final answer is wrong.

- Paper notes: [Let's Verify Step by Step: Scoring Every Reasoning Step Beats Checking Only the Final Answer](https://dmxsf.com/en/blog/lets-verify-step-by-step/)
- See also: [Process reward model](https://dmxsf.com/en/glossary/#prm), [Outcome reward model](https://dmxsf.com/en/glossary/#orm)

### Process reward model (PRM)

A reward model that scores each step of a reasoning chain instead of only checking the final answer (outcome supervision). It gives reinforcement learning a finer signal but needs every step to be labeled or estimated, which costs more. DeepSeekMath plugs it into GRPO: a step's advantage is the sum of the normalized rewards of that step and all later steps.

- Paper notes: [DeepSeekMath: Math Corpus, GRPO and a Unified View of Reinforcement Learning](https://dmxsf.com/en/blog/deepseekmath-pushing-the-limits-of-mathematical-reasoning/)
- See also: [Reward model](https://dmxsf.com/en/glossary/#reward-model), [Group relative policy optimization](https://dmxsf.com/en/glossary/#grpo), [Reinforcement learning with verifiable rewards](https://dmxsf.com/en/glossary/#rlvr)

### Programmatic tool calling

Having the model write code that calls the tools, instead of emitting tool calls one by one: intermediate results stay in a sandbox and only the final result returns to the model's context. Anthropic's November 2025 post reports an example that dropped from 150,000 to 2,000 tokens (vendor-reported). The price is a safe execution environment and a larger attack surface than single calls.

- Also called: Code mode
- Read the lesson: [MCP and the Tool Ecosystem: How It Works and What to Do When Tools Pile Up](https://dmxsf.com/en/wiki/applications/mcp-and-tool-ecosystem/)
- See also: [Function calling](https://dmxsf.com/en/glossary/#function-calling), [Agent](https://dmxsf.com/en/glossary/#agent), [Progressive tool discovery](https://dmxsf.com/en/glossary/#progressive-tool-discovery)

### Progressive tool discovery

A way to manage context when there are many tools: give the model a short catalog or a search tool first, and load a tool's full definition only when needed, instead of listing every definition up front. MCP client best practices suggest it once tool definitions exceed a share of the context window (examples: 1% to 5%); common implementations use BM25 keyword search, embedding search or subagents.

- Also called: Tool search
- Read the lesson: [MCP and the Tool Ecosystem: How It Works and What to Do When Tools Pile Up](https://dmxsf.com/en/wiki/applications/mcp-and-tool-ecosystem/)
- See also: [Model Context Protocol](https://dmxsf.com/en/glossary/#mcp), [Function calling](https://dmxsf.com/en/glossary/#function-calling), [Context window](https://dmxsf.com/en/glossary/#context-window), [Prefix caching](https://dmxsf.com/en/glossary/#prefix-caching), [BM25](https://dmxsf.com/en/glossary/#bm25)

### Projector

The small module that maps the vision encoder's output vectors to the language model's hidden size: LLaVA uses one linear layer, LLaVA-1.5 and the Qwen-VL models use a two-layer MLP (the latter also merge each 2×2 group of neighbouring patches first). It holds a fraction of a percent of the parameters, yet decides whether the language model can make use of the image.

- Also called: Connector
- Read the lesson: [Multimodal LLMs: How an Image Becomes Tokens](https://dmxsf.com/en/wiki/multimodal/multimodal-llms/)
- Paper notes: [LLaVA: Text-Only GPT-4 Writes 158K Visual Instructions and a Language Model Learns to See](https://dmxsf.com/en/blog/llava-visual-instruction-tuning/)
- See also: [Visual token](https://dmxsf.com/en/glossary/#visual-token), [Vision-language model](https://dmxsf.com/en/glossary/#vlm)

### Prompt engineering

Designing and iterating the instructions, examples and context given to a model so it reliably produces the desired result.

- Read the lesson: [Prompt Engineering: A Systematic Guide to Specs, Layers, Examples and Evaluation](https://dmxsf.com/en/wiki/applications/prompt-engineering/)
- See also: [Few-shot prompting](https://dmxsf.com/en/glossary/#few-shot), [Chain of thought](https://dmxsf.com/en/glossary/#chain-of-thought), [In-context learning](https://dmxsf.com/en/glossary/#in-context-learning)

### Prompt ensembling

A zero-shot trick: write several sentences for one class from different templates (for example "a photo of a big {}."), encode them, average the vectors in embedding space and renormalize to get the class vector. The class vectors are computed once, so inference costs the same as with one template. CLIP ensembles 80 templates on ImageNet, 3.5% above the single default prompt.

- Read the lesson: [Multimodal LLMs: How an Image Becomes Tokens](https://dmxsf.com/en/wiki/multimodal/multimodal-llms/)
- Paper notes: [CLIP: Contrastive Learning on 400 Million Image-Text Pairs, and a Classifier You Define in One Sentence](https://dmxsf.com/en/blog/clip-learning-transferable-visual-models/)
- See also: [Zero-shot](https://dmxsf.com/en/glossary/#zero-shot), [Prompt engineering](https://dmxsf.com/en/glossary/#prompt-engineering), [CLIP](https://dmxsf.com/en/glossary/#clip)

### Prompt injection

An attack that smuggles instructions into content the model reads to make it act against the developer's intent. Direct injection comes from user input; indirect injection hides in untrusted content such as web pages, documents, emails or tool results, and was analyzed systematically by Greshake et al. in 2023.

- Read the lesson: [Prompt Injection and Jailbreaks: The Security Boundaries of LLM Applications](https://dmxsf.com/en/wiki/safety/prompt-injection-and-jailbreaks/)
- See also: [Agent](https://dmxsf.com/en/glossary/#agent), [Function calling](https://dmxsf.com/en/glossary/#function-calling), [Model Context Protocol](https://dmxsf.com/en/glossary/#mcp)

### Proximal policy optimization (PPO)

A reinforcement learning algorithm that limits each update by clipping the probability ratio between the new and old policy. Common in RLHF, where it needs a policy, a reference, a reward and a value model at the same time.

- Read the lesson: [Reinforcement Learning Basics: Policy Gradients, Advantages and PPO](https://dmxsf.com/en/wiki/post-training/rl-fundamentals/)
- Paper notes: [PPO: Clipping the Policy Update So One Batch of Data Can Be Reused for Many Epochs](https://dmxsf.com/en/blog/ppo-proximal-policy-optimization-algorithms/)
- See also: [Reinforcement learning from human feedback](https://dmxsf.com/en/glossary/#rlhf), [Group relative policy optimization](https://dmxsf.com/en/glossary/#grpo), [Generalized advantage estimation](https://dmxsf.com/en/glossary/#gae), [Policy gradient](https://dmxsf.com/en/glossary/#policy-gradient), [Trust region policy optimization](https://dmxsf.com/en/glossary/#trpo)

## Q

### QK-Norm

Normalising each head's query and key vectors before the dot product. It bounds the scale of the attention scores and stops the logits from growing during training. Qwen3 implements it as an RMSNorm over the head dimension and drops Qwen2's QKV bias; the paper cites Dehghani et al. (2023), who used it in a 22-billion-parameter vision Transformer, for training stability.

- Also called: Query-key normalization
- Paper notes: [Qwen3 Technical Report: One Model, Two Modes, a Thinking Budget and Strong-to-Weak Distillation](https://dmxsf.com/en/blog/qwen3-technical-report/)
- See also: [RMSNorm](https://dmxsf.com/en/glossary/#rmsnorm), [Self-attention](https://dmxsf.com/en/glossary/#self-attention)

### QLoRA

Quantizes the frozen base model to 4 bits (NF4) and trains LoRA adapters on top, making it possible to fine-tune a 65B-parameter model on a single 48 GB GPU. Proposed by Dettmers et al. in 2023.

- Read the lesson: [LoRA Fine-Tuning in Practice](https://dmxsf.com/en/wiki/post-training/lora-finetuning/)
- Paper notes: [QLoRA: Fine-Tuning a 65B Model on One 48 GB GPU by Quantizing the Base to 4 Bits](https://dmxsf.com/en/blog/qlora-efficient-finetuning-of-quantized-llms/)
- See also: [LoRA](https://dmxsf.com/en/glossary/#lora), [Quantization](https://dmxsf.com/en/glossary/#quantization), [Parameter-efficient fine-tuning](https://dmxsf.com/en/glossary/#peft), [4-bit NormalFloat](https://dmxsf.com/en/glossary/#nf4)

### Quantization

Representing weights or activations with low-precision integers (INT8, INT4) or low-bit floats to cut memory and speed up inference, at the cost of a controlled loss in accuracy.

- Read the lesson: [Model Quantization: INT8, INT4, GPTQ and AWQ Explained and Measured](https://dmxsf.com/en/wiki/inference/quantization/)
- See also: [GPTQ](https://dmxsf.com/en/glossary/#gptq), [AWQ](https://dmxsf.com/en/glossary/#awq), [QLoRA](https://dmxsf.com/en/glossary/#qlora)

### Query rewriting

Reshaping the user's question before retrieval, since it is often vague, abbreviated or several questions in one. Forms: have a model rewrite it (Rewrite-Retrieve-Read); expand it into several parallel searches (Multi-Query) or sub-questions (Sub-Query); retrieve with a hypothetical answer (HyDE) or a more abstract question (Step-back). The cost is an extra model call.

- Also called: Query transformation, Query expansion
- Read the lesson: [RAG in Practice: Chunking, Hybrid Retrieval, Reranking and Evaluation](https://dmxsf.com/en/wiki/applications/rag/)
- Paper notes: [RAG survey: three paradigms, four abilities, and a recount of the paper's tables](https://dmxsf.com/en/blog/rag-survey/)
- See also: [Hypothetical Document Embeddings](https://dmxsf.com/en/glossary/#hyde), [Retrieval-augmented generation](https://dmxsf.com/en/glossary/#rag), [Advanced RAG](https://dmxsf.com/en/glossary/#advanced-rag), [Reranking](https://dmxsf.com/en/glossary/#reranking)

### Query, key and value (QKV)

The three sets of vectors in attention: the query says what a position is looking for, the key says what clue it offers, and the value is the content it contributes once attended to. Weights come from query-key dot products and the output is a weighted sum of values.

- Read the lesson: [Attention Basics: How a Transformer Reads Context](https://dmxsf.com/en/wiki/architecture/attention-basics/)
- See also: [Self-attention](https://dmxsf.com/en/glossary/#self-attention), [Multi-head attention](https://dmxsf.com/en/glossary/#multi-head-attention)

## R

### R1-Zero

The pure-RL model in the DeepSeek-R1 paper: it starts from DeepSeek-V3-Base, does no supervised fine-tuning at all in post-training, and uses only rule-based rewards (answer accuracy plus format) with GRPO. AIME 2024 pass@1 rises from 15.6% to 77.9% (arXiv v2) and responses keep growing, but readability is poor and Chinese and English mix, which led to R1's four-stage pipeline.

- Also called: DeepSeek-R1-Zero
- Read the lesson: [Reinforcement Learning for Reasoning: RLVR and GRPO](https://dmxsf.com/en/wiki/post-training/reasoning-rl/)
- Paper notes: [DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning](https://dmxsf.com/en/blog/deepseek-r1-reasoning-via-reinforcement-learning/)
- See also: [Group relative policy optimization](https://dmxsf.com/en/glossary/#grpo), [Reinforcement learning with verifiable rewards](https://dmxsf.com/en/glossary/#rlvr), [Reasoning model](https://dmxsf.com/en/glossary/#reasoning-model), [Aha moment](https://dmxsf.com/en/glossary/#aha-moment), [Cold-start data](https://dmxsf.com/en/glossary/#cold-start-data)

### RAG quality scores

The three quality scores in Gao et al.'s survey: context relevance (is the retrieved content precise), answer faithfulness (does the answer stay true to the context, without contradiction) and answer relevance (does it address the question). RAGAS, ARES and TruLens use an LLM to score them; the survey admits such metrics are not yet mature or standardized.

- Also called: Context relevance, Answer faithfulness, Answer relevance
- Read the lesson: [RAG in Practice: Chunking, Hybrid Retrieval, Reranking and Evaluation](https://dmxsf.com/en/wiki/applications/rag/)
- Paper notes: [RAG survey: three paradigms, four abilities, and a recount of the paper's tables](https://dmxsf.com/en/blog/rag-survey/)
- See also: [LLM-as-a-judge](https://dmxsf.com/en/glossary/#llm-as-a-judge), [Retrieval-augmented generation](https://dmxsf.com/en/glossary/#rag), [Hallucination](https://dmxsf.com/en/glossary/#hallucination)

### ReAct

An agent pattern that interleaves reasoning and acting: the model writes a thought, calls a tool, reads the observation and continues. Proposed by Yao et al. in 2022.

- Read the lesson: [Agents and Tool Calling in Practice: From Function Calling to ReAct Workflows](https://dmxsf.com/en/wiki/applications/agents-and-tool-calling/)
- Paper notes: [ReAct: Treating Thought as an Action So a Language Model Can Reason and Act in One Trace](https://dmxsf.com/en/blog/react-reasoning-and-acting/)
- See also: [Agent](https://dmxsf.com/en/glossary/#agent), [Function calling](https://dmxsf.com/en/glossary/#function-calling), [Chain of thought](https://dmxsf.com/en/glossary/#chain-of-thought)

### Reasoning model

A model trained with reinforcement learning and similar methods to produce a long chain of thought and check itself before answering, such as OpenAI o1 and DeepSeek-R1.

- Read the lesson: [Reinforcement Learning for Reasoning: RLVR and GRPO](https://dmxsf.com/en/wiki/post-training/reasoning-rl/)
- Paper notes: [DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning](https://dmxsf.com/en/blog/deepseek-r1-reasoning-via-reinforcement-learning/)
- See also: [Reinforcement learning with verifiable rewards](https://dmxsf.com/en/glossary/#rlvr), [Group relative policy optimization](https://dmxsf.com/en/glossary/#grpo), [Test-time compute](https://dmxsf.com/en/glossary/#test-time-compute), [Chain of thought](https://dmxsf.com/en/glossary/#chain-of-thought)

### Reasoning-effort control

A recipe that lets one model run at several reasoning budgets: a scalar b (1 to 100) goes into the system prompt, each prompt is sampled at several b, and rewards are centered only inside each (prompt, b) subgroup. Levels differ through a length penalty −min(C_max, k(b)·ℓ/L_norm) with k(b) decaying exponentially in b. DeepSeek-V4.1-Flash's API tiers max, high, low map to b=100, 75, 50.

- Paper notes: [DeepSeek-V4.1-Flash: Getting the Global KV Cache Down to 890 Bytes per Token](https://dmxsf.com/en/blog/deepseek-v41-flash-pushing-the-limits-of-kv-cache-compression/)
- See also: [Group relative policy optimization](https://dmxsf.com/en/glossary/#grpo), [Reasoning model](https://dmxsf.com/en/glossary/#reasoning-model)

### Receding-horizon planning

Planning several actions ahead from the latest state, executing an initial action or short segment, then using new observations to plan again.

- Read the lesson: [World models and planning: from prediction to closed-loop control](https://dmxsf.com/en/wiki/multimodal/world-models/)
- See also: [World model](https://dmxsf.com/en/glossary/#world-model), [Latent action](https://dmxsf.com/en/glossary/#latent-action)

### Rectified flow

Flow-matching formulation of Liu et al. (2022): take the straight line between noise and data, regress its velocity, and sample by integrating the ODE. Reflow is its iterative step: pair each noise vector with the ODE endpoint of the current model and retrain on those pairs, which straightens trajectories so very few steps suffice. Stable Diffusion 3 trains with this straight-path objective.

- Read the lesson: [Diffusion Models and Flow Matching: Generating Images, Actions and Text from Noise](https://dmxsf.com/en/wiki/multimodal/diffusion-and-flow-matching/)
- See also: [Flow matching](https://dmxsf.com/en/glossary/#flow-matching), [Consistency model](https://dmxsf.com/en/glossary/#consistency-model)

### Recurrent neural network (RNN)

A network that reads a sequence one step at a time: the hidden state h_t = f(h_{t−1}, x_t) compresses the past into a vector of fixed size. It suits sequences naturally but cannot be parallelized over time, information from far back must pass through many steps, and training runs into vanishing gradients.

- Read the lesson: [From RNNs to Attention: Why the Transformer Appeared](https://dmxsf.com/en/wiki/architecture/from-rnn-to-attention/)
- See also: [Long short-term memory](https://dmxsf.com/en/glossary/#lstm), [Vanishing gradient](https://dmxsf.com/en/glossary/#vanishing-gradient), [Sequence-to-sequence model](https://dmxsf.com/en/glossary/#seq2seq), [Self-attention](https://dmxsf.com/en/glossary/#self-attention)

### Recurrent State-Space Model (RSSM)

The world-model structure of the Dreamer family: a deterministic recurrent state h remembers the history and a stochastic discrete latent z represents the current observation. h predicts z as a prior, the observation yields a posterior, and a KL term pulls the two together; rewards, episode continuation and reconstructions come from h and z, so imagination runs purely in latent space.

- Paper notes: [DreamerV3: One Set of Hyperparameters for 150+ Tasks with a World-Model Agent](https://dmxsf.com/en/blog/dreamerv3-mastering-diverse-domains-through-world-models/)
- See also: [World model](https://dmxsf.com/en/glossary/#world-model), [KL divergence](https://dmxsf.com/en/glossary/#kl-divergence)

### Red teaming

Deliberately building inputs that try to elicit harmful output, to test a model and expose its weak points; the attackers can be crowdworkers, experts or another model. Constitutional AI used 182,831 red-team prompts: 42,496 written by people in human red-teaming runs and 140,335 generated by a pretrained model from a few examples.

- Read the lesson: [Prompt Injection and Jailbreaks: The Security Boundaries of LLM Applications](https://dmxsf.com/en/wiki/safety/prompt-injection-and-jailbreaks/)
- Paper notes: [Constitutional AI: a written list of principles lets the model critique, rewrite and grade its own answers](https://dmxsf.com/en/blog/constitutional-ai-harmlessness-from-ai-feedback/)
- See also: [Prompt injection](https://dmxsf.com/en/glossary/#prompt-injection), [Reinforcement learning from human feedback](https://dmxsf.com/en/glossary/#rlhf), [Constitutional AI](https://dmxsf.com/en/glossary/#constitutional-ai)

### Reduce-scatter

A collective primitive: n devices each hold N values; the values are summed elementwise and the result is cut into n shards, each device keeping one shard of size N/n. Followed by an all-gather it equals an all-reduce; ZeRO and FSDP use it to sum gradients and shard them in one step.

- Read the lesson: [Collective Communication: Why All-Reduce Has So Many Algorithms](https://dmxsf.com/en/wiki/systems/collective-communication/)
- See also: [All-reduce](https://dmxsf.com/en/glossary/#all-reduce), [All-gather](https://dmxsf.com/en/glossary/#all-gather), [ZeRO](https://dmxsf.com/en/glossary/#zero)

### Reference model

The baseline model pi_ref in RLHF and DPO, usually the frozen SFT model. The KL penalty measures how far the new policy has moved from it, and the implicit reward is defined relative to it; a larger beta keeps the policy closer. Preference data should come from it or a close model; without an SFT model, DPO first maximizes the likelihood of the chosen answers to obtain one.

- Also called: Reference policy
- Read the lesson: [Preference Optimization: From RLHF to DPO](https://dmxsf.com/en/wiki/post-training/preference-optimization/)
- Paper notes: [Direct Preference Optimization: Your Language Model is Secretly a Reward Model](https://dmxsf.com/en/blog/dpo-direct-preference-optimization/)
- See also: [Direct preference optimization](https://dmxsf.com/en/glossary/#dpo), [Reinforcement learning from human feedback](https://dmxsf.com/en/glossary/#rlhf), [KL divergence](https://dmxsf.com/en/glossary/#kl-divergence), [Supervised fine-tuning](https://dmxsf.com/en/glossary/#sft)

### REINFORCE

The most basic policy-gradient algorithm (Williams, 1992): sample whole responses, weight the gradient of each one's log-probability by its score, and average. It needs no value model and is the simplest to implement, but without a baseline its variance is the largest. RLOO is REINFORCE with a leave-one-out baseline.

- Read the lesson: [Reinforcement Learning Basics: Policy Gradients, Advantages and PPO](https://dmxsf.com/en/wiki/post-training/rl-fundamentals/)
- See also: [Policy gradient](https://dmxsf.com/en/glossary/#policy-gradient), [Baseline (policy gradient)](https://dmxsf.com/en/glossary/#rl-baseline), [REINFORCE Leave-One-Out](https://dmxsf.com/en/glossary/#rloo)

### REINFORCE Leave-One-Out (RLOO)

Samples G responses to a prompt and uses the mean reward of the other G−1 as each response's baseline. The baseline does not depend on the response itself, so the gradient is unbiased and no value model is needed. Proposed by Kool et al. (2019) and applied to RLHF by Ahmadian et al. (2024). Subtracting the plain group mean gives exactly (G−1)/G of its expected gradient.

- Read the lesson: [Reinforcement Learning Basics: Policy Gradients, Advantages and PPO](https://dmxsf.com/en/wiki/post-training/rl-fundamentals/)
- See also: [Group relative policy optimization](https://dmxsf.com/en/glossary/#grpo), [REINFORCE](https://dmxsf.com/en/glossary/#reinforce), [Baseline (policy gradient)](https://dmxsf.com/en/glossary/#rl-baseline)

### Reinforcement learning from human feedback (RLHF)

First train a reward model from human preference data, then optimize the language model with reinforcement learning (usually PPO) to earn higher reward, with a KL penalty keeping it close to a reference model. The standard recipe of InstructGPT.

- Read the lesson: [Preference Optimization: From RLHF to DPO](https://dmxsf.com/en/wiki/post-training/preference-optimization/)
- Paper notes: [InstructGPT: Training Language Models to Follow Instructions with Human Feedback](https://dmxsf.com/en/blog/instructgpt-rlhf/)
- See also: [Reward model](https://dmxsf.com/en/glossary/#reward-model), [Proximal policy optimization](https://dmxsf.com/en/glossary/#ppo), [Direct preference optimization](https://dmxsf.com/en/glossary/#dpo), [KL divergence](https://dmxsf.com/en/glossary/#kl-divergence)

### Reinforcement learning with verifiable rewards (RLVR)

Reinforcement learning whose reward comes from rules that can check an answer automatically, such as whether a math answer is correct or code passes its tests, which avoids reward models being gamed. A key method for training reasoning models.

- Read the lesson: [Reinforcement Learning for Reasoning: RLVR and GRPO](https://dmxsf.com/en/wiki/post-training/reasoning-rl/)
- See also: [Group relative policy optimization](https://dmxsf.com/en/glossary/#grpo), [Reasoning model](https://dmxsf.com/en/glossary/#reasoning-model), [Reward hacking](https://dmxsf.com/en/glossary/#reward-hacking)

### Rejection sampling fine-tuning

For each prompt, sample several answers from the best current model (10 to 30 in Llama 3), let a reward model pick the best, and fine-tune on it with SFT. Unlike best-of-N, which only selects at inference time, it trains the chosen answers into the model and can be iterated. Llama 3 made it a main source of SFT data; PagedAttention more than doubled sampling throughput.

- Paper notes: [The Llama 3 Herd of Models: data, scale and the engineering recipe of a 405B dense model](https://dmxsf.com/en/blog/the-llama-3-herd-of-models/)
- See also: [Best-of-N sampling](https://dmxsf.com/en/glossary/#best-of-n), [Reward model](https://dmxsf.com/en/glossary/#reward-model), [Supervised fine-tuning](https://dmxsf.com/en/glossary/#sft), [PagedAttention](https://dmxsf.com/en/glossary/#pagedattention)

### Reliability diagram

A plot for checking calibration: confidence bins on the x axis, actual accuracy within each bin on the y axis. Points on the diagonal mean calibrated, points below it mean overconfident and points above it mean underconfident.

- Read the lesson: [Hallucination and Calibration: Why Models Sound Sure and Are Wrong](https://dmxsf.com/en/wiki/safety/hallucination-and-calibration/)
- See also: [Calibration](https://dmxsf.com/en/glossary/#calibration), [Expected calibration error](https://dmxsf.com/en/glossary/#expected-calibration-error)

### Reranking

Re-scoring the candidates from a first retrieval pass with a more precise (and usually slower) model, so the most relevant ones come first.

- Read the lesson: [RAG in Practice: Chunking, Hybrid Retrieval, Reranking and Evaluation](https://dmxsf.com/en/wiki/applications/rag/)
- See also: [Retrieval-augmented generation](https://dmxsf.com/en/glossary/#rag), [Chunking](https://dmxsf.com/en/glossary/#chunking)

### Residual connection

Adding a sublayer's input directly to its output: y = x + f(x). It lets gradients flow back more easily, which makes very deep networks trainable.

- Read the lesson: [Transformer Block Explained: Attention, FFN, Residuals and LayerNorm](https://dmxsf.com/en/wiki/architecture/transformer-block/)
- See also: [Layer normalization](https://dmxsf.com/en/glossary/#layer-norm), [Transformer](https://dmxsf.com/en/glossary/#transformer)

### Residual learning

A block learns a correction F(x) and returns F(x)+x through a skip connection. Identity paths make very deep networks easier to optimize in ResNet and Transformer.

- Paper notes: [ResNet: Residual connections make very deep networks trainable](https://dmxsf.com/en/blog/deep-residual-learning-for-image-recognition/)
- See also: [Transformer](https://dmxsf.com/en/glossary/#transformer)

### Residual stream

The view of a Transformer as one shared vector per position: each attention head and MLP reads the residual stream and adds its own output back, and the logits come from the final residual stream through the final norm and the unembedding. The output then splits into per-component contributions, and every layer boundary at every position is a point that can be read or overwritten.

- Read the lesson: [Mechanistic Interpretability: Superposition, Sparse Autoencoders and Circuits](https://dmxsf.com/en/wiki/frontier/interpretability/)
- See also: [Residual connection](https://dmxsf.com/en/glossary/#residual-connection), [Multi-head attention](https://dmxsf.com/en/glossary/#multi-head-attention), [Logits](https://dmxsf.com/en/glossary/#logits)

### Retention

RetNet's sequence-mixing mechanism uses multi-scale decay in equivalent parallel, recurrent and chunkwise forms, enabling decoding with fixed-size state.

- Paper notes: [RetNet: Parallel training and recurrent inference through retention](https://dmxsf.com/en/blog/retentive-network-a-successor-to-transformer-for-large-language-models/)
- See also: [Transformer](https://dmxsf.com/en/glossary/#transformer)

### Retrieval granularity

The unit returned by one retrieval. For text, fine to coarse: token, phrase, sentence, proposition, chunk, document; on a knowledge graph: entity, triplet, sub-graph. Coarse units hold more information but more redundancy that distracts retriever and model; fine units add retrieval burden and may lose semantic completeness. A compromise, Small2Big, retrieves sentences and passes their neighbors.

- Read the lesson: [RAG in Practice: Chunking, Hybrid Retrieval, Reranking and Evaluation](https://dmxsf.com/en/wiki/applications/rag/)
- Paper notes: [RAG survey: three paradigms, four abilities, and a recount of the paper's tables](https://dmxsf.com/en/blog/rag-survey/)
- See also: [Chunking](https://dmxsf.com/en/glossary/#chunking), [Naive RAG](https://dmxsf.com/en/glossary/#naive-rag), [Retrieval-augmented generation](https://dmxsf.com/en/glossary/#rag)

### Retrieval-augmented generation (RAG)

First retrieve relevant passages from an external knowledge base, then give them to the model together with the question, so answers are grounded and can use fresh or private knowledge. Proposed by Lewis et al. in 2020.

- Read the lesson: [RAG in Practice: Chunking, Hybrid Retrieval, Reranking and Evaluation](https://dmxsf.com/en/wiki/applications/rag/)
- Paper notes: [RAG survey: three paradigms, four abilities, and a recount of the paper's tables](https://dmxsf.com/en/blog/rag-survey/)
- See also: [Vector database](https://dmxsf.com/en/glossary/#vector-database), [Chunking](https://dmxsf.com/en/glossary/#chunking), [Reranking](https://dmxsf.com/en/glossary/#reranking), [Hallucination](https://dmxsf.com/en/glossary/#hallucination)

### Return normalization

DreamerV3's treatment of the actor's returns: scale them by S, the gap between the 95th and 5th percentiles of the return batch (smoothed by an exponential moving average), with the divisor max(1, S). Percentiles are insensitive to outlier returns and the floor of 1 leaves small sparse returns untouched, so one entropy coefficient suits tasks whose rewards differ in scale and sparsity.

- Also called: Percentile return normalization
- Paper notes: [DreamerV3: One Set of Hyperparameters for 150+ Tasks with a World-Model Agent](https://dmxsf.com/en/blog/dreamerv3-mastering-diverse-domains-through-world-models/)
- See also: [Proximal policy optimization](https://dmxsf.com/en/glossary/#ppo), [Generalized advantage estimation](https://dmxsf.com/en/glossary/#gae), [symlog transform](https://dmxsf.com/en/glossary/#symlog)

### Return-conditioned supervised learning (RCSL)

A family of offline RL methods: fit the distribution of actions given the state and a desired return with supervised learning, then act by asking for a high return; no value function. Decision Transformer belongs here. It needs stronger assumptions than dynamic programming to be optimal (Brandfonbrener et al., 2022) and can be misled by luck in stochastic environments (Paster et al., 2022).

- Paper notes: [Decision Transformer: Reinforcement Learning as Conditional Sequence Modeling](https://dmxsf.com/en/blog/decision-transformer-reinforcement-learning-via-sequence-modeling/)
- See also: [Decision Transformer](https://dmxsf.com/en/glossary/#decision-transformer), [Returns-to-go](https://dmxsf.com/en/glossary/#returns-to-go), [Stitching](https://dmxsf.com/en/glossary/#stitching), [Behavior cloning](https://dmxsf.com/en/glossary/#behavior-cloning)

### Returns-to-go (RTG)

The sum of rewards from the current time step to the end of the trajectory. Decision Transformer feeds it to the model as a condition instead of the rewards themselves, since an action should depend on how much return is still wanted, not on how much was collected. At inference a target return is set and reduced by each reward received. Rewards 0, 1, 2 give returns-to-go of 3, 3, 2.

- Paper notes: [Decision Transformer: Reinforcement Learning as Conditional Sequence Modeling](https://dmxsf.com/en/blog/decision-transformer-reinforcement-learning-via-sequence-modeling/)
- See also: [Decision Transformer](https://dmxsf.com/en/glossary/#decision-transformer), [Credit assignment](https://dmxsf.com/en/glossary/#credit-assignment), [Return-conditioned supervised learning](https://dmxsf.com/en/glossary/#rcsl)

### Reward hacking

When a model exploits loopholes in the reward function or reward model to score high without actually doing the task.

- Read the lesson: [Preference Optimization: From RLHF to DPO](https://dmxsf.com/en/wiki/post-training/preference-optimization/)
- See also: [Reward model](https://dmxsf.com/en/glossary/#reward-model), [Reinforcement learning from human feedback](https://dmxsf.com/en/glossary/#rlhf), [Reinforcement learning with verifiable rewards](https://dmxsf.com/en/glossary/#rlvr)

### Reward model

A model that assigns a scalar score to a prompt and response pair, trained on human preference pairs (better versus worse); in RLHF it stands in for human preferences.

- Read the lesson: [Reward Models: Turning Human Preferences into a Score to Optimize](https://dmxsf.com/en/wiki/post-training/reward-models/)
- Paper notes: [InstructGPT: Training Language Models to Follow Instructions with Human Feedback](https://dmxsf.com/en/blog/instructgpt-rlhf/)
- See also: [Reinforcement learning from human feedback](https://dmxsf.com/en/glossary/#rlhf), [Reward hacking](https://dmxsf.com/en/glossary/#reward-hacking), [Bradley–Terry model](https://dmxsf.com/en/glossary/#bradley-terry), [Reward overoptimization](https://dmxsf.com/en/glossary/#reward-overoptimization), [RewardBench](https://dmxsf.com/en/glossary/#rewardbench)

### Reward model ensemble

Train several reward models and combine their scores into one reward to curb overoptimization. Common aggregations are the mean, the minimum (worst-case optimization, WCO) and the mean minus λ times the variance (uncertainty-weighted optimization, UWO; Coste et al., 2024). The mean is not conservative: if one member overestimates a response, the policy can still exploit it.

- Read the lesson: [Reward Models: Turning Human Preferences into a Score to Optimize](https://dmxsf.com/en/wiki/post-training/reward-models/)
- See also: [Reward overoptimization](https://dmxsf.com/en/glossary/#reward-overoptimization), [Reward model](https://dmxsf.com/en/glossary/#reward-model), [Best-of-N sampling](https://dmxsf.com/en/glossary/#best-of-n)

### Reward overoptimization

The effect where optimizing harder against a reward model’s score keeps raising the score (the proxy reward) while independently measured true quality first rises and then falls. Gao et al. (2022) used a larger “gold” reward model as the truth and found the gold score under best-of-N follows R(d)=d(α−βd), with d the square root of the KL; extremal Goodhart effects mainly account for the β term.

- Read the lesson: [Reward Models: Turning Human Preferences into a Score to Optimize](https://dmxsf.com/en/wiki/post-training/reward-models/)
- See also: [Goodhart’s law](https://dmxsf.com/en/glossary/#goodharts-law), [Reward hacking](https://dmxsf.com/en/glossary/#reward-hacking), [Best-of-N sampling](https://dmxsf.com/en/glossary/#best-of-n), [KL divergence](https://dmxsf.com/en/glossary/#kl-divergence)

### RewardBench

A benchmark for reward models themselves (Lambert et al., 2024): prompt-chosen-rejected trios covering chat, hard chat, safety and reasoning (code and math), scored by how often the reward model ranks the chosen response above the rejected one; it can also score DPO’s implicit reward.

- Read the lesson: [Reward Models: Turning Human Preferences into a Score to Optimize](https://dmxsf.com/en/wiki/post-training/reward-models/)
- See also: [Reward model](https://dmxsf.com/en/glossary/#reward-model), [Bradley–Terry model](https://dmxsf.com/en/glossary/#bradley-terry), [Label noise](https://dmxsf.com/en/glossary/#label-noise)

### Ring all-reduce

Arrange n devices in a ring: n−1 steps of reduce-scatter, then n−1 steps of all-gather, each step talking only to a neighbor. Each device sends about 2(n−1)/n times the data size in total, which barely grows with n and is optimal for bandwidth; the drawback is latency growing linearly with n.

- Read the lesson: [Collective Communication: Why All-Reduce Has So Many Algorithms](https://dmxsf.com/en/wiki/systems/collective-communication/)
- See also: [All-reduce](https://dmxsf.com/en/glossary/#all-reduce), [Reduce-scatter](https://dmxsf.com/en/glossary/#reduce-scatter), [All-gather](https://dmxsf.com/en/glossary/#all-gather), [Bus bandwidth](https://dmxsf.com/en/glossary/#bus-bandwidth)

### RLAIF

Reinforcement learning from AI feedback: the reward model's preference labels come from a language model, not people. In Constitutional AI the feedback model reads two answers as a multiple-choice question, picks the better one under a written principle, and the normalized option probability becomes a soft label. People supply the principles and, in that paper, the helpfulness labels.

- Read the lesson: [Preference Optimization: From RLHF to DPO](https://dmxsf.com/en/wiki/post-training/preference-optimization/)
- Paper notes: [Constitutional AI: a written list of principles lets the model critique, rewrite and grade its own answers](https://dmxsf.com/en/blog/constitutional-ai-harmlessness-from-ai-feedback/)
- See also: [Reinforcement learning from human feedback](https://dmxsf.com/en/glossary/#rlhf), [Constitutional AI](https://dmxsf.com/en/glossary/#constitutional-ai), [Reward model](https://dmxsf.com/en/glossary/#reward-model), [LLM-as-a-judge](https://dmxsf.com/en/glossary/#llm-as-a-judge)

### RMSNorm

A simplified layer normalization that divides by the root mean square of the features and does not subtract the mean, which is cheaper to compute. Used by Llama and others.

- Read the lesson: [Modern LLM Architecture: From GPT-2 to Llama, Qwen and DeepSeek](https://dmxsf.com/en/wiki/architecture/modern-llm-architecture/)
- See also: [Layer normalization](https://dmxsf.com/en/glossary/#layer-norm)

### Roofline model

A performance model for deciding what limits an operator: attainable throughput = min(peak compute, arithmetic intensity × memory bandwidth). Plotted against arithmetic intensity it looks like a roof: a sloped part where bandwidth limits and a flat part where compute limits, meeting at the ridge point, peak compute divided by bandwidth.

- Read the lesson: [GPUs and the Roofline Model: Why Big Models Are Bound by Memory Bandwidth](https://dmxsf.com/en/wiki/systems/gpu-and-roofline/)
- See also: [Arithmetic intensity](https://dmxsf.com/en/glossary/#arithmetic-intensity), [Memory-bound](https://dmxsf.com/en/glossary/#memory-bound), [High Bandwidth Memory](https://dmxsf.com/en/glossary/#hbm), [FLOPs](https://dmxsf.com/en/glossary/#flops)

### Rotary position embedding (RoPE)

Rotates each pair of dimensions of the query and key vectors by an angle proportional to the position, so that their dot product depends only on relative distance. Proposed by Su et al. in 2021 and widely used by Llama, Qwen and DeepSeek.

- Read the lesson: [Positional Encoding Explained: Absolute, Relative and RoPE](https://dmxsf.com/en/wiki/architecture/positional-encoding/)
- Paper notes: [RoFormer: Writing Position into the Attention Dot Product with Rotations](https://dmxsf.com/en/blog/roformer-rotary-position-embedding/)
- See also: [Positional encoding](https://dmxsf.com/en/glossary/#positional-encoding), [Context window](https://dmxsf.com/en/glossary/#context-window), [Position interpolation](https://dmxsf.com/en/glossary/#position-interpolation), [YaRN](https://dmxsf.com/en/glossary/#yarn)

### Router

The small network in a mixture-of-experts model that scores each token and picks its top-k experts. It usually needs a load-balancing loss or a similar mechanism to stop all tokens from piling onto a few experts.

- Also called: Gating network
- Read the lesson: [Mixture of Experts (MoE): Routing, Load Balancing and Sparse Activation](https://dmxsf.com/en/wiki/architecture/mixture-of-experts/)
- Paper notes: [Mixtral of Experts: An Open MoE That Matches Llama 2 70B with 13B Active Parameters](https://dmxsf.com/en/blog/mixtral-of-experts/)
- See also: [Mixture of Experts](https://dmxsf.com/en/glossary/#moe), [Expert load balancing](https://dmxsf.com/en/glossary/#load-balancing), [Shared expert](https://dmxsf.com/en/glossary/#shared-expert)

### Routing Replay

A way to stabilize reinforcement learning of MoE models: cache the experts the old policy activated and replay those routes when computing the new policy's importance ratios. The Qwen team reports that on Qwen3-30B-A3B-Base about 10% of the experts activated for a response change after each update, and GRPO does not converge without it. GSPO does not need it.

- Paper notes: [GSPO: Moving Importance Ratios and Clipping From Tokens to Whole Responses](https://dmxsf.com/en/blog/gspo-group-sequence-policy-optimization/)
- See also: [Mixture of Experts](https://dmxsf.com/en/glossary/#moe), [Group sequence policy optimization](https://dmxsf.com/en/glossary/#gspo)

## S

### Scaled dot-product attention

The standard form of attention: divide the dot products of Q and K by √d_k, apply softmax, and use the result to weight V. If the components are independent with mean 0 and variance 1, a dot product has variance d_k; without scaling, softmax approaches one-hot at large d_k and gradients vanish. Introduced in the 2017 Transformer paper.

- Read the lesson: [Attention Basics: How a Transformer Reads Context](https://dmxsf.com/en/wiki/architecture/attention-basics/)
- Paper notes: [Attention Is All You Need: the Transformer, with self-attention instead of recurrence and convolution](https://dmxsf.com/en/blog/attention-is-all-you-need/)
- See also: [Self-attention](https://dmxsf.com/en/glossary/#self-attention), [Multi-head attention](https://dmxsf.com/en/glossary/#multi-head-attention), [Softmax](https://dmxsf.com/en/glossary/#softmax), [Query, key and value](https://dmxsf.com/en/glossary/#qkv)

### Scaling law

The empirical regularity that model loss falls smoothly as a power law in parameters, data and compute. Kaplan et al. described it systematically in 2020, and Hoffmann et al. (Chinchilla, 2022) revised the optimal balance between parameters and data.

- Read the lesson: [Scaling Laws: How to Split Compute Between Parameters and Data](https://dmxsf.com/en/wiki/pretraining/scaling-laws/)
- Paper notes: [Scaling Laws for Neural Language Models](https://dmxsf.com/en/blog/scaling-laws-for-neural-language-models/)
- See also: [Chinchilla-optimal training](https://dmxsf.com/en/glossary/#chinchilla), [FLOPs](https://dmxsf.com/en/glossary/#flops), [Pretraining](https://dmxsf.com/en/glossary/#pretraining)

### Score function

The gradient of the log density with respect to the data, ∇ₓ log p(x), which points in the direction in which probability grows fastest. In a diffusion model, predicting the noise at noise level t is equivalent to estimating the score: the optimal noise prediction is ε* = −σ_t·∇ log p_t(x_t). Score matching and the DDPM noise-prediction loss are essentially the same regression problem.

- Read the lesson: [Diffusion Models and Flow Matching: Generating Images, Actions and Text from Noise](https://dmxsf.com/en/wiki/multimodal/diffusion-and-flow-matching/)
- See also: [Diffusion model](https://dmxsf.com/en/glossary/#diffusion-model), [Denoising diffusion probabilistic model](https://dmxsf.com/en/glossary/#ddpm)

### Selection mechanism

Mamba's core change: the step size Δ, write matrix B and read matrix C of a state space model are computed from the current token instead of being fixed parameters. The model can then decide by content whether to write a token into the state or ignore it. The cost is that parameters vary with time, so the convolution form no longer applies and training needs a parallel scan.

- Also called: S6, Selective SSM
- Read the lesson: [State Space Models and Hybrids: Trading the KV Cache for a Fixed-Size State](https://dmxsf.com/en/wiki/architecture/state-space-and-hybrid/)
- Paper notes: [Mamba: linear-time sequence modeling with selective state spaces](https://dmxsf.com/en/blog/mamba-linear-time-sequence-modeling-with-selective-state-spaces/)
- See also: [State space model](https://dmxsf.com/en/glossary/#ssm), [Mamba](https://dmxsf.com/en/glossary/#mamba), [LTI SSM](https://dmxsf.com/en/glossary/#lti-ssm), [Parallel scan](https://dmxsf.com/en/glossary/#parallel-scan), [Zero-order hold discretization](https://dmxsf.com/en/glossary/#zoh-discretization)

### Selective Copying

A synthetic task from the Mamba paper that tests content awareness: data tokens to remember are scattered among noise tokens at random positions, and the model must copy them in order. With fixed positions an LTI model solves it with a kernel of the right length; with random positions it must choose by content. In the paper's Table 1, S6 in a Mamba block gets 99.8% and LTI layers at most 57.0%.

- Read the lesson: [State Space Models and Hybrids: Trading the KV Cache for a Fixed-Size State](https://dmxsf.com/en/wiki/architecture/state-space-and-hybrid/)
- Paper notes: [Mamba: linear-time sequence modeling with selective state spaces](https://dmxsf.com/en/blog/mamba-linear-time-sequence-modeling-with-selective-state-spaces/)
- See also: [LTI SSM](https://dmxsf.com/en/glossary/#lti-ssm), [Selection mechanism](https://dmxsf.com/en/glossary/#selection-mechanism), [Induction head](https://dmxsf.com/en/glossary/#induction-head)

### Selective precision

Running only the numerically sensitive part of a computation in higher precision (such as float32) while the rest stays in bfloat16. The Switch Transformer runs the inside of its router in float32 and casts the results back to bfloat16, which avoids the divergence of pure bfloat16 training at nearly bfloat16 speed.

- Paper notes: [Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity](https://dmxsf.com/en/blog/switch-transformers-scaling-to-trillion-parameter-models/)
- See also: [Mixed-precision training](https://dmxsf.com/en/glossary/#mixed-precision), [BF16](https://dmxsf.com/en/glossary/#bf16), [Router](https://dmxsf.com/en/glossary/#router)

### Self-attention

Each position in a sequence uses its query to match the keys of all positions and takes a weighted sum of their values, gathering context directly. Q, K and V all come from the same sequence.

- Read the lesson: [Attention Basics: How a Transformer Reads Context](https://dmxsf.com/en/wiki/architecture/attention-basics/)
- See also: [Query, key and value](https://dmxsf.com/en/glossary/#qkv), [Multi-head attention](https://dmxsf.com/en/glossary/#multi-head-attention), [Causal mask](https://dmxsf.com/en/glossary/#causal-mask), [Cross-attention](https://dmxsf.com/en/glossary/#cross-attention)

### Self-consistency

Sample several chains of thought for the same question at a higher temperature, read an answer off each, and return the most frequent answer (a majority vote). Proposed by Wang et al. in 2022; it needs no training but multiplies the inference cost. The ReAct paper uses CoT-SC with 21 samples as a baseline and lets ReAct and CoT-SC fall back on each other.

- Also called: CoT-SC
- Read the lesson: [Test-Time Compute: Spending Compute on Inference](https://dmxsf.com/en/wiki/frontier/test-time-compute/)
- Paper notes: [ReAct: Treating Thought as an Action So a Language Model Can Reason and Act in One Trace](https://dmxsf.com/en/blog/react-reasoning-and-acting/)
- See also: [Chain of thought](https://dmxsf.com/en/glossary/#chain-of-thought), [Test-time compute](https://dmxsf.com/en/glossary/#test-time-compute), [ReAct](https://dmxsf.com/en/glossary/#react)

### Self-training

Having a model answer unlabeled problems, filter its answers, and train on the result, over several rounds; STaR, ReST-EM and rejection-sampling fine-tuning are examples. Whether it improves depends on outside information in the filter: a reliable verifier lets it bootstrap new ability, while its own majority vote or no filter makes it learn its systematic errors as labels.

- Also called: Self-improvement
- Read the lesson: [Synthetic Data and Self-Improvement: When Models Make Data, and When It Collapses](https://dmxsf.com/en/wiki/frontier/synthetic-data-and-self-improvement/)
- See also: [Rejection sampling fine-tuning](https://dmxsf.com/en/glossary/#rejection-sampling-finetuning), [Synthetic data](https://dmxsf.com/en/glossary/#synthetic-data), [Model collapse](https://dmxsf.com/en/glossary/#model-collapse), [Reinforcement learning with verifiable rewards](https://dmxsf.com/en/glossary/#rlvr), [Self-consistency](https://dmxsf.com/en/glossary/#self-consistency), [Best-of-N sampling](https://dmxsf.com/en/glossary/#best-of-n)

### Sequence-to-sequence learning

An encoder-decoder paradigm for variable-length inputs and outputs. Early LSTM models used a fixed vector; attention later exposed every encoder state.

- Paper notes: [Seq2Seq: Encoder-decoder learning for variable-length sequences](https://dmxsf.com/en/blog/sequence-to-sequence-learning-with-neural-networks/)
- See also: [Encoder-decoder model](https://dmxsf.com/en/glossary/#encoder-decoder)

### Sequence-to-sequence model

A framework in which an encoder reads the source sequence into a vector and a decoder generates the target sequence token by token (Sutskever et al., 2014; Cho et al., 2014), first built with RNNs. Squeezing a whole sentence into one fixed-length vector is its bottleneck, the problem attention was first introduced to solve.

- Also called: Seq2seq
- Read the lesson: [From RNNs to Attention: Why the Transformer Appeared](https://dmxsf.com/en/wiki/architecture/from-rnn-to-attention/)
- See also: [Recurrent neural network](https://dmxsf.com/en/glossary/#rnn), [Additive attention](https://dmxsf.com/en/glossary/#additive-attention), [Encoder-decoder model](https://dmxsf.com/en/glossary/#encoder-decoder)

### Sequential revision

Letting the model rewrite its own earlier answer, which may be wrong, round after round, instead of sampling many answers independently in parallel. Off-the-shelf models rarely revise well from prompting alone, so it needs fine-tuning. Snell et al. (2024) find it slightly better than parallel sampling at equal budget, with the best sequential-to-parallel ratio depending on difficulty.

- Paper notes: [Scaling LLM Test-Time Compute Optimally: Spending Inference Compute by Difficulty Can Beat a Bigger Model](https://dmxsf.com/en/blog/scaling-llm-test-time-compute-optimally-can-be-more-effective-than-scaling-model-parameters/)
- See also: [Test-time compute](https://dmxsf.com/en/glossary/#test-time-compute), [Best-of-N sampling](https://dmxsf.com/en/glossary/#best-of-n), [Outcome reward model](https://dmxsf.com/en/glossary/#orm)

### Shadow traffic

A deployment technique that duplicates real requests to a candidate while users receive the current version's responses. It exposes candidate latency, errors, and resource use, with writes or billing effects isolated.

- Read the lesson: [Production evaluation for LLMs: replay, canaries, and rollback](https://dmxsf.com/en/wiki/evaluation/production-evaluation/)
- See also: [Canary release](https://dmxsf.com/en/glossary/#canary-release), [Goodput](https://dmxsf.com/en/glossary/#goodput)

### Shared expert

An expert in DeepSeekMoE and DeepSeek-V3 that every token passes through without routing. It holds common knowledge and reduces redundancy among the routed experts; its output is simply added to the result.

- Read the lesson: [Mixture of Experts (MoE): Routing, Load Balancing and Sparse Activation](https://dmxsf.com/en/wiki/architecture/mixture-of-experts/)
- Paper notes: [DeepSeek-V2: Compressing the KV Cache with MLA and Cutting Training Cost with DeepSeekMoE](https://dmxsf.com/en/blog/deepseek-v2-strong-economical-efficient-mixture-of-experts/)
- See also: [Mixture of Experts](https://dmxsf.com/en/glossary/#moe), [Router](https://dmxsf.com/en/glossary/#router)

### Signal-to-noise ratio (SNR)

The ratio of signal power to noise power. In diffusion it measures the data relative to the noise in a noised sample: SNR(t) = ᾱ_t/(1−ᾱ_t), often in decibels; the linear DDPM schedule falls from 40 dB at t=1 to about −44 dB at t=1000. The noise-prediction loss equals the clean-sample loss weighted by the SNR, so parameterizations differ only in loss weighting.

- Read the lesson: [Diffusion Models and Flow Matching: Generating Images, Actions and Text from Noise](https://dmxsf.com/en/wiki/multimodal/diffusion-and-flow-matching/)
- See also: [Noise schedule](https://dmxsf.com/en/glossary/#noise-schedule), [Denoising diffusion probabilistic model](https://dmxsf.com/en/glossary/#ddpm)

### Silent data corruption (SDC)

The hardware reports no error yet computes a wrong result, so data is silently altered in computation or transfer. In large-scale training it is harder to handle than a crash: the job keeps running and the error can slip into gradients and checkpoints. Llama 3's 54-day failure log lists 6 such interruptions, 1.4% of the unexpected ones, which the paper counts as suspected hardware issues.

- Paper notes: [The Llama 3 Herd of Models: data, scale and the engineering recipe of a 405B dense model](https://dmxsf.com/en/blog/the-llama-3-herd-of-models/)
- See also: [Checkpoint](https://dmxsf.com/en/glossary/#checkpoint)

### Single-Pass mHC

DeepSeek-V4.1-Flash's rewrite of mHC that shifts the input-mixing coefficients by one block: block l mixes with the A predicted by block l-1, so mixing no longer waits for the current block's coefficients and each residual tile is read once. Activation traffic drops from (4n+4)d to the bound (2n+2)d in the Mega-mHC deployment kernel; pre-training keeps the multi-kernel code.

- Paper notes: [DeepSeek-V4.1-Flash: Getting the Global KV Cache Down to 890 Bytes per Token](https://dmxsf.com/en/blog/deepseek-v41-flash-pushing-the-limits-of-kv-cache-compression/)
- See also: [Manifold-constrained hyper-connections](https://dmxsf.com/en/glossary/#mhc), [Hyper-connections](https://dmxsf.com/en/glossary/#hyper-connections)

### Singleton rate

The share of facts (or prompts) that appear exactly once in the training data, the quantity the Good–Turing method uses to estimate the probability mass of unseen facts. Kalai and Vempala showed that for arbitrary facts with no learnable pattern, a calibrated pretrained model must err on at least about this share.

- Also called: Monofact rate
- Read the lesson: [Hallucination and Calibration: Why Models Sound Sure and Are Wrong](https://dmxsf.com/en/wiki/safety/hallucination-and-calibration/)
- See also: [Hallucination](https://dmxsf.com/en/glossary/#hallucination), [Calibration](https://dmxsf.com/en/glossary/#calibration)

### Sink token

A dedicated learnable token at the start of every pre-training sample, so the model dumps surplus attention on it instead of on some content token. The StreamingLLM paper tested it at 160M parameters: this token plus a recent window gives a stable streaming perplexity (18.01), while the vanilla model needs 4 initial tokens to reach 18.05; 7 zero-shot benchmarks differ by at most 1 point.

- Also called: Learnable sink
- Paper notes: [StreamingLLM: Keep the First Few Tokens in the KV Cache and Sliding Windows Stop Breaking](https://dmxsf.com/en/blog/efficient-streaming-language-models-with-attention-sinks/)
- See also: [Attention sink](https://dmxsf.com/en/glossary/#attention-sink), [SoftMax1](https://dmxsf.com/en/glossary/#softmax-off-by-one), [StreamingLLM](https://dmxsf.com/en/glossary/#streamingllm)

### Sinkhorn-balanced update

The optimizer DeepSeek-V4.1-Flash uses for its huge embedding, head and Engram matrices: after Nesterov momentum, the update matrix is normalized alternately along rows and columns in L2 for K steps (K=11 in the paper) and multiplied by √n, so its row and column RMS both end near 1. It needs one momentum buffer, where Adam would add a second-moment buffer.

- Paper notes: [DeepSeek-V4.1-Flash: Getting the Global KV Cache Down to 890 Bytes per Token](https://dmxsf.com/en/blog/deepseek-v41-flash-pushing-the-limits-of-kv-cache-compression/)
- See also: [Sinkhorn-Knopp algorithm](https://dmxsf.com/en/glossary/#sinkhorn-knopp), [AdamW](https://dmxsf.com/en/glossary/#adamw), [Muon](https://dmxsf.com/en/glossary/#muon)

### Sinkhorn-Knopp algorithm

An algorithm that alternately normalizes the rows and columns of a positive matrix until it converges to a doubly stochastic matrix (Sinkhorn and Knopp, 1967). Stopped after finitely many iterations with row normalization last, it gives exact row sums and column sums with a residual that depends on the iteration count and the entry scale. mHC runs 20 iterations on exponentiated mixing logits.

- Also called: Sinkhorn iteration
- Paper notes: [mHC: Keeping a Wider Residual Stream Stable With Doubly Stochastic Mixing](https://dmxsf.com/en/blog/mhc-manifold-constrained-hyper-connections/)
- See also: [Doubly stochastic matrix](https://dmxsf.com/en/glossary/#doubly-stochastic-matrix), [Manifold-constrained hyper-connections](https://dmxsf.com/en/glossary/#mhc)

### Sinusoidal positional encoding

The fixed position encoding of the Transformer paper: dimension 2i is sin(pos / 10000^(2i/d_model)) and dimension 2i+1 is cos of the same angle, with wavelengths from 2π to about 10000·2π. Each sin-cos pair rotates with position, so PE(pos+k) is a linear function of PE(pos); the paper conjectured this helps learn relative positions and extrapolate to longer sequences.

- Read the lesson: [Positional Encoding Explained: Absolute, Relative and RoPE](https://dmxsf.com/en/wiki/architecture/positional-encoding/)
- Paper notes: [Attention Is All You Need: the Transformer, with self-attention instead of recurrence and convolution](https://dmxsf.com/en/blog/attention-is-all-you-need/)
- See also: [Positional encoding](https://dmxsf.com/en/glossary/#positional-encoding), [Rotary position embedding](https://dmxsf.com/en/glossary/#rope), [Length extrapolation](https://dmxsf.com/en/glossary/#length-extrapolation)

### Sliding-window attention

Each token attends only to the most recent w tokens, cutting attention cost from O(n²) to O(n·w); stacking layers still lets information travel further indirectly. Used by Mistral 7B.

- See also: [Self-attention](https://dmxsf.com/en/glossary/#self-attention), [Context window](https://dmxsf.com/en/glossary/#context-window), [Attention sink](https://dmxsf.com/en/glossary/#attention-sink)

### Soft label

A training target that is a probability distribution rather than a hard 0 or 1. In distillation it is the teacher's output distribution; in Constitutional AI it is the feedback model's normalized probability for two options, used to train the preference model. The more extreme p is, the larger the reward gap ln(p/(1-p)) it demands, so near-0-or-1 chain-of-thought labels were clamped to 40-60%.

- Paper notes: [Constitutional AI: a written list of principles lets the model critique, rewrite and grade its own answers](https://dmxsf.com/en/blog/constitutional-ai-harmlessness-from-ai-feedback/)
- See also: [RLAIF](https://dmxsf.com/en/glossary/#rlaif), [Bradley–Terry model](https://dmxsf.com/en/glossary/#bradley-terry), [Distillation](https://dmxsf.com/en/glossary/#distillation)

### Softmax

The function that turns a vector of real numbers into positive numbers that sum to 1: softmax(z_i) = exp(z_i) / Σ_j exp(z_j). The larger the gaps between scores, the sharper the distribution.

- Read the lesson: [Attention Basics: How a Transformer Reads Context](https://dmxsf.com/en/wiki/architecture/attention-basics/)
- See also: [Logits](https://dmxsf.com/en/glossary/#logits), [Temperature](https://dmxsf.com/en/glossary/#temperature), [Self-attention](https://dmxsf.com/en/glossary/#self-attention)

### SoftMax1

A softmax variant with an extra 1 in the denominator: SoftMax1(x)_i = exp(x_i) / (1 + sum_j exp(x_j)). It equals prepending a token whose key and value are all zero, so weights may sum to less than 1 and a head can attend to nothing rather than dump surplus weight on some token. Proposed by Evan Miller in 2023; StreamingLLM calls it Zero Sink. OpenAI's gpt-oss uses a learned denominator bias.

- Also called: SoftMax-off-by-one, Off-by-one attention
- Paper notes: [StreamingLLM: Keep the First Few Tokens in the KV Cache and Sliding Windows Stop Breaking](https://dmxsf.com/en/blog/efficient-streaming-language-models-with-attention-sinks/)
- See also: [Softmax](https://dmxsf.com/en/glossary/#softmax), [Attention sink](https://dmxsf.com/en/glossary/#attention-sink), [Sink token](https://dmxsf.com/en/glossary/#sink-token)

### Span corruption

A denoising pre-training objective: about 15% of tokens are picked, each run of consecutive picked tokens is replaced by one unique sentinel, and the model outputs the dropped spans. T5 uses a mean span length of 3; the targets are shorter than with independent token corruption, so training is cheaper.

- Paper notes: [T5: Casting Every NLP Task as Text-to-Text and Systematically Comparing Transfer Learning's Knobs](https://dmxsf.com/en/blog/t5-exploring-the-limits-of-transfer-learning/)
- See also: [T5](https://dmxsf.com/en/glossary/#t5), [Encoder-decoder model](https://dmxsf.com/en/glossary/#encoder-decoder), [Next-token prediction](https://dmxsf.com/en/glossary/#next-token-prediction)

### Sparse autoencoder (SAE)

An autoencoder that encodes a model's activation into a wider, sparser vector and rebuilds it with a linear decoder, to split a superposed activation into feature directions. Sparsity comes from an L1 penalty or a TopK cut keeping the k largest activations. Low reconstruction error does not mean the true features were found, and metrics can be fooled by random models (Heap et al., 2025).

- Read the lesson: [Mechanistic Interpretability: Superposition, Sparse Autoencoders and Circuits](https://dmxsf.com/en/wiki/frontier/interpretability/)
- See also: [Superposition](https://dmxsf.com/en/glossary/#superposition), [Polysemanticity](https://dmxsf.com/en/glossary/#polysemanticity), [Dead latent](https://dmxsf.com/en/glossary/#dead-latent)

### Spearman–Brown formula

The prediction of a test's reliability after lengthening it n times: ρ_n = nρ/(1+(n−1)ρ); inverted, reaching a target reliability ρ_t takes ρ_t(1−ρ)/(ρ(1−ρ_t)) times as many items. Reliability depends on how spread out the test-takers are: with the same 100 items, a pool of widely spread models has reliability 0.853 and a pool of close models only 0.334.

- Also called: Test reliability
- Read the lesson: [Building Evaluation Sets: Question Sources, Label Quality and Item Information](https://dmxsf.com/en/wiki/evaluation/building-eval-sets/)
- See also: [Confidence interval](https://dmxsf.com/en/glossary/#confidence-interval), [Benchmark](https://dmxsf.com/en/glossary/#benchmark)

### Speculative decoding

A cheap draft model proposes several tokens at once and the large model verifies them in parallel, accepting the correct prefix. The output distribution is identical to using the large model alone, but generation is faster.

- Read the lesson: [Speculative Decoding: Draft with a Small Model, Verify with a Large One](https://dmxsf.com/en/wiki/inference/speculative-decoding/)
- Paper notes: [Fast Inference from Transformers via Speculative Decoding](https://dmxsf.com/en/blog/speculative-decoding-fast-inference-from-transformers/)
- See also: [Prefill and decode](https://dmxsf.com/en/glossary/#prefill-decode), [Memory-bound](https://dmxsf.com/en/glossary/#memory-bound), [Acceptance rate](https://dmxsf.com/en/glossary/#acceptance-rate), [Draft model](https://dmxsf.com/en/glossary/#draft-model)

### State space model (SSM)

A sequence model that processes input through a recurrence over a fixed-size hidden state, so the cost per step at inference does not depend on sequence length. Mamba adds an input-dependent selection mechanism.

- Read the lesson: [State Space Models and Hybrids: Trading the KV Cache for a Fixed-Size State](https://dmxsf.com/en/wiki/architecture/state-space-and-hybrid/)
- Paper notes: [Mamba: linear-time sequence modeling with selective state spaces](https://dmxsf.com/en/blog/mamba-linear-time-sequence-modeling-with-selective-state-spaces/)
- See also: [Mamba](https://dmxsf.com/en/glossary/#mamba), [Linear attention](https://dmxsf.com/en/glossary/#linear-attention), [Parallel scan](https://dmxsf.com/en/glossary/#parallel-scan), [Hybrid architecture](https://dmxsf.com/en/glossary/#hybrid-architecture)

### Stitching

An offline RL capability: combining good segments of several suboptimal trajectories into a policy better than any trajectory in the data. Q-learning has it because values propagate across states; methods that condition on whole-trajectory returns, such as Decision Transformer, usually lack it, and QDT adds it by relabeling returns with dynamic-programming results.

- Paper notes: [Decision Transformer: Reinforcement Learning as Conditional Sequence Modeling](https://dmxsf.com/en/blog/decision-transformer-reinforcement-learning-via-sequence-modeling/)
- See also: [Offline RL](https://dmxsf.com/en/glossary/#offline-rl), [Return-conditioned supervised learning](https://dmxsf.com/en/glossary/#rcsl), [Decision Transformer](https://dmxsf.com/en/glossary/#decision-transformer)

### Streamable HTTP

The remote transport of MCP: the client sends JSON-RPC messages by HTTP POST and the server answers with JSON or an event stream; introduced in the 2025-03-26 revision to replace HTTP+SSE. The 2026-07-28 revision drops sessions, requires MCP-Protocol-Version, mirrors method and tool names into Mcp-Method and Mcp-Name headers that the server must check, and requires Origin validation.

- Read the lesson: [MCP and the Tool Ecosystem: How It Works and What to Do When Tools Pile Up](https://dmxsf.com/en/wiki/applications/mcp-and-tool-ecosystem/)
- See also: [Model Context Protocol](https://dmxsf.com/en/glossary/#mcp), [JSON-RPC](https://dmxsf.com/en/glossary/#json-rpc)

### StreamingLLM

A KV-cache policy that needs no fine-tuning: always keep the first few tokens (4 in the paper, the attention sinks) plus a sliding window of recent tokens, evict the rest, and assign positions inside the cache. The size is fixed, so the model does not break on unbounded text, but what left the window is gone: it neither extends the context nor strengthens memory. Xiao et al., ICLR 2024.

- Also called: Rolling KV cache with sinks
- Read the lesson: [Long Context: Position Extrapolation, Training Recipes and Cost](https://dmxsf.com/en/wiki/architecture/long-context/)
- Paper notes: [StreamingLLM: Keep the First Few Tokens in the KV Cache and Sliding Windows Stop Breaking](https://dmxsf.com/en/blog/efficient-streaming-language-models-with-attention-sinks/)
- See also: [Attention sink](https://dmxsf.com/en/glossary/#attention-sink), [KV cache](https://dmxsf.com/en/glossary/#kv-cache), [Sliding-window attention](https://dmxsf.com/en/glossary/#sliding-window-attention), [SoftMax1](https://dmxsf.com/en/glossary/#softmax-off-by-one), [Sink token](https://dmxsf.com/en/glossary/#sink-token)

### Strided perplexity

How to score a text longer than the context window: slide overlapping windows over it and count only the tokens that are new in each window, using the rest as context. A smaller stride gives every token more context and a lower perplexity at a higher compute cost. This page uses a 1024 window and a stride of 512, so apart from the start every token has at least 512 tokens of context.

- Also called: Sliding-window perplexity
- Read the lesson: [From Language Modeling to Next-Token Prediction](https://dmxsf.com/en/wiki/foundations/next-token-prediction/)
- Paper notes: [GPT-1, GPT-2, GPT-3: From Fine-Tuning to In-Context Learning, Recomputed from the Papers](https://dmxsf.com/en/blog/gpt-series-evolution/)
- See also: [Perplexity](https://dmxsf.com/en/glossary/#perplexity), [Per-word perplexity](https://dmxsf.com/en/glossary/#per-word-perplexity), [Context window](https://dmxsf.com/en/glossary/#context-window)

### Strong-to-weak distillation

Training small models from a large teacher's outputs instead of running the full post-training recipe on each. Qwen3 first fine-tunes on teacher outputs (off-policy), then lets the student write its own responses and minimises the KL divergence to the teacher's logits (on-policy). For an 8B model the paper reports 1,800 GPU hours against 17,920 for reinforcement learning.

- Paper notes: [Qwen3 Technical Report: One Model, Two Modes, a Thinking Budget and Strong-to-Weak Distillation](https://dmxsf.com/en/blog/qwen3-technical-report/)
- See also: [Distillation](https://dmxsf.com/en/glossary/#distillation), [KL divergence](https://dmxsf.com/en/glossary/#kl-divergence), [Thinking mode](https://dmxsf.com/en/glossary/#thinking-mode)

### Structured output

Constraining a model's output to a JSON Schema or grammar, usually by constrained decoding that masks tokens which would break the format at every step.

- Read the lesson: [Structured Outputs and Function Calling: From JSON Mode to Constrained Decoding](https://dmxsf.com/en/wiki/applications/structured-output-and-function-calling/)
- See also: [Constrained decoding](https://dmxsf.com/en/glossary/#constrained-decoding), [JSON Schema](https://dmxsf.com/en/glossary/#json-schema), [JSON mode](https://dmxsf.com/en/glossary/#json-mode), [Function calling](https://dmxsf.com/en/glossary/#function-calling)

### Suffix array

The sorted array of the starting positions of all suffixes of a sequence. Identical substrings end up adjacent, so one linear scan finds every repeated span of at least a given length. Lee et al. (2022) used it to find verbatim repeats of 50 or more tokens in C4 (ExactSubstr), removing 7.18% of its tokens and catching duplicates that whole-document methods miss.

- Read the lesson: [Pretraining Data Engineering: Filtering, Deduplication and Mixing](https://dmxsf.com/en/wiki/pretraining/data-engineering/)
- See also: [Deduplication](https://dmxsf.com/en/glossary/#deduplication), [MinHash](https://dmxsf.com/en/glossary/#minhash)

### Superficial Alignment Hypothesis (SAH)

The hypothesis from the LIMA paper (Zhou et al., 2023) that almost all of a model's knowledge and ability comes from pretraining, and alignment mostly teaches the style and format of answering users, so a few carefully chosen examples suffice. It is a hypothesis, not a theorem: for tasks that need a new mapping, such as sorting sentences into dozens of custom classes, data size still matters.

- Read the lesson: [SFT Data: Construction and Quality Control](https://dmxsf.com/en/wiki/post-training/sft-data/)
- See also: [Supervised fine-tuning](https://dmxsf.com/en/glossary/#sft), [Instruction tuning](https://dmxsf.com/en/glossary/#instruction-tuning)

### Superposition

A network stores more features than it has dimensions by placing them in non-orthogonal directions. When features are sparse and rarely co-occur, the ReLU and bias filter out the interference, so storing extra features beats dropping them (Elhage et al., 2022). Single neurons then respond to several unrelated features, so the unit to analyse is the direction, not the neuron.

- Read the lesson: [Mechanistic Interpretability: Superposition, Sparse Autoencoders and Circuits](https://dmxsf.com/en/wiki/frontier/interpretability/)
- See also: [Polysemanticity](https://dmxsf.com/en/glossary/#polysemanticity), [Sparse autoencoder](https://dmxsf.com/en/glossary/#sparse-autoencoder)

### Supervised fine-tuning (SFT)

Continuing training on instruction and ideal-response pairs with the same next-token loss as pretraining (usually computed only on the response), so the model learns to follow instructions and chat formats.

- Read the lesson: [SFT Data: Construction and Quality Control](https://dmxsf.com/en/wiki/post-training/sft-data/)
- See also: [Instruction tuning](https://dmxsf.com/en/glossary/#instruction-tuning), [Fine-tuning](https://dmxsf.com/en/glossary/#fine-tuning), [Reinforcement learning from human feedback](https://dmxsf.com/en/glossary/#rlhf)

### SWA Bounded Replay

How DeepSeek-V4.1-Flash rebuilds sliding-window KV on a cache miss. Exact reconstruction of L layers needs L×n_win replayed tokens (40×128=5,120 here); Bounded Replay replays only the last 128 and truncates the window to that segment, giving an approximate state that depends on where the cache hits. In return the sliding-window KV leaves the persistent cache. The paper gives no ablation.

- Paper notes: [DeepSeek-V4.1-Flash: Getting the Global KV Cache Down to 890 Bytes per Token](https://dmxsf.com/en/blog/deepseek-v41-flash-pushing-the-limits-of-kv-cache-compression/)
- See also: [Sliding-window attention](https://dmxsf.com/en/glossary/#sliding-window-attention), [KV cache](https://dmxsf.com/en/glossary/#kv-cache), [Causal encoder-decoder](https://dmxsf.com/en/glossary/#causal-encoder-decoder)

### SwiGLU

A gated FFN activation: SwiGLU(x) = (Swish(xW₁) ⊙ xW₃)W₂. It outperforms a plain ReLU or GELU FFN and is used by Llama, Qwen and others.

- Read the lesson: [Modern LLM Architecture: From GPT-2 to Llama, Qwen and DeepSeek](https://dmxsf.com/en/wiki/architecture/modern-llm-architecture/)
- See also: [Feed-forward network](https://dmxsf.com/en/glossary/#ffn)

### Switch layer

The mixture-of-experts layer of the Switch Transformer: the router picks exactly one expert per token (top-1), and the output is that expert's output times the probability the router gave it, so the router stays differentiable. It needs less routing computation and communication than top-2 routing.

- Also called: Top-1 routing
- Read the lesson: [Mixture of Experts (MoE): Routing, Load Balancing and Sparse Activation](https://dmxsf.com/en/wiki/architecture/mixture-of-experts/)
- Paper notes: [Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity](https://dmxsf.com/en/blog/switch-transformers-scaling-to-trillion-parameter-models/)
- See also: [Mixture of Experts](https://dmxsf.com/en/glossary/#moe), [Router](https://dmxsf.com/en/glossary/#router), [Capacity factor](https://dmxsf.com/en/glossary/#capacity-factor), [Token dropping](https://dmxsf.com/en/glossary/#token-dropping)

### symlog transform

symlog(x) = sign(x)·ln(|x|+1) is close to the identity near zero and compresses large values logarithmically while keeping the sign; its inverse is symexp(x) = sign(x)·(e^|x| − 1). DreamerV3 uses it on vector observations and regression targets so the network need not care about scale and large targets do not produce huge gradients.

- Also called: symlog, symexp
- Paper notes: [DreamerV3: One Set of Hyperparameters for 150+ Tasks with a World-Model Agent](https://dmxsf.com/en/blog/dreamerv3-mastering-diverse-domains-through-world-models/)
- See also: [Twohot encoding](https://dmxsf.com/en/glossary/#twohot-encoding), [Return normalization](https://dmxsf.com/en/glossary/#return-normalization)

### Synthetic data

Data generated by a model or a program and then used to train a model: a stronger model's answers, problems a model sets and solves itself, programmatic problems with known answers, rewritten web pages. It adds information only through an outside filter (verifier, stronger teacher, human selection), fresh real data or inductive bias; otherwise it is a noisy copy of the model's own distribution.

- Read the lesson: [Synthetic Data and Self-Improvement: When Models Make Data, and When It Collapses](https://dmxsf.com/en/wiki/frontier/synthetic-data-and-self-improvement/)
- See also: [Self-training](https://dmxsf.com/en/glossary/#self-training), [Model collapse](https://dmxsf.com/en/glossary/#model-collapse), [Distillation](https://dmxsf.com/en/glossary/#distillation), [Rejection sampling fine-tuning](https://dmxsf.com/en/glossary/#rejection-sampling-finetuning), [Data mixture](https://dmxsf.com/en/glossary/#data-mixture)

## T

### T5

Google's family of encoder-decoder models (60M to 11B parameters): every NLP task is cast as text in, text out; the models are pre-trained on the C4 corpus with a span-corruption objective and then fine-tuned on each task.

- Also called: Text-to-Text Transfer Transformer
- Paper notes: [T5: Casting Every NLP Task as Text-to-Text and Systematically Comparing Transfer Learning's Knobs](https://dmxsf.com/en/blog/t5-exploring-the-limits-of-transfer-learning/)
- See also: [Encoder-decoder model](https://dmxsf.com/en/glossary/#encoder-decoder), [Span corruption](https://dmxsf.com/en/glossary/#span-corruption), [Instruction tuning](https://dmxsf.com/en/glossary/#instruction-tuning)

### Temperature

A sampling parameter T that divides the logits before the softmax. T below 1 sharpens the distribution and makes output more deterministic, T above 1 flattens it and adds variety, and T approaching 0 is greedy decoding.

- Read the lesson: [Decoding and Sampling: Temperature, Top-k, Top-p and Beam Search](https://dmxsf.com/en/wiki/inference/decoding-and-sampling/)
- See also: [Logits](https://dmxsf.com/en/glossary/#logits), [Top-k sampling](https://dmxsf.com/en/glossary/#top-k), [Top-p (nucleus) sampling](https://dmxsf.com/en/glossary/#top-p), [Greedy decoding](https://dmxsf.com/en/glossary/#greedy-decoding)

### Temperature scaling

The simplest post-hoc calibration method: fit a single scalar T on a validation set, divide the logits by T before the softmax, and minimize negative log-likelihood. It leaves the argmax unchanged, so accuracy is unaffected and only the confidence changes; Guo et al. (2017) used it to correct the overconfidence of modern neural networks.

- Read the lesson: [Hallucination and Calibration: Why Models Sound Sure and Are Wrong](https://dmxsf.com/en/wiki/safety/hallucination-and-calibration/)
- See also: [Calibration](https://dmxsf.com/en/glossary/#calibration), [Temperature](https://dmxsf.com/en/glossary/#temperature), [Softmax](https://dmxsf.com/en/glossary/#softmax)

### Tensor Core

A hardware unit in NVIDIA GPUs dedicated to multiply-accumulate on small matrix tiles, supporting low-precision formats such as FP16, BF16 and FP8, with far higher throughput than the general FP32 units. Almost all matrix multiplications in LLM training and inference run on tensor cores, which is why low-precision formats buy speed.

- Read the lesson: [GPUs and the Roofline Model: Why Big Models Are Bound by Memory Bandwidth](https://dmxsf.com/en/wiki/systems/gpu-and-roofline/)
- See also: [Roofline model](https://dmxsf.com/en/glossary/#roofline-model), [BF16](https://dmxsf.com/en/glossary/#bf16), [FP8 training](https://dmxsf.com/en/glossary/#fp8-training)

### Tensor parallelism

Splitting the large matrices inside a layer across several devices that compute together. Communication is frequent, so it is usually confined to devices with fast interconnect inside one machine.

- Read the lesson: [Distributed Training: Data, Tensor and Pipeline Parallelism](https://dmxsf.com/en/wiki/pretraining/distributed-training/)
- See also: [Data parallelism](https://dmxsf.com/en/glossary/#data-parallelism), [Pipeline parallelism](https://dmxsf.com/en/glossary/#pipeline-parallelism)

### Tensor shape

The lengths of a tensor along its axes. Shapes describe sizes, while axis meanings determine whether indexing or reduction is appropriate.

- Read the lesson: [Python and tensor shapes: from a table to a linear layer](https://dmxsf.com/en/wiki/foundations/tensors-and-shapes/)

### Test-time compute

Spending more computation at inference (longer chains of thought, repeated sampling with voting, search) to get better results, as opposed to scaling up training.

- Read the lesson: [Test-Time Compute: Spending Compute on Inference](https://dmxsf.com/en/wiki/frontier/test-time-compute/)
- Paper notes: [Scaling LLM Test-Time Compute Optimally: Spending Inference Compute by Difficulty Can Beat a Bigger Model](https://dmxsf.com/en/blog/scaling-llm-test-time-compute-optimally-can-be-more-effective-than-scaling-model-parameters/)
- See also: [Reasoning model](https://dmxsf.com/en/glossary/#reasoning-model), [Chain of thought](https://dmxsf.com/en/glossary/#chain-of-thought)

### Thinking budget

A cap on the number of thinking tokens at inference time: when thinking reaches the threshold, the serving code stops it, inserts a fixed stop sentence and the end-of-thinking marker, and lets the model answer from its unfinished reasoning. The Qwen3 paper says this ability was not trained explicitly but emerged from thinking-mode fusion. It trades latency for accuracy.

- Paper notes: [Qwen3 Technical Report: One Model, Two Modes, a Thinking Budget and Strong-to-Weak Distillation](https://dmxsf.com/en/blog/qwen3-technical-report/)
- See also: [Thinking mode](https://dmxsf.com/en/glossary/#thinking-mode), [Test-time compute](https://dmxsf.com/en/glossary/#test-time-compute), [Reasoning model](https://dmxsf.com/en/glossary/#reasoning-model)

### Thinking mode

Letting one model decide whether to write a long chain of thought before it answers. In thinking mode it reasons inside a think block and then answers; in non-thinking mode the chat template opens the reply with an empty think block. Qwen3 switches with the template argument enable_thinking (hard) and /think or /no_think in the user message (soft, the last flag wins).

- Also called: Hybrid thinking
- Paper notes: [Qwen3 Technical Report: One Model, Two Modes, a Thinking Budget and Strong-to-Weak Distillation](https://dmxsf.com/en/blog/qwen3-technical-report/)
- See also: [Reasoning model](https://dmxsf.com/en/glossary/#reasoning-model), [Thinking budget](https://dmxsf.com/en/glossary/#thinking-budget), [Chain of thought](https://dmxsf.com/en/glossary/#chain-of-thought), [Test-time compute](https://dmxsf.com/en/glossary/#test-time-compute)

### Throughput

The number of tokens generated (or requests handled) per unit of time. It usually trades off against the latency of an individual request.

- Read the lesson: [LLM Inference Serving: Latency Metrics, Measuring, and Choosing an Engine](https://dmxsf.com/en/wiki/inference/serving/)
- See also: [Time to first token](https://dmxsf.com/en/glossary/#ttft), [Continuous batching](https://dmxsf.com/en/glossary/#continuous-batching)

### Time per output token (TPOT)

The time between two consecutive output tokens, which decides how smoothly the text streams. End-to-end latency is the time to first token plus N−1 of these intervals. A larger batch makes every step slower and the interval longer.

- Also called: ITL, Inter-token latency
- Read the lesson: [LLM Inference Serving: Latency Metrics, Measuring, and Choosing an Engine](https://dmxsf.com/en/wiki/inference/serving/)
- See also: [Time to first token](https://dmxsf.com/en/glossary/#ttft), [Throughput](https://dmxsf.com/en/glossary/#throughput), [Prefill and decode](https://dmxsf.com/en/glossary/#prefill-decode)

### Time to first token (TTFT)

The time from sending a request to receiving the first output token, determined mainly by queueing and prefill.

- Read the lesson: [LLM Inference Serving: Latency Metrics, Measuring, and Choosing an Engine](https://dmxsf.com/en/wiki/inference/serving/)
- See also: [Prefill and decode](https://dmxsf.com/en/glossary/#prefill-decode), [Throughput](https://dmxsf.com/en/glossary/#throughput)

### Token

The unit of text a model reads and writes: a piece produced by the tokenizer (a word, part of a word, a character or a byte), identified by an integer id in the vocabulary.

- Read the lesson: [Tokenizers and Embeddings: BPE, Vocabulary Size and the Embedding Table](https://dmxsf.com/en/wiki/foundations/tokenizer-and-embeddings/)
- See also: [Tokenizer](https://dmxsf.com/en/glossary/#tokenizer), [Vocabulary](https://dmxsf.com/en/glossary/#vocabulary), [Context window](https://dmxsf.com/en/glossary/#context-window)

### Token dropping

When an expert of a mixture-of-experts model receives more tokens than its capacity, the extra tokens skip every expert in that layer and pass unchanged through the residual connection. The Switch Transformer reports that typically under 1% of tokens are dropped in training.

- Also called: Expert overflow
- Read the lesson: [Mixture of Experts (MoE): Routing, Load Balancing and Sparse Activation](https://dmxsf.com/en/wiki/architecture/mixture-of-experts/)
- Paper notes: [Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity](https://dmxsf.com/en/blog/switch-transformers-scaling-to-trillion-parameter-models/)
- See also: [Capacity factor](https://dmxsf.com/en/glossary/#capacity-factor), [Expert load balancing](https://dmxsf.com/en/glossary/#load-balancing), [Residual connection](https://dmxsf.com/en/glossary/#residual-connection)

### Token passthrough

An MCP server accepting an access token from the client that was not issued to the server itself and forwarding it unchanged to a downstream API. It bypasses audience checks, rate limits and auditing, so the downstream cannot tell who is really calling. The specification forbids it: a server may accept only tokens explicitly issued to it.

- Read the lesson: [MCP and the Tool Ecosystem: How It Works and What to Do When Tools Pile Up](https://dmxsf.com/en/wiki/applications/mcp-and-tool-ecosystem/)
- See also: [Model Context Protocol](https://dmxsf.com/en/glossary/#mcp), [Confused deputy](https://dmxsf.com/en/glossary/#confused-deputy)

### Tokenizer

The component that splits text into tokens, maps them to integer ids and converts ids back to text. Common algorithms are BPE, WordPiece and Unigram.

- Read the lesson: [Tokenizers and Embeddings: BPE, Vocabulary Size and the Embedding Table](https://dmxsf.com/en/wiki/foundations/tokenizer-and-embeddings/)
- See also: [Token](https://dmxsf.com/en/glossary/#token), [Byte-pair encoding](https://dmxsf.com/en/glossary/#bpe), [Vocabulary](https://dmxsf.com/en/glossary/#vocabulary)

### Toolformer

A self-supervised tool-learning method from Meta AI and collaborators (2023): the 6.7B-parameter GPT-J writes API calls into ordinary text, the calls are executed, only those whose result clearly lowers the weighted cross entropy of the next tokens are kept, and the model is fine-tuned on the kept text. Tools: calculator, question answering, Wikipedia search, translation, calendar.

- Read the lesson: [Structured Outputs and Function Calling: From JSON Mode to Constrained Decoding](https://dmxsf.com/en/wiki/applications/structured-output-and-function-calling/)
- Paper notes: [Toolformer: Scoring Tool Calls by How Much They Cut the Loss, So a Language Model Learns When to Ask for Help](https://dmxsf.com/en/blog/toolformer-self-supervised-tool-use-for-language-models/)
- See also: [Function calling](https://dmxsf.com/en/glossary/#function-calling), [ReAct](https://dmxsf.com/en/glossary/#react), [Toolformer filter](https://dmxsf.com/en/glossary/#toolformer-filter)

### Toolformer filter

How Toolformer chooses which sampled API calls to keep: L+ is the weighted cross entropy of the next five tokens with the call and its result placed before the text; L- is the smaller of the losses with no call and with the call but no result. A call is kept only if L- minus L+ reaches a threshold. The rule is relative to the model being fine-tuned.

- Paper notes: [Toolformer: Scoring Tool Calls by How Much They Cut the Loss, So a Language Model Learns When to Ask for Help](https://dmxsf.com/en/blog/toolformer-self-supervised-tool-use-for-language-models/)
- See also: [Toolformer](https://dmxsf.com/en/glossary/#toolformer), [Cross-entropy](https://dmxsf.com/en/glossary/#cross-entropy), [Perplexity](https://dmxsf.com/en/glossary/#perplexity)

### Top-k sampling

Keeping only the k most probable candidates, renormalizing and sampling from them, which cuts off the unreliable long tail.

- Read the lesson: [Decoding and Sampling: Temperature, Top-k, Top-p and Beam Search](https://dmxsf.com/en/wiki/inference/decoding-and-sampling/)
- See also: [Top-p (nucleus) sampling](https://dmxsf.com/en/glossary/#top-p), [Temperature](https://dmxsf.com/en/glossary/#temperature)

### Top-p (nucleus) sampling

Sampling from the smallest set of candidates whose cumulative probability reaches p, so the number of candidates adapts to how peaked the distribution is. Proposed by Holtzman et al. in 2019.

- Read the lesson: [Decoding and Sampling: Temperature, Top-k, Top-p and Beam Search](https://dmxsf.com/en/wiki/inference/decoding-and-sampling/)
- See also: [Top-k sampling](https://dmxsf.com/en/glossary/#top-k), [Temperature](https://dmxsf.com/en/glossary/#temperature)

### Training data extraction

An attacker recovering passages of the training set by querying the model alone. Carlini et al. (2020) extracted hundreds of verbatim sequences from GPT-2, including phone numbers and emails, each present in one training document; the divergence attack of Nasr et al. (2023) made ChatGPT emit training data at a rate 150 times higher than normal.

- Also called: Extraction attack
- Read the lesson: [Memorization and Privacy: What Models Remember, How to Measure and Reduce It](https://dmxsf.com/en/wiki/safety/memorization-and-privacy/)
- See also: [Memorization](https://dmxsf.com/en/glossary/#memorization), [Membership inference](https://dmxsf.com/en/glossary/#membership-inference), [Extractable memorization](https://dmxsf.com/en/glossary/#extractable-memorization)

### Transformer

A neural network architecture built around attention, stacked with residual connections and normalization. Introduced by Vaswani et al. in the 2017 paper "Attention Is All You Need", it underlies almost every modern LLM.

- Read the lesson: [Attention Basics: How a Transformer Reads Context](https://dmxsf.com/en/wiki/architecture/attention-basics/)
- Paper notes: [Attention Is All You Need: the Transformer, with self-attention instead of recurrence and convolution](https://dmxsf.com/en/blog/attention-is-all-you-need/)
- See also: [Self-attention](https://dmxsf.com/en/glossary/#self-attention), [Decoder-only model](https://dmxsf.com/en/glossary/#decoder-only), [Encoder-decoder model](https://dmxsf.com/en/glossary/#encoder-decoder)

### Trust region policy optimization (TRPO)

A policy optimization algorithm (Schulman et al., 2015) that requires the KL between the new and old policy to stay below a threshold δ at every update, so one step cannot overshoot and wreck performance. Solving the constraint takes an approximate second-order method (conjugate gradient); PPO replaced it with a clipped objective that needs only first-order optimization.

- Read the lesson: [Reinforcement Learning Basics: Policy Gradients, Advantages and PPO](https://dmxsf.com/en/wiki/post-training/rl-fundamentals/)
- See also: [Proximal policy optimization](https://dmxsf.com/en/glossary/#ppo), [KL divergence](https://dmxsf.com/en/glossary/#kl-divergence)

### Twohot encoding

Encodes a continuous scalar as a soft label over bins: only the two nearest bins are non-zero, with weights linear in distance that sum to 1. DreamerV3's reward head and critic output a softmax over exponentially spaced bins, trained with cross-entropy and read out as the expectation, so gradient size does not depend on target magnitude and multimodal random targets fit.

- Also called: symexp twohot loss
- Paper notes: [DreamerV3: One Set of Hyperparameters for 150+ Tasks with a World-Model Agent](https://dmxsf.com/en/blog/dreamerv3-mastering-diverse-domains-through-world-models/)
- See also: [symlog transform](https://dmxsf.com/en/glossary/#symlog), [Cross-entropy](https://dmxsf.com/en/glossary/#cross-entropy), [Softmax](https://dmxsf.com/en/glossary/#softmax)

### Typographic attack

Writing a word on an image so that an image classifier switches to the class that word names. CLIP can read text inside images, and the text often outweighs the picture in its representation, so a note naming another class is enough to make it answer wrongly. OpenAI's 2021 article Multimodal Neurons in Artificial Neural Networks demonstrated and named the phenomenon.

- Read the lesson: [Multimodal LLMs: How an Image Becomes Tokens](https://dmxsf.com/en/wiki/multimodal/multimodal-llms/)
- Paper notes: [CLIP: Contrastive Learning on 400 Million Image-Text Pairs, and a Classifier You Define in One Sentence](https://dmxsf.com/en/blog/clip-learning-transferable-visual-models/)
- See also: [CLIP](https://dmxsf.com/en/glossary/#clip), [Zero-shot](https://dmxsf.com/en/glossary/#zero-shot)

## U

### U-Net

A pixel-prediction network with contracting and expanding paths joined by skip connections. High-resolution features restore spatial detail in segmentation and diffusion backbones.

- Paper notes: [U-Net: Contracting and expanding paths with skip connections](https://dmxsf.com/en/blog/u-net-convolutional-networks-for-biomedical-image-segmentation/)

## V

### Value function

V(s): the return expected from state s (the prompt plus the prefix generated so far) when the current policy keeps going. A neural network that fits it is the critic. PPO uses it as a baseline and for GAE, at the cost of one more model as large as the policy; GRPO and RLOO use the rewards of the other responses in the group instead.

- Also called: Critic
- Read the lesson: [Reinforcement Learning Basics: Policy Gradients, Advantages and PPO](https://dmxsf.com/en/wiki/post-training/rl-fundamentals/)
- See also: [Advantage](https://dmxsf.com/en/glossary/#advantage), [Generalized advantage estimation](https://dmxsf.com/en/glossary/#gae), [Proximal policy optimization](https://dmxsf.com/en/glossary/#ppo), [Group relative policy optimization](https://dmxsf.com/en/glossary/#grpo)

### Vanishing gradient

Backpropagation multiplies the Jacobians of many layers (or many time steps); if their norms are below 1 the gradient decays exponentially and early layers learn almost nothing, and if above 1 it explodes. Residual connections, gating, normalization and good initialization fight vanishing gradients; gradient clipping mainly handles explosion.

- Also called: Exploding gradient
- Read the lesson: [From RNNs to Attention: Why the Transformer Appeared](https://dmxsf.com/en/wiki/architecture/from-rnn-to-attention/)
- See also: [Recurrent neural network](https://dmxsf.com/en/glossary/#rnn), [Long short-term memory](https://dmxsf.com/en/glossary/#lstm), [Residual connection](https://dmxsf.com/en/glossary/#residual-connection), [Gradient clipping](https://dmxsf.com/en/glossary/#gradient-clipping)

### Variational autoencoder (VAE)

A generative model that encodes an input into the mean and variance of a Gaussian, samples a latent from it and decodes it back; the loss is the reconstruction error plus a KL term that keeps the posterior close to a prior. The resulting low-dimensional latent is smooth and continuous, and is often used as a compressed representation for other models.

- Paper notes: [World Models: Compress the World into a Generative Model and Let the Agent Train in Its Own Dream](https://dmxsf.com/en/blog/world-models-ha-schmidhuber/)
- See also: [KL divergence](https://dmxsf.com/en/glossary/#kl-divergence)

### Variational autoencoder

A latent-variable generative model trained with an approximate posterior encoder, a decoder and the ELBO. Reparameterization makes random sampling differentiable.

- Paper notes: [VAE: Reparameterized variational inference for generative modeling](https://dmxsf.com/en/blog/auto-encoding-variational-bayes/)

### Vector database

A database that stores embedding vectors and supports approximate nearest-neighbor (ANN) search, a common retrieval backend for RAG.

- Read the lesson: [RAG in Practice: Chunking, Hybrid Retrieval, Reranking and Evaluation](https://dmxsf.com/en/wiki/applications/rag/)
- See also: [Retrieval-augmented generation](https://dmxsf.com/en/glossary/#rag), [Embedding](https://dmxsf.com/en/glossary/#embedding)

### Vision Transformer (ViT)

A model that cuts an image into fixed-size patches, flattens and linearly maps each patch to a vector, and feeds these as tokens to a Transformer. The number of patches is (H/P)(W/P), and the cost of self-attention grows with its square. Most vision-language models use a ViT as the vision encoder.

- Read the lesson: [Multimodal LLMs: How an Image Becomes Tokens](https://dmxsf.com/en/wiki/multimodal/multimodal-llms/)
- Paper notes: [ViT: An Image Is Worth 16x16 Words, Fed Straight to a Transformer](https://dmxsf.com/en/blog/vit-an-image-is-worth-16x16-words/)
- See also: [Visual token](https://dmxsf.com/en/glossary/#visual-token), [Transformer](https://dmxsf.com/en/glossary/#transformer), [CLIP](https://dmxsf.com/en/glossary/#clip)

### Vision-language model (VLM)

A model that understands images and text together, usually made of a vision encoder, a connector and a language model; LLaVA is a typical example.

- Read the lesson: [Multimodal LLMs: How an Image Becomes Tokens](https://dmxsf.com/en/wiki/multimodal/multimodal-llms/)
- Paper notes: [LLaVA: Text-Only GPT-4 Writes 158K Visual Instructions and a Language Model Learns to See](https://dmxsf.com/en/blog/llava-visual-instruction-tuning/)
- See also: [CLIP](https://dmxsf.com/en/glossary/#clip), [Cross-attention](https://dmxsf.com/en/glossary/#cross-attention)

### Vision-language-action model (VLA)

A vision-language model that outputs robot actions directly: camera images and a text instruction go in, actions come out. RT-2 discretizes actions into tokens fine-tuned together with web image-text data; later models use continuous action heads (diffusion or flow matching). A VLA inherits the semantic knowledge of its vision-language model but gains no motions absent from its training data.

- Paper notes: [RT-2: Transferring Web Knowledge to Robot Control with a Vision-Language-Action Model](https://dmxsf.com/en/blog/rt-2-vision-language-action-models-transfer-web-knowledge-to-robotic-control/)
- See also: [Vision-language model](https://dmxsf.com/en/glossary/#vlm), [Action tokenization](https://dmxsf.com/en/glossary/#action-tokenization), [Behavior cloning](https://dmxsf.com/en/glossary/#behavior-cloning)

### Visual instruction tuning

Fine-tuning a multimodal model on (image, instruction, response) triples so that it does what the user asks about an image instead of just describing it. LLaVA's recipe: write each COCO image as captions plus bounding boxes, have the text-only GPT-4 generate 158K conversation, detailed-description and complex-reasoning samples, and tune the language model together with the projector.

- Read the lesson: [Multimodal LLMs: How an Image Becomes Tokens](https://dmxsf.com/en/wiki/multimodal/multimodal-llms/)
- Paper notes: [LLaVA: Text-Only GPT-4 Writes 158K Visual Instructions and a Language Model Learns to See](https://dmxsf.com/en/blog/llava-visual-instruction-tuning/)
- See also: [Instruction tuning](https://dmxsf.com/en/glossary/#instruction-tuning), [Vision-language model](https://dmxsf.com/en/glossary/#vlm), [Projector](https://dmxsf.com/en/glossary/#projector), [CLIP](https://dmxsf.com/en/glossary/#clip)

### Visual token

The vectors that enter the language model after an image has passed through the vision encoder, merging and projection. Like text tokens they occupy the context window and the KV cache, and their number grows with the image resolution.

- Also called: Image token
- Read the lesson: [Multimodal LLMs: How an Image Becomes Tokens](https://dmxsf.com/en/wiki/multimodal/multimodal-llms/)
- See also: [Vision Transformer](https://dmxsf.com/en/glossary/#vit), [Projector](https://dmxsf.com/en/glossary/#projector), [KV cache](https://dmxsf.com/en/glossary/#kv-cache), [Context window](https://dmxsf.com/en/glossary/#context-window)

### Vocabulary

The full set of tokens a tokenizer knows, with their ids. Its size sets the size of the embedding matrix and the output layer; modern models use tens of thousands to a few hundred thousand entries.

- See also: [Token](https://dmxsf.com/en/glossary/#token), [Tokenizer](https://dmxsf.com/en/glossary/#tokenizer), [Embedding](https://dmxsf.com/en/glossary/#embedding)

## W

### WebText

GPT-2's training corpus: pages linked from Reddit posts that received at least 3 karma (about 45 million links), with text extracted, de-duplicated, heuristically cleaned, and all Wikipedia documents removed. The preliminary version used in the paper has no links created after December 2017 and holds slightly over 8 million documents, 40 GB of text. Karma stands in for human curation of quality.

- Read the lesson: [The LLM Training Pipeline: From Data to Deployment](https://dmxsf.com/en/wiki/pretraining/training-pipeline/)
- Paper notes: [GPT-1, GPT-2, GPT-3: From Fine-Tuning to In-Context Learning, Recomputed from the Papers](https://dmxsf.com/en/blog/gpt-series-evolution/)
- See also: [Generative Pre-trained Transformer](https://dmxsf.com/en/glossary/#gpt), [Byte-pair encoding](https://dmxsf.com/en/glossary/#bpe), [Benchmark contamination](https://dmxsf.com/en/glossary/#contamination)

### WordPiece

A subword segmentation algorithm that grows the vocabulary from characters, at each step merging the pair that raises the language-model likelihood of the training corpus the most (BPE merges by frequency instead). Pieces that do not start a word carry a ## prefix, so playing becomes play and ##ing. BERT uses a WordPiece vocabulary of about 30,000 entries.

- Read the lesson: [Tokenizers and Embeddings: BPE, Vocabulary Size and the Embedding Table](https://dmxsf.com/en/wiki/foundations/tokenizer-and-embeddings/)
- Paper notes: [BERT: pre-training a bidirectional Transformer by filling in masked words, then one thin output layer per task](https://dmxsf.com/en/blog/bert-pre-training-of-deep-bidirectional-transformers/)
- See also: [Byte-pair encoding](https://dmxsf.com/en/glossary/#bpe), [Tokenizer](https://dmxsf.com/en/glossary/#tokenizer), [BERT](https://dmxsf.com/en/glossary/#bert)

### World model

A learned predictive model of how an environment evolves under actions: given the current observation (often compressed into a latent) and an action, it predicts the next observation, reward or termination. An agent can plan or train a policy in imagination with fewer real interactions; the risk is that the policy exploits the model's errors and scores well in imagination but fails in reality.

- Read the lesson: [World models and planning: from prediction to closed-loop control](https://dmxsf.com/en/wiki/multimodal/world-models/)
- Paper notes: [World Models: Compress the World into a Generative Model and Let the Agent Train in Its Own Dream](https://dmxsf.com/en/blog/world-models-ha-schmidhuber/)

## X

### Xavier initialization

Setting the initial weight variance from a layer's input and output sizes (2/(fan_in+fan_out)) so that activation and gradient variance stay roughly constant across layers and a deep network does not start with vanishing or exploding gradients. Proposed by Glorot and Bengio (2010); He initialization for ReLU uses 2/fan_in.

- Also called: Glorot initialization
- Read the lesson: [Neural Network Basics: From Linear Layers to Backpropagation](https://dmxsf.com/en/wiki/foundations/neural-network-basics/)
- See also: [Backpropagation](https://dmxsf.com/en/glossary/#backpropagation), [Vanishing gradient](https://dmxsf.com/en/glossary/#vanishing-gradient)

## Y

### YaRN

A RoPE context-extension method that splits the dimension pairs by how many turns they make within the training length: fast pairs are kept, pairs with less than one turn are divided by the scale s, and those in between are blended linearly. It also scales the attention logits by 0.1·ln s + 1. Proposed by Peng et al. in 2023 and used by DeepSeek-V3 to reach a 128K window.

- Also called: Yet another RoPE extensioN
- Read the lesson: [Long Context: Position Extrapolation, Training Recipes and Cost](https://dmxsf.com/en/wiki/architecture/long-context/)
- Paper notes: [YaRN: Extending RoPE Models to a 128K Context Window with Light Fine-Tuning](https://dmxsf.com/en/blog/yarn-efficient-context-window-extension-of-large-language-models/)
- See also: [Position interpolation](https://dmxsf.com/en/glossary/#position-interpolation), [Rotary position embedding](https://dmxsf.com/en/glossary/#rope), [Context window](https://dmxsf.com/en/glossary/#context-window)

## Z

### ZeRO

A memory optimization for data parallelism from DeepSpeed: optimizer states, gradients and parameters are successively partitioned across devices instead of every device storing a full copy.

- Read the lesson: [Distributed Training: Data, Tensor and Pipeline Parallelism](https://dmxsf.com/en/wiki/pretraining/distributed-training/)
- Paper notes: [ZeRO: Partition the Model States Across GPUs So Data Parallelism Can Hold 100B+ Parameters](https://dmxsf.com/en/blog/zero-memory-optimizations-toward-training-trillion-parameter-models/)
- See also: [Data parallelism](https://dmxsf.com/en/glossary/#data-parallelism), [Mixed-precision training](https://dmxsf.com/en/glossary/#mixed-precision)

### Zero-order hold discretization

A rule that turns the continuous-time state space parameters (Δ, A, B) into discrete recurrence parameters by assuming the input stays constant during each step Δ: Ā = exp(ΔA) and B̄ = (ΔA)⁻¹(exp(ΔA) − I)·ΔB. Theorem 1 of the Mamba paper holds exactly under this rule (a selective SSM equals a gated RNN); the official code actually uses the simpler B̄ = ΔB, a first-order Euler approximation.

- Also called: ZOH
- Read the lesson: [State Space Models and Hybrids: Trading the KV Cache for a Fixed-Size State](https://dmxsf.com/en/wiki/architecture/state-space-and-hybrid/)
- Paper notes: [Mamba: linear-time sequence modeling with selective state spaces](https://dmxsf.com/en/blog/mamba-linear-time-sequence-modeling-with-selective-state-spaces/)
- See also: [State space model](https://dmxsf.com/en/glossary/#ssm), [Selection mechanism](https://dmxsf.com/en/glossary/#selection-mechanism)

### Zero-shot

Doing a task with no examples and no task-specific training. For instance, CLIP classifies an image by writing the class names as sentences and picking the one whose vector is closest to the image.

- Read the lesson: [Multimodal LLMs: How an Image Becomes Tokens](https://dmxsf.com/en/wiki/multimodal/multimodal-llms/)
- See also: [CLIP](https://dmxsf.com/en/glossary/#clip), [Few-shot prompting](https://dmxsf.com/en/glossary/#few-shot), [In-context learning](https://dmxsf.com/en/glossary/#in-context-learning)

### Zero-shot chain of thought

Adding just "Let's think step by step" after the question, with no exemplars, to trigger step-by-step reasoning (Kojima et al., 2022). The original recipe has two steps: first let the model write its reasoning, then use a second prompt to extract the final answer from it. It is usually weaker than a handwritten few-shot chain of thought, but it saves the cost of writing exemplars.

- Read the lesson: [Prompt Engineering: A Systematic Guide to Specs, Layers, Examples and Evaluation](https://dmxsf.com/en/wiki/applications/prompt-engineering/)
- Paper notes: [Chain-of-thought prompting: exemplars with intermediate steps let large models solve multi-step problems](https://dmxsf.com/en/blog/chain-of-thought-prompting/)
- See also: [Chain of thought](https://dmxsf.com/en/glossary/#chain-of-thought), [Zero-shot](https://dmxsf.com/en/glossary/#zero-shot), [Self-consistency](https://dmxsf.com/en/glossary/#self-consistency)
