Reference · working definitions

Words that do work.

Not marketing definitions. Each entry explains what the thing is and why it changes a decision. Search, filter, or jump from a lesson using the dotted terms in the prose.

122 terms8 categoriesLinked back to lessons
122 terms
Inference#inference

Inference

The process of running a trained model forward to produce an output. In LLMs, inference is usually split into prefill and decode.

Why it matters: Training makes the weights; inference is where latency, throughput and cost become real.

General#weights

Weights

The learned parameters of a neural network. Their number and precision determine how much memory the model needs.

Why it matters: Every decode step streams weights from memory, so weight size is a direct latency and cost input.

General#parameters

Parameters

The individual numbers inside a model — attention projections, MLP matrices, embeddings and norms.

Why it matters: Parameter count sets the baseline compute and memory footprint, but active parameters matter more for MoE.

Inference#token

Token

A chunk of text produced by a tokenizer. A token can be a word, part of a word, punctuation, or whitespace.

Why it matters: Models read and write tokens, not characters or words. Prices, context limits and latency are all token-based.

Inference#tokenizer

Tokenizer

The deterministic mapping between text and integer token IDs. Different models may use different vocabularies.

Why it matters: Tokenization affects prompt length, cost and how models see code, numbers and non-English text.

Inference#vocabulary

Vocabulary

The full set of tokens a model can recognize and emit, usually 32k–256k entries.

Why it matters: A larger vocabulary can shorten text but increases the output projection and can change model behavior.

Inference#prefill

Prefill

The phase that processes the entire prompt in parallel and fills the KV cache before the first output token.

Why it matters: Prefill is compute-bound and sets time-to-first-token. Long prompts make it expensive.

Inference#decode

Decode

The autoregressive phase that generates one token at a time, reusing the KV cache from prefill.

Why it matters: Decode is often memory-bandwidth-bound; its speed determines tokens per second and user-perceived fluency.

Inference#logits

Logits

Unnormalized scores over the vocabulary produced by the model before softmax.

Why it matters: Sampling and constrained decoding operate on logits. Their shape is one reason generation is expensive.

Inference#sampling

Sampling

Choosing the next token from a probability distribution instead of always taking the highest-scoring one.

Why it matters: Sampling controls creativity, determinism and safety. Greedy decoding is not the same as a reproducible system.

Inference#temperature

Temperature

A scaling factor on logits that makes the distribution sharper (low) or flatter (high).

Why it matters: Low temperature is not zero randomness, and high temperature does not guarantee quality. It changes the shape of the output distribution.

Inference#top-p

Top-p

Nucleus sampling: keep the smallest set of tokens whose cumulative probability reaches p, then sample from that set.

Why it matters: It removes the long tail without fixing the number of candidates. It is a common production default.

Inference#kv-cache

KV cache

Stored key and value tensors from attention, so the model does not recompute the whole prefix for every new token.

Why it matters: The cache makes long-context generation possible, but it consumes memory that otherwise could serve more concurrent users.

Inference#context-window

Context window

The maximum number of tokens a model can attend to at once, including prompt, history and generated output.

Why it matters: It is a budget, not a target. Long contexts increase latency, memory and attention cost, and models do not attend equally everywhere.

Serving#ttft

TTFT

Time to first token: the delay from request arrival to the first streamed output token.

Why it matters: TTFT is the latency users feel before anything appears. It includes queueing, tokenization and prefill.

Serving#tpot

TPOT

Time per output token: the average interval between generated tokens after the first one.

Why it matters: TPOT controls how fast text streams and how long a response takes overall.

Serving#itl

ITL

Inter-token latency: the time between consecutive tokens, including any scheduling gaps.

Why it matters: ITL captures jitter that average TPOT hides. A stream that pauses is worse than a consistently slower one.

Serving#latency

Latency

The time a single request takes from arrival to completion.

Why it matters: Optimizing average latency can hide a terrible tail. Production promises are usually made in percentiles.

Serving#throughput

Throughput

The number of tokens or requests completed per unit of time.

Why it matters: Throughput pays for the GPUs; latency wins the user. The two trade off through batching.

Serving#goodput

Goodput

The portion of throughput that actually meets the latency SLO. Work that finishes too late does not count.

Why it matters: A system can report high tokens per second while failing most users. Goodput is the honest capacity metric.

Serving#slo

SLO

A service-level objective: a measurable target such as “95% of requests under 800 ms TTFT”.

Why it matters: SLOs turn vague “fast” into a testable constraint for scheduling, capacity and cost.

Serving#batching

Batching

Grouping multiple requests into one model step so shared weights and kernels are reused.

Why it matters: Batching raises throughput but can raise latency. The scheduler decides who waits.

Serving#continuous-batching

Continuous batching

A scheduling strategy that admits new requests as slots free up, instead of waiting for a fixed batch to finish.

Why it matters: It keeps GPUs busy under real traffic and is a core feature of modern serving engines.

Serving#static-batching

Static batching

Forming a fixed batch, running it to completion, then forming the next one.

Why it matters: Simple but wasteful: short requests wait for long ones, and new arrivals wait for the whole batch.

Serving#scheduler

Scheduler

The component that decides which requests run, in what order, and when they enter prefill or decode.

Why it matters: Scheduling is where latency, fairness, memory and cost are traded every millisecond.

Serving#prefix-caching

Prefix caching

Reusing the KV cache for a shared prompt prefix across requests.

Why it matters: System prompts and few-shot examples are repeated constantly; caching them can cut prefill and cost dramatically.

Serving#radix-attention

RadixAttention

A prefix-cache design that stores shared prompt prefixes in a radix tree and reuses them across requests.

Why it matters: It makes cache hits an explicit scheduling concern and is central to SGLang’s design.

Serving#chunked-prefill

Chunked prefill

Splitting a long prompt into chunks that can be interleaved with decode steps.

Why it matters: It prevents one long prompt from blocking all other users and smooths out latency.

Serving#paged-attention

PagedAttention

Managing KV cache in fixed-size blocks with a block table, similar to virtual memory paging.

Why it matters: It reduces fragmentation and enables flexible sharing and preemption. It is the idea behind vLLM’s original scheduler.

Inference#speculative-decoding

Speculative decoding

A small draft model proposes several tokens, and the target model verifies them in parallel.

Why it matters: It can speed up memory-bound decode without changing the target model’s output distribution.

Inference#acceptance-rate

Acceptance rate

The fraction of drafted tokens accepted by the target model during speculative decoding.

Why it matters: The speedup depends on acceptance rate and draft cost; a plausible draft can still be a net loss.

Inference#constrained-decoding

Constrained decoding

Restricting the next-token distribution to satisfy a grammar, schema or allowed set.

Why it matters: It turns “please output JSON” into a guarantee at the decoder, at the cost of extra machinery and possible quality tradeoffs.

Inference#quantization

Quantization

Representing weights or activations with fewer bits, such as FP8 or INT4, to save memory and bandwidth.

Why it matters: It can make decode faster and fit larger models, but quality and speed depend on the method and workload.

Inference#fp8

FP8

An 8-bit floating-point format with enough range for many inference workloads.

Why it matters: It halves weight and KV memory versus BF16 and is supported on newer GPUs, but needs scaling and kernel support.

Inference#int4

INT4

A 4-bit integer format used for aggressive weight compression.

Why it matters: It can fit large models on small GPUs, but may hurt quality and does not automatically improve throughput.

Inference#awq

AWQ

Activation-aware weight quantization, which protects salient weights based on activation statistics.

Why it matters: It is a common 4-bit weight-only method for serving, balancing quality and memory.

Inference#gptq

GPTQ

A post-training quantization method that uses approximate second-order information to quantize weights.

Why it matters: It popularized 4-bit weight-only models and remains a baseline for quality/size tradeoffs.

Inference#kv-cache-quantization

KV cache quantization

Storing the KV cache in lower precision, such as FP8 or INT8, to serve more concurrent context.

Why it matters: KV memory often limits concurrency before weights do; quantizing it can be a large capacity win if quality holds.

Inference#distillation

Distillation

Training a smaller model to imitate a larger model’s outputs or distributions.

Why it matters: It can produce a cheaper, faster model for a narrow task, but it is a training project, not a serving flag.

Inference#pruning

Pruning

Removing weights, heads, layers or channels that contribute little to model output.

Why it matters: Unstructured pruning saves memory only with sparse kernels; structured pruning changes the architecture itself.

Inference#moe

Mixture of Experts

An architecture where each token is routed to a subset of expert MLPs instead of using all parameters.

Why it matters: MoE increases total capacity while keeping active compute per token lower, but introduces routing, load balance and all-to-all costs.

Inference#gqa

Grouped-query attention

Sharing key/value heads among groups of query heads, reducing KV cache size versus full multi-head attention.

Why it matters: GQA is a major reason modern long-context models are servable at reasonable concurrency.

Inference#mla

Multi-head latent attention

An attention variant that compresses keys and values into a latent representation before caching.

Why it matters: It reduces KV cache memory for very large models, but serving support and implementation details matter.

Inference#flash-attention

FlashAttention

An IO-aware attention kernel that tiles computation to avoid materializing the full attention matrix in high-bandwidth memory.

Why it matters: It makes attention faster and more memory-efficient, especially at long sequence lengths.

Inference#cuda-graphs

CUDA graphs

A captured sequence of GPU operations replayed with low CPU launch overhead.

Why it matters: Decode involves many tiny kernels; launch overhead can dominate unless the graph is captured.

Inference#kernel-fusion

Kernel fusion

Combining multiple GPU operations into one kernel to reduce memory traffic and launch overhead.

Why it matters: At decode time, the bottleneck is often data movement, not arithmetic; fusion reduces both.

Hardware#roofline

Roofline model

A performance model that bounds throughput by either compute peak or memory bandwidth, depending on arithmetic intensity.

Why it matters: It explains why some workloads are compute-bound (prefill) and others are memory-bound (decode).

Hardware#arithmetic-intensity

Arithmetic intensity

The ratio of floating-point operations to bytes moved for a kernel or workload.

Why it matters: It determines whether a GPU is limited by math or by memory bandwidth.

Hardware#memory-bandwidth

Memory bandwidth

The rate at which data can be read from and written to GPU memory, usually in TB/s.

Why it matters: Decode streams weights and KV cache every token; bandwidth is often the real ceiling.

Hardware#hbm

HBM

High-bandwidth memory stacked beside the GPU die, used for weights, activations and KV cache.

Why it matters: GPU capacity and bandwidth are HBM properties, and they set the serving envelope.

Hardware#sm

Streaming multiprocessor

A GPU’s core execution block, containing CUDA cores, tensor cores, registers and shared memory.

Why it matters: Kernel efficiency is about keeping SMs fed, not just counting them.

Hardware#pcie

PCIe

The general-purpose bus connecting GPUs, CPUs and devices.

Why it matters: It is much slower than NVLink. Moving tensors across PCIe can erase the benefit of more GPUs.

Serving#tensor-parallelism

Tensor parallelism

Splitting individual weight matrices across GPUs and combining partial results, usually with all-reduce.

Why it matters: It fits models too large for one GPU and reduces per-GPU compute, but adds communication on every layer.

Serving#pipeline-parallelism

Pipeline parallelism

Assigning different layers of a model to different GPUs and passing activations between stages.

Why it matters: It reduces per-GPU memory without all-reducing every layer, but creates pipeline bubbles and latency.

Serving#data-parallelism

Data parallelism

Replicating the model across GPUs or nodes and distributing independent requests.

Why it matters: It scales throughput for models that fit on one device, but does not help a model that does not fit.

Serving#expert-parallelism

Expert parallelism

Distributing MoE experts across GPUs and routing tokens to the devices that hold the selected experts.

Why it matters: It is necessary for large MoE models and introduces all-to-all communication and load balancing challenges.

Serving#disaggregated-serving

Disaggregated serving

Running prefill and decode on separate GPU pools with KV cache transferred between them.

Why it matters: It lets each phase use hardware and parallelism that fit its bottleneck, at the cost of KV transfer and complexity.

Serving#autoscaling

Autoscaling

Adding or removing serving capacity based on demand signals such as queue depth or tokens per second.

Why it matters: GPU cold starts are slow; scaling on CPU-style utilization often reacts too late.

Serving#cold-start

Cold start

The time to start a new model server, load weights and become ready to serve.

Why it matters: It can be minutes for large models, so autoscaling needs warm pools and load-balancing strategy.

Serving#serving-engine

Serving engine

The software that schedules requests, manages KV cache, runs kernels and exposes an API around a model.

Why it matters: vLLM, SGLang, TensorRT-LLM and others make different tradeoffs; the engine is a core architectural choice.

Serving#queueing

Queueing

Requests waiting for compute, memory or a scheduling slot.

Why it matters: Queue time is part of TTFT and grows nonlinearly as utilization approaches 100%.

Hardware#mfu

MFU

Model FLOPs utilization: the fraction of a GPU’s peak FLOPs actually achieved by a model.

Why it matters: It turns headline hardware specs into realistic prefill estimates. 30–50% is often more honest than 100%.

Hardware#mbu

MBU

Model bandwidth utilization: the fraction of peak memory bandwidth achieved during a workload.

Why it matters: Decode estimates are only as good as the bandwidth efficiency you assume.

Harness#harness

Harness

The runtime layer around a model that supplies tools, context, permissions, state, retries and stopping conditions.

Why it matters: The same model can be a chatbot or an autonomous agent depending on its harness.

Agents#agent

Agent

A system that observes an environment, decides on actions, uses tools and iterates toward a goal.

Why it matters: Agency is a property of the loop and permissions, not a special model checkpoint.

Agents#agent-loop

Agent loop

The repeated cycle of observing state, choosing an action, executing a tool and incorporating the result.

Why it matters: Most agent failures are loop failures: no progress, no verification, or no stop condition.

Agents#react

ReAct

A prompting and control pattern that interleaves reasoning traces with tool actions and observations.

Why it matters: It is a useful baseline, but reasoning text is not a guarantee of correct execution.

Agents#plan-execute

Plan-and-execute

An agent pattern that creates a plan first, then executes steps, optionally replanning when state changes.

Why it matters: It improves long-task structure but can become brittle if the plan is never revised.

Agents#tool-call

Tool call

A structured request from the model to run an external function with typed arguments.

Why it matters: Tools are the agent’s hands. Their schemas, errors and permissions shape what it can do safely.

Agents#tool-schema

Tool schema

The name, description, parameters and constraints that tell a model how to call a tool.

Why it matters: A vague schema produces vague calls. Error messages are part of the interface, too.

Agents#mcp

MCP

Model Context Protocol: an open protocol for exposing tools, resources and prompts to AI applications.

Why it matters: It standardizes integrations, but does not remove the need for permissions, sandboxing and tool review.

Harness#context-engineering

Context engineering

Designing what enters the model’s context, in what order, and what gets removed or summarized.

Why it matters: Context is the agent’s working memory. More text is not automatically better; relevance and structure matter.

Harness#compaction

Compaction

Reducing long conversation or tool history into a shorter summary while preserving the information needed to continue.

Why it matters: It buys context headroom but can silently delete constraints, so compaction policy is a correctness decision.

Harness#summarization

Summarization

Rewriting a longer history into a shorter representation, usually with a model or deterministic rules.

Why it matters: Summaries can be lossy. Pinned facts, decisions and unresolved errors should survive separately.

Harness#retrieval

Retrieval

Fetching relevant external information into context instead of keeping everything in the prompt.

Why it matters: It scales memory beyond the context window but introduces recall, freshness and ranking failures.

Agents#subagent

Subagent

A separate agent context invoked by a parent agent for a scoped task, returning a result.

Why it matters: It isolates context and parallelizes work, but adds handoff loss, cost and coordination overhead.

Agents#handoff

Handoff

Passing control and a compressed state summary from one agent or session to another.

Why it matters: Most multi-agent failures happen at the handoff: missing constraints, stale state or ambiguous ownership.

Harness#session

Session

A persistent conversation or task context with an identity, state and history.

Why it matters: Sessions turn one-shot calls into work that can be inspected, resumed and audited.

Harness#state

State

The durable facts an agent needs: files, tool results, decisions, pending approvals and progress.

Why it matters: If state lives only in the model’s context, a compaction or crash can erase the task.

Harness#checkpoint

Checkpoint

A saved snapshot of task state that can be resumed or inspected later.

Why it matters: Checkpoints make long-running agents recoverable and make failures reproducible.

Harness#event-log

Event log

An append-only record of actions, observations and decisions in a session.

Why it matters: It is the source of truth for replay, audit, evals and debugging — not just a transcript.

Safety#permission-mode

Permission mode

A policy that decides which tool actions run automatically, require approval, or are denied.

Why it matters: Autonomy should be granted per action and per scope, with a clear escalation path.

Safety#sandbox

Sandbox

An isolated execution environment that limits filesystem, network, process and secret access.

Why it matters: A model instruction is not a security boundary. The sandbox is.

Safety#approval

Approval

A human decision to allow a specific action or scope of actions.

Why it matters: Approvals reduce risk but add latency and fatigue; good design makes them rare, specific and informative.

Safety#human-in-the-loop

Human in the loop

A workflow where a person reviews or authorizes steps the agent cannot safely take alone.

Why it matters: It is a control, not a decoration. The human needs enough context to make a real decision.

Safety#prompt-injection

Prompt injection

Malicious or unintended instructions embedded in content the model reads, attempting to redirect its behavior.

Why it matters: Any tool output can carry instructions. Treat external text as data, not authority.

Safety#exfiltration

Exfiltration

Moving sensitive data out of an allowed boundary, intentionally or through a manipulated agent.

Why it matters: An agent with network and secret access can leak data even without a code vulnerability.

Safety#tool-poisoning

Tool poisoning

Malicious tool descriptions, metadata or outputs that influence the model to misuse a tool.

Why it matters: Tool registries are supply-chain surface. Review and pin what the agent can call.

Safety#least-privilege

Least privilege

Giving an agent the minimum access needed for the task, for the shortest time.

Why it matters: Broad credentials turn a small model mistake into a large incident.

Safety#allowlist

Allowlist

An explicit set of permitted commands, domains or tools; everything else is denied.

Why it matters: Allowlists are easier to reason about than blocklists, especially for shell and network access.

Evals#trace

Trace

A structured record of a request or task, usually composed of spans for model calls, tools, retries and approvals.

Why it matters: Without traces you can only see the final answer, not why the harness succeeded or failed.

Evals#span

Span

A timed operation inside a trace, such as one model call or one tool execution.

Why it matters: Spans expose where latency, cost and errors actually happen.

Evals#observability

Observability

The ability to understand a system’s internal behavior from its outputs: logs, metrics, traces and events.

Why it matters: Agent incidents are rarely reproducible from a single error message.

Evals#evals

Evals

Systematic tests that measure whether a model or harness meets a defined standard on a dataset of tasks.

Why it matters: Demos show possibility; evals show whether a change made the system better.

Evals#trajectory-eval

Trajectory eval

Evaluating the sequence of actions and observations an agent took, not only its final answer.

Why it matters: A correct answer from a dangerous or wasteful path is a latent failure.

Evals#outcome-eval

Outcome eval

Evaluating whether the final state or answer satisfies the task, independent of the path taken.

Why it matters: Outcome and trajectory evals answer different questions and should usually be paired.

Evals#llm-as-judge

LLM-as-judge

Using a model to score outputs against a rubric or reference.

Why it matters: It scales subjective evaluation but introduces bias, drift and prompt sensitivity. Calibrate it against humans.

Evals#regression-suite

Regression suite

A fixed set of tasks run after every change to catch previously solved failures from returning.

Why it matters: Harness changes are software changes; they need tests with stable expectations.

Harness#model-routing

Model routing

Sending each request or step to a model chosen for its cost, latency or capability.

Why it matters: Most agent steps do not need the strongest model; routing can dominate cost savings if evals keep quality honest.

Harness#token-budget

Token budget

A cap on input, output or total tokens for a task or step.

Why it matters: Budgets force prioritization and prevent a looping agent from spending indefinitely.

Harness#max-steps

Max steps

The maximum number of agent iterations or tool calls allowed before the harness stops.

Why it matters: It is a cheap, essential guardrail against loops and runaway cost.

Harness#retry

Retry

Running a failed operation again, ideally with feedback or a changed strategy.

Why it matters: Retries improve reliability only when the operation is safe to repeat and the failure is transient.

Harness#backoff

Backoff

Waiting progressively longer between retries to avoid overwhelming a failing service.

Why it matters: Immediate repeated retries turn a transient error into a retry storm.

Harness#idempotency

Idempotency

A property where repeating an operation has the same effect as running it once.

Why it matters: Retries and resumptions are only safe when tool calls are idempotent or keyed.

Harness#timeout

Timeout

A maximum time allowed for an operation before it is cancelled or treated as failed.

Why it matters: Without timeouts, a stuck tool can occupy a session indefinitely.

Harness#cancellation

Cancellation

Stopping an in-flight operation when it is no longer needed or has exceeded its budget.

Why it matters: Agents need a real stop button that propagates to tools, not just a UI spinner.

Harness#loop-detection

Loop detection

Detecting repeated actions or states that indicate the agent is stuck.

Why it matters: A loop can burn tokens and time while looking productive. Compare state, not just messages.

Harness#replay

Replay

Re-running a recorded trace with the same inputs and tool results to reproduce a failure.

Why it matters: Replay turns a one-off incident into a debuggable test case.

General#deterministic

Deterministic

Producing the same output for the same inputs and state.

Why it matters: LLM sampling is not deterministic by default, so harnesses need seeds, pinned versions and recorded tool outputs where possible.

Safety#guardrail

Guardrail

A constraint outside the model that blocks, modifies or flags dangerous behavior.

Why it matters: Guardrails must be enforceable in code and policy, not just requested in a prompt.

Harness#policy-layer

Policy layer

The harness component that decides what the agent may do, where, and under whose authority.

Why it matters: It separates capability from permission, which is the core safety architecture of an agent.

Harness#skill

Skill

A packaged instruction and resource set that an agent can load for a specific kind of task.

Why it matters: Skills are context engineering as a product feature: reusable expertise without permanent prompt bloat.

Harness#hook

Hook

A deterministic callback that runs before or after a tool action, model call or session event.

Why it matters: Hooks let a harness enforce policy, add telemetry or transform output without relying on the model.

Harness#plugin

Plugin

A packaged extension that adds tools, commands, providers or UI behavior to a harness.

Why it matters: Plugins expand the attack surface and the maintenance surface; version and permission them.

Safety#autonomy

Autonomy

The degree to which an agent can act without human approval.

Why it matters: Autonomy should be scoped per action and environment, not treated as a single on/off preference.

Harness#verification

Verification

Evidence that the task was completed correctly, such as tests, a diff review or a deterministic check.

Why it matters: An agent saying “done” is not verification. The harness needs an independent signal.

Harness#definition-of-done

Definition of done

The concrete conditions that must be true before an agent may stop: tests pass, docs updated, diff reviewed.

Why it matters: Stopping conditions shape behavior more than most prompt instructions.

Type at least two characters. Search is indexed after the production build.
Lessons · labs · glossary↑↓ to browse · esc to close