LLM Serving Mind Map: vLLM, TensorRT-LLM, SGLang, Triton, KV Cache, Quantisation, Speculative Decoding and EAGLE-3
How an LLM is served fast and cheap: engines, continuous batching, the KV cache, quantisation, speculative decoding with EAGLE-3, parallelism, prefill/decode split on Kubernetes and the metrics that prove it.
LLMs & VRAMGPU, Attention & Interconnects
SFT, RLHF & RLVR
LLM Serving & InferenceLLMOps
AI Gateways
Snowflake
Databricks
Serving engines
Who runs the model
- What it is
- The software that loads the weights onto the GPU, batches requests, manages the KV cache and streams tokens back. vLLM, TensorRT-LLM and SGLang are engines; Triton is a serving layer that can host engines as backends; llm-d orchestrates engine pods on Kubernetes.
- When to use it
- First question of any serving design: which engine, and which layer sits above it.
vLLM
The general default
- What it is
- Open-source engine built around PagedAttention, with continuous batching, chunked prefill, prefix caching, many quantisation formats, speculative decoding, tensor/pipeline/data/expert parallelism and an OpenAI-compatible API server. Runs on NVIDIA and AMD GPUs and several CPU families.
- When to use it
- First deployment of an open-weight model, mixed hardware, or when you need the broadest model support.
- In code
vllm serve <model> --tensor-parallel-size 2
TensorRT-LLM
NVIDIA peak speed
- What it is
- NVIDIA's open-source library for optimised LLM inference on NVIDIA GPUs, with a Python LLM API, in-flight batching, a paged KV cache with block reuse, FP8 (H100 and later) and FP4 (Blackwell), speculative decoding (EAGLE, MTP, n-gram) and tensor, pipeline and expert parallelism.
- When to use it
- An NVIDIA-only fleet where latency and cost per token justify the extra setup.
- In code
trtllm-serve <model>
SGLang
Prefix-heavy traffic
- What it is
- High-performance serving framework for language and multimodal models. Its RadixAttention keeps the KV cache of earlier requests in a radix tree so requests that share a prefix (system prompt, few-shot examples, agent history) reuse it automatically.
- When to use it
- Agents and chat with long shared system prompts; test it against vLLM with prefix caching.
- In code
python -m sglang.launch_server --model-path <model> --tp 2
Triton Inference Server
Many models, one server
- What it is
- NVIDIA's open-source serving layer: a model repository, HTTP/REST and gRPC endpoints (KServe protocol), dynamic batching, ensembles that chain models, and metrics. It delegates LLM execution to backends such as TensorRT-LLM (in-flight batching) or vLLM.
- When to use it
- One endpoint in front of several models or pipelines, classic ML and LLMs together.
llama.cpp and Ollama
Laptop and edge
- What it is
- Local runtimes for quantised GGUF models on CPUs, Apple Silicon and consumer GPUs. llama.cpp is the C/C++ engine; Ollama wraps it with a model library and a simple API. Great for development and private desktops, not for high-concurrency production.
- When to use it
- Offline prototypes, on-device demos, testing prompts before renting GPUs.
- In code
ollama run llama3.1 llama-server -m model.gguf
NVIDIA NIM
Prebuilt model containers
- What it is
- NVIDIA Inference Microservices: prebuilt, versioned containers that package a model with an optimised engine (often TensorRT-LLM or vLLM) behind an OpenAI-compatible API, part of NVIDIA AI Enterprise.
- When to use it
- Enterprises that want a supported, ready-tuned container rather than assembling the engine themselves.
OpenAI-compatible API
Swap without code changes
- What it is
- vLLM, SGLang, TensorRT-LLM (trtllm-serve), NIM and Ollama expose /v1/chat/completions-style endpoints, so the same client code and the same AI gateway work whichever engine sits behind.
- When to use it
- Benchmarking two engines with the same client, or moving from a hosted API to self-hosting.
- In code
curl localhost:8000/v1/chat/completions -d '{"model":"<model>","messages":[{"role":"user","content":"Hi"}]}'
Which engine when
Default, then constraints
- What it is
- Start with vLLM. Move to TensorRT-LLM for NVIDIA-only peak speed, SGLang for heavy prefix reuse, Triton when one server fronts many models, and add llm-d when one engine pod is no longer enough. Positioning from documentation, not a benchmark: measure on your traffic.
- When to use it
- The one-paragraph answer to "which serving framework would you choose and why?".
Batching & scheduling
Keep the GPU busy
- What it is
- One decode step reads all the weights from memory whether it serves one sequence or a hundred, so serving many requests together is the biggest throughput lever. The scheduler decides which requests join each step and how much prefill work runs alongside decode.
- When to use it
- Raising tokens per second per GPU without buying more GPUs.
Static batching
Wait for the slowest
- What it is
- A fixed batch starts together and finishes together: short answers sit idle until the longest sequence ends, and new requests wait for the whole batch. Fine for offline jobs, wasteful for chat.
- When to use it
- Offline batch scoring where every input has a similar length.
Continuous batching
Join and leave per step
- What it is
- Iteration-level scheduling: after every decode step, finished sequences leave and waiting requests join. TensorRT-LLM calls it in-flight batching. The GPU stays full and short requests are not held back by long ones; the cost is that a bigger batch raises per-request latency.
- When to use it
- Every online chat or API workload; it is on by default in vLLM, SGLang and TensorRT-LLM.
- Key figures
- Iteration-level scheduling was introduced by the Orca serving system.Source: Orca paper (Yu et al., OSDI 2022)
Chunked prefill
Split long prompts
- What it is
- A long prompt's prefill is cut into chunks and mixed with ongoing decode steps, so one 30-page document does not freeze token streaming for everyone else. Trades a little time to first token for steadier inter-token latency.
- When to use it
- Mixed traffic with occasional very long prompts (RAG, document Q&A).
- In code
vllm serve <model> --enable-chunked-prefill --max-num-batched-tokens 8192
Scheduler limits
Max sequences and tokens
- What it is
- Two knobs bound a step: the maximum number of concurrent sequences and the maximum tokens processed per step. Higher values raise throughput until the KV cache fills; then requests queue or get preempted.
- When to use it
- Tuning a deployment for throughput (batch jobs) or latency (interactive chat).
- In code
vllm serve <model> --max-num-seqs 256 --max-num-batched-tokens 8192
Priority and fairness
Who goes first
- What it is
- By default requests are served first come, first served. Priority scheduling lets interactive users jump ahead of batch jobs; per-tenant limits (often in the gateway) stop one noisy client from filling the queue.
- When to use it
- One GPU pool shared by a chat product and nightly batch summarisation.
Throughput vs latency
The core trade-off
- What it is
- Bigger batches give more tokens per second per GPU (cheaper) but each user waits longer per token. The right batch size is the largest one that still meets your latency target, which is why "goodput" is the honest metric.
- When to use it
- Explaining why the cheapest configuration is not the best user experience.
KV cache memory
The real capacity limit
- What it is
- Every running sequence keeps the Keys and Values of all its past tokens in GPU memory (see the GPU map for why). Free memory after the weights decides how many sequences can run at once, so serving engines manage the KV cache like an operating system manages RAM.
- When to use it
- Sizing concurrency: weights + KV cache must fit in the GPU memory you reserve.
The fragmentation problem
Reserved but unused
- What it is
- Older servers reserved one contiguous block per request sized for the maximum output length. Most answers are shorter, so most of that memory sat reserved and empty, which capped the batch size.
- When to use it
- The "before" picture that motivates PagedAttention in an exam answer.
- Key figures
- The vLLM paper measured existing systems wasting 60–80% of KV cache memory to fragmentation and over-reservation.Source: PagedAttention paper (Kwon et al., SOSP 2023)
PagedAttention
KV in fixed-size blocks
- What it is
- The KV cache is split into small fixed-size blocks allocated on demand, like virtual-memory pages; a block table maps each sequence to its blocks, which need not be contiguous. Waste drops to the last partial block, so many more sequences fit, and blocks can be shared between sequences.
- When to use it
- Why vLLM fits larger batches than a naive server on the same GPU.
- Key figures
- vLLM keeps KV cache waste under 4% and reports 2–4× the throughput of earlier systems at the same latency.Source: PagedAttention paper (Kwon et al., SOSP 2023)
Prefix caching
Reuse shared prompts
- What it is
- When a new request starts with tokens already processed (the same system prompt, few-shot block or earlier chat turns), the engine reuses those KV blocks and skips their prefill. It lowers time to first token and GPU load, but only when prefixes really repeat.
- When to use it
- Multi-turn chat and agents that resend a long system prompt on every call.
- In code
vllm serve <model> --enable-prefix-caching
RadixAttention
SGLang's prefix tree
- What it is
- SGLang stores cached prefixes in a radix tree with LRU eviction, so any request automatically reuses the longest matching prefix of any earlier request, including branching agent and few-shot patterns.
- When to use it
- Workloads with tree-shaped reuse: agents, tool loops, self-consistency sampling.
- Key figures
- The SGLang paper reports up to 6.4× higher throughput than earlier systems on its benchmarks.Source: SGLang paper (Zheng et al., NeurIPS 2024)
KV offload and tiers
GPU, CPU, SSD
- What it is
- Instead of throwing away cached prefixes when GPU memory fills, a cache layer such as LMCache moves them to CPU RAM or local disk and brings them back on a hit. llm-d offers a tiered prefix cache as one of its paths.
- When to use it
- Long documents or chat histories reused across hours, more than the GPU can hold.
KV cache quantisation
FP8 keys and values
- What it is
- Storing K and V in FP8 instead of FP16 halves the cache size, so twice the tokens or sequences fit. Independent of weight quantisation; check quality on long contexts.
- When to use it
- Long-context serving where the KV cache, not the weights, fills the GPU.
- In code
vllm serve <model> --kv-cache-dtype fp8
Preemption
When the cache is full
- What it is
- If running sequences need more blocks than are free, the scheduler pauses some: it either recomputes their KV later or swaps it to CPU memory. Frequent preemption is a sign the batch limit is too high for the memory.
- When to use it
- Reading engine logs and metrics when tail latency suddenly jumps.
GPU memory budget
Weights first, then KV
- What it is
- vLLM reserves a fraction of GPU memory (gpu-memory-utilization), loads the weights, and turns what is left into KV cache blocks. Smaller weights (quantisation) or a shorter max context mean more blocks.
- When to use it
- Fitting a model on one GPU and deciding the max context length.
- In code
vllm serve <model> --gpu-memory-utilization 0.90 --max-model-len 32768
Quantisation
Fewer bits per number
- What it is
- Storing weights (and sometimes activations or the KV cache) in fewer bits. Smaller weights load faster from memory, which speeds up memory-bound decode, and leave more room for the KV cache. The price is a possible quality drop that you must measure.
- When to use it
- Fitting a bigger model on fewer GPUs, or serving more users per GPU.
BF16 / FP16 baseline
2 bytes per weight
- What it is
- The usual training and release precision: 2 bytes per parameter, so weights alone take about 2 GB per billion parameters. Every quantised format is judged against this quality.
- When to use it
- Quick memory maths: a 70B model needs about 140 GB for weights in BF16.
Weight-only vs W+A
W4A16 vs W8A8
- What it is
- Weight-only formats (W4A16: AWQ, GPTQ) shrink memory and speed up memory-bound decode, but compute still runs in 16-bit. Weight-and-activation formats (W8A8: FP8, INT8 SmoothQuant) also use low-precision tensor cores, which helps compute-bound prefill and large batches.
- When to use it
- Choosing a format: small batch on a small GPU (W4A16) or high throughput on H100+ (FP8).
FP8
Hopper and later
- What it is
- 8-bit floating point (E4M3 for weights and activations), supported in hardware from NVIDIA Hopper (H100) onwards. Halves memory against BF16 and usually keeps quality very close, which makes it the first format to try on modern GPUs.
- When to use it
- Default quantisation for production on H100, H200 or Blackwell.
- In code
vllm serve <model> --quantization fp8
INT8 SmoothQuant
W8A8 on older GPUs
- What it is
- Activations have outlier channels that make them hard to quantise. SmoothQuant moves that difficulty from activations into weights with a mathematically equivalent per-channel scaling, so both can run in INT8 on GPUs without FP8 support.
- When to use it
- 8-bit compute on A100-class GPUs.
- Key figures
- SmoothQuant reports up to 1.56× speed-up and 2× memory reduction with negligible accuracy loss.Source: SmoothQuant paper (Xiao et al., ICML 2023)
AWQ
Protect salient weights
- What it is
- Activation-aware Weight Quantisation: a small fraction of weights matters most, and you find them by looking at activation magnitudes, not weight sizes. AWQ scales those channels before rounding to 4 bits, keeping quality without retraining.
- When to use it
- 4-bit open-weight models on a single smaller GPU.
- In code
vllm serve <awq-model> --quantization awq- Key figures
- Protecting about 1% of salient weights greatly reduces quantisation error.Source: AWQ paper (Lin et al., MLSys 2024)
GPTQ
Error-correcting rounding
- What it is
- Post-training quantisation that rounds weights one column at a time and adjusts the remaining weights to compensate for the error, using second-order information from a small calibration set. Common for 4-bit and 3-bit checkpoints.
- When to use it
- Using one of the many GPTQ checkpoints published on Hugging Face.
FP4 / NVFP4
Blackwell 4-bit float
- What it is
- 4-bit floating point with fine-grained block scales, supported in hardware on NVIDIA Blackwell (B200, GB200). TensorRT-LLM and vLLM support it; it quarters weight memory against BF16 while keeping tensor-core compute.
- When to use it
- Very large models on Blackwell where memory and cost per token dominate.
Check the quality
Golden set before rollout
- What it is
- Quantisation loss depends on the model, the format and your task: maths, code and long-context retrieval often suffer first. Run the same golden prompt set and task metrics on BF16 and the quantised model before switching.
- When to use it
- The "how do you know it is safe to quantise?" interview question.
Speculative decoding
Guess, then verify
- What it is
- A cheap method drafts several future tokens; the big target model checks them all in one forward pass and keeps the longest correct run. Fewer sequential target steps means lower latency per token, with the same output distribution.
- When to use it
- Cutting inter-token latency for interactive chat and coding assistants at low to medium load.
- Key figures
- The original paper reports 2–3× faster decoding on T5-XXL with identical outputs.Source: Speculative decoding paper (Leviathan et al., ICML 2023)
Why decode leaves room
Memory-bound steps
- What it is
- Each decode step streams all the weights from memory to produce one token per sequence, leaving the compute units mostly idle. Checking 4 or 5 candidate positions in the same pass costs little more than checking one, so spare compute is turned into extra tokens.
- When to use it
- The first sentence of any explanation of why speculative decoding works.
Draft and verify
Accept the longest match
- What it is
- The target scores the drafted positions in parallel. Tokens are accepted left to right while they agree with the target; at the first rejection the target's own token is used and drafting restarts from there. Every step yields at least one token, so the worst case is close to normal decoding plus the draft cost.
- When to use it
- Explaining why the output is not degraded by a weak drafter, only slower.
Lossless by design
Same distribution
- What it is
- With greedy decoding the result is identical to the target alone. With sampling, a rejection-sampling rule accepts or corrects each drafted token so the final text follows exactly the target model's distribution.
- When to use it
- Answering "does speculative decoding change model quality?" (no, unlike quantisation).
Draft model
Small model, same tokenizer
- What it is
- A smaller model of the same family (for example 1B drafting for 70B) generates the candidates. Simple to set up, but it costs extra GPU memory and a full separate forward pass per drafted token.
- When to use it
- A model family that ships small siblings with the same tokenizer.
N-gram / prompt lookup
Copy from the prompt
- What it is
- No extra model: the drafter looks for the last few generated tokens inside the prompt and proposes what followed them there. Almost free, and strong when the answer repeats the input (code edits, summaries with quotes, RAG answers).
- When to use it
- Code editing and document-grounded answers.
- In code
vllm serve <model> --speculative-config '{"method": "ngram", "num_speculative_tokens": 5, "prompt_lookup_max": 4}'
Medusa heads
Extra heads, one model
- What it is
- Several extra decoding heads on top of the target's last hidden state each predict a token further ahead; candidates are checked with tree attention. No separate draft model, but the heads must be trained.
- When to use it
- Teams that can fine-tune small heads but do not want to host a second model.
- Key figures
- Medusa-1 reports over 2.2× speed-up without quality loss; Medusa-2 reports 2.3–3.6×.Source: Medusa paper (Cai et al., ICML 2024)
EAGLE-3
Draft from target features
- What it is
- A lightweight draft head that predicts future tokens from the target model's own hidden states instead of from raw text. EAGLE-3 fuses low-, mid- and high-layer features and is trained with "training-time test" so it stays accurate several tokens ahead. Supported by vLLM, SGLang and TensorRT-LLM.
- When to use it
- The strongest general-purpose speculative method when a trained EAGLE-3 head exists for your model.
- In code
vllm serve <model> --speculative-config '{"method": "eagle3", "model": "<eagle3-head>", "num_speculative_tokens": 3}'- Key figures
- EAGLE-3 reports speed-ups of up to 6.5× over normal decoding, about 1.4× better than EAGLE-2.Source: EAGLE-3 paper (Li et al., 2025)
Reuse, not recompute
Features already exist
- What it is
- When the target generates a token, its forward pass already computes the hidden states of every layer. EAGLE-3 captures the early, middle and late layer outputs from that pass. Nothing extra runs in the big model to obtain them.
- When to use it
- Source of saving 1 of 2: feature reuse.
The draft head
One small layer
- What it is
- The fused features go into a small decoder (about one transformer layer) that drafts several tokens autoregressively, using its own lightweight computation for the positions after the first. It costs a fraction of a target step.
- When to use it
- Why the drafting cost is low compared with a separate draft model.
One parallel verify pass
All candidates at once
- What it is
- The target then scores all drafted positions in one forward pass, because computing several positions in parallel on a GPU is far cheaper than several sequential steps. Accepted tokens are committed and the next round starts from the verified position.
- When to use it
- Source of saving 2 of 2: parallel verification.
Where the time goes
6 steps vs about 2
- What it is
- Normal decoding of "The company reported strong revenue growth" runs the 14B target six times in sequence, one token each. With EAGLE-3: the target produces "The", the head drafts "company reported strong revenue", the target verifies them in one pass; if all are accepted, five tokens cost about two target passes plus a cheap draft.
- When to use it
- A worked example for an exam answer, from the author's own notes.
The common mistake
Not faster hidden states
- What it is
- EAGLE-3 does not make hidden-state calculation cheaper, and the draft head does not know the target's future hidden states. It saves time by reusing hidden states that were already computed and by verifying many tokens per target pass. Net speed-up depends on how many drafted tokens are accepted and what drafting costs.
- When to use it
- The one-line answer: reuse already-computed features to avoid running the expensive target model for every token.
MTP heads
Trained into the model
- What it is
- Multi-token prediction modules trained together with the model (DeepSeek-V3 is the best-known example) predict the next tokens during pre-training; at inference they double as a built-in drafter. No extra model to host and no separate training.
- When to use it
- Serving DeepSeek-V3/R1-style models with speculative decoding out of the box.
- Key figures
- DeepSeek-V3 reports 85–90% acceptance for the second predicted token and about 1.8× tokens per second.Source: DeepSeek-V3 technical report (2024)
Acceptance length
The number that matters
- What it is
- The average number of tokens accepted per target pass. Speed-up ≈ acceptance length ÷ (1 + relative drafting cost). It is higher on predictable text (code, structured output, low temperature) and lower on creative, high-temperature text.
- When to use it
- Deciding the number of speculative tokens: more only helps while acceptance stays high.
When it does not help
Large batches
- What it is
- At high concurrency the GPU is already busy with many sequences, so decode becomes compute-bound and there is no spare compute for verifying drafts; rejected tokens become pure waste. Gains are largest at small batch sizes and shrink, or turn negative, as load grows.
- When to use it
- Explaining why a throughput-oriented batch job may turn speculative decoding off.
Parallelism for serving
Split across GPUs
- What it is
- When a model does not fit on one GPU, or one GPU is not fast enough, it is split. Each style cuts the work differently and needs different link speeds (the GPU map covers NVLink and InfiniBand).
- When to use it
- Planning how many GPUs per replica and how to connect them.
Tensor parallelism
Split every layer
- What it is
- Every weight matrix is split across GPUs, and each layer ends with an all-reduce. Lowers latency and spreads memory, but needs very fast links, so keep it inside one NVLink node.
- When to use it
- A 70B model in BF16 across 2–4 GPUs of one server.
- In code
vllm serve <model> --tensor-parallel-size 4
Pipeline parallelism
Split by layers
- What it is
- Groups of consecutive layers live on different GPUs or nodes; activations pass from stage to stage. Lighter on bandwidth than tensor parallelism, so it can span nodes, but stages can sit idle (pipeline bubbles).
- When to use it
- Models too large for one node: tensor parallel inside nodes, pipeline parallel between them.
- In code
vllm serve <model> --tensor-parallel-size 8 --pipeline-parallel-size 2
Expert parallelism
Spread MoE experts
- What it is
- In mixture-of-experts models each token uses only a few experts. Placing different experts on different GPUs and routing tokens to them (all-to-all traffic) lets huge MoE models run; llm-d calls the large-scale version "wide expert parallelism".
- When to use it
- DeepSeek-V3, Qwen MoE or Llama 4 style models across many GPUs.
- In code
vllm serve <moe-model> --tensor-parallel-size 8 --enable-expert-parallel
Data parallelism (replicas)
Full copies
- What it is
- Independent copies of the whole model behind a load balancer. No GPU-to-GPU traffic and good fault isolation; each replica needs all the weights and its own KV cache.
- When to use it
- Scaling a model that already fits on one GPU or node to more users.
- In code
vllm serve <model> --data-parallel-size 4
Choosing a layout
Fit first, then scale
- What it is
- Rule of thumb: use the fewest GPUs that fit weights plus enough KV cache (tensor parallel inside one node), add pipeline parallelism only across nodes, use expert parallelism for large MoE models, and scale users with replicas.
- When to use it
- The design-question answer for "how would you serve a 400B model?".
Disaggregation & Kubernetes
Cluster-level serving
- What it is
- Beyond one engine pod: separate prefill and decode pools, a KV-cache-aware router, and Kubernetes plus Helm to run it. The GPU map has the full topology and the comparison of architectures.
- When to use it
- When one engine replica is no longer enough and traffic is large and mixed.
Prefill / decode split
Two pools, two jobs
- What it is
- Prefill is compute-bound and sets time to first token; decode is memory-bound and sets inter-token latency. Running them in separate pools lets each have its own GPUs, parallelism and scaling signal, and stops long prompts from stalling other users' decoding.
- When to use it
- High concurrency with long prompts and strict latency targets.
NIXL
Moves the KV cache
- What it is
- NVIDIA Inference Xfer Library: transfers KV cache blocks from prefill to decode workers over the fastest path available (NVLink, InfiniBand/RoCE with RDMA, or storage). Used by vLLM's NixlConnector, llm-d and Dynamo.
- When to use it
- The answer to "how does the KV cache get from the prefill node to the decode node?".
llm-dKubernetes inference stack
- What it is
- Open-source, CNCF Sandbox stack that runs engines such as vLLM and SGLang across a Kubernetes cluster. It ships "well-lit paths": tested recipes for an optimised baseline, prefix-cache-aware routing, tiered prefix cache, prefill/decode disaggregation and wide expert parallelism.
- When to use it
- Adding routing and pool management on top of vLLM once one pod is not enough.
NVIDIA Dynamo
Distributed inference
- What it is
- NVIDIA's open-source distributed inference framework: disaggregated prefill and decode, a KV-cache-aware router, a GPU planner that shifts workers between phases, and NIXL for transfers. Works with vLLM, SGLang and TensorRT-LLM.
- When to use it
- Large NVIDIA fleets that want one framework across engines.
KV-aware routing
Send to the warm pod
- What it is
- The router (llm-d's endpoint picker, Dynamo's router) sends a request to the pod that already holds its prefix in cache, balanced against load. A follow-up chat message then skips recomputing the history; round-robin would throw that cache away.
- When to use it
- Multi-turn chat and agents across many replicas.
Helm releases
Install and configure
- What it is
- Helm renders chart templates with your values file into Kubernetes resources; you change replicas or settings by editing values and running helm upgrade with the same release name. llm-d publishes charts for its router; engine pods often come as manifests or Kustomize.
- When to use it
- Repeatable installs of the router and pools across clusters.
- In code
helm install my-router oci://ghcr.io/llm-d/charts/llm-d-router-standalone -f router-values.yaml --namespace llm-d --create-namespace helm upgrade my-router oci://ghcr.io/llm-d/charts/llm-d-router-standalone -f router-values.yaml -n llm-d
KServeModel serving CRD
- What it is
- A Kubernetes-native model serving platform: you declare an InferenceService and it creates the deployment, routing, autoscaling and canary rollout. It has LLM runtimes built on vLLM and an OpenAI-compatible protocol.
- When to use it
- Teams that already use KServe for classic ML and want LLMs on the same platform.
- In code
kubectl apply -f inferenceservice.yaml
Autoscaling signals
Queue and KV, not CPU
- What it is
- CPU and even GPU utilisation are poor scaling signals for LLMs. Scale on engine metrics exported to Prometheus: waiting requests, running sequences, KV cache usage and latency, with HPA or KEDA, separately per pool.
- When to use it
- Configuring the autoscaler for prefill and decode pools.
- In code
vllm:num_requests_waiting
Cold start
Minutes, not seconds
- What it is
- A new replica must pull a large image, download tens or hundreds of GB of weights and warm up (CUDA graphs, compilation) before it serves. Scale up early, keep a warm minimum, and cache weights on the node or a fast shared volume.
- When to use it
- Why scale-to-zero is rare for large LLMs in production.
Is splitting worth it?
Only with a fast fabric
- What it is
- Disaggregation pays off with high concurrency, long prompts and strict latency targets, and only if the KV transfer is fast (NVLink or RDMA). For small models, short prompts or early stages, one combined pool with prefix-aware routing is simpler and often enough.
- When to use it
- Arguing for or against prefill/decode separation in a design review.
Serving metrics
What to measure
- What it is
- LLM latency has two parts the user feels separately (waiting for the first token, then the reading speed) plus the cost side. Always report percentiles under a realistic load, not averages on an idle server.
- When to use it
- Setting SLOs and comparing engines or settings fairly.
TTFT
Time to first token
- What it is
- From request arrival to the first streamed token: queueing plus prefill. Grows with prompt length and load; prefix caching and chunked prefill reduce it.
- When to use it
- The responsiveness metric for chat: users notice a blank wait first.
TPOT / ITL
Time between tokens
- What it is
- Time per output token (average) or inter-token latency (each gap): the reading speed of the stream. Set by decode; grows with batch size, improved by quantisation and speculative decoding.
- When to use it
- Keeping the stream faster than people read; tracking decode health.
End-to-end latency
TTFT + tokens × TPOT
- What it is
- Total time for the full answer: about TTFT plus output tokens times TPOT. What matters for non-streaming APIs, agents and tool chains where the next step waits for the whole result.
- When to use it
- Agent pipelines with several LLM calls in sequence.
Throughput
Tokens per second
- What it is
- Output tokens (or requests) per second for the whole server or per GPU. Rises with batch size until memory or compute saturates; the main cost driver.
- When to use it
- Capacity planning and batch workloads.
Goodput
Throughput within SLO
- What it is
- Only the requests that met their latency targets (for example TTFT and TPOT limits) count. A configuration with higher raw throughput can have lower goodput if it breaks the SLO for many users.
- When to use it
- The fair metric for comparing serving setups, including disaggregation.
P50 / P95 / P99
Tails, not averages
- What it is
- Latency percentiles: P50 is the typical request, P99 the slowest 1%. LLM tails grow with long prompts, preemption and queueing, so SLOs are written on P95 or P99.
- When to use it
- Writing SLOs and spotting overload before users complain.
KV cache usage
Memory headroom
- What it is
- The share of KV cache blocks in use, plus running and waiting requests, exported by vLLM and others to Prometheus and shown in Grafana. Near 100% means preemption and queueing are coming.
- When to use it
- The early-warning dashboard panel and an autoscaling input.
Cost per million tokens
GPU hour ÷ tokens
- What it is
- GPU cost per hour divided by tokens served per hour, at the load you actually run. Compare it with API prices only at realistic utilisation: idle GPUs make self-hosting expensive.
- When to use it
- Build-vs-buy: self-hosting against a hosted API.
Benchmarking
Your prompts, real load
- What it is
- Replay your real prompt-length and output-length distribution at increasing request rates, record TTFT, TPOT, throughput and goodput, and compare settings one change at a time. vLLM ships a serving benchmark CLI.
- When to use it
- Proving that a change (quantisation, speculative decoding, new engine) actually helps.
- In code
vllm bench serve --model <model> --dataset-name random --num-prompts 500 --request-rate 8
Key exam points
Answers to memorise
- What it is
- The questions that come up most about LLM serving, each with a one-paragraph answer. Open the other branches for the detail behind each answer.
- When to use it
- Last-hour revision before an exam or a technical interview.
Why is decode memory-bound?
All weights per token
- What it is
- Each decode step must read every weight and the sequence's KV cache from HBM to produce one token, and does very little arithmetic per byte read. Memory bandwidth, not FLOPS, sets the speed; batching, quantisation and speculative decoding all attack that.
- When to use it
- The root cause behind almost every serving optimisation.
Static vs continuous batching
Per batch vs per step
- What it is
- Static batching admits a fixed batch and waits for its longest sequence; continuous (in-flight) batching admits and releases sequences at every step, keeping the GPU full and short requests fast.
- When to use it
- Standard comparison question.
What does PagedAttention fix?
KV memory waste
- What it is
- Fragmentation and over-reservation of KV cache memory. Fixed-size blocks allocated on demand cut waste to the last partial block, so larger batches fit, and blocks can be shared for prefix caching and parallel sampling.
- When to use it
- Explaining vLLM's core idea in two sentences.
Speculative decoding: when not?
High batch, low acceptance
- What it is
- It speeds up decoding by drafting tokens and verifying them in one target pass, without changing the output distribution. It stops helping at large batch sizes (no spare compute) and on unpredictable, high-temperature text (low acceptance).
- When to use it
- The trade-off question that follows "explain speculative decoding".
How does EAGLE-3 save time?
Reuse + parallel verify
- What it is
- It reuses the hidden states the target already computed (low, mid and high layers) to feed a cheap draft head, then verifies all drafted tokens in one parallel target pass. It does not compute hidden states faster.
- When to use it
- The answer to the classic EAGLE trick question.
FP8 vs INT4 AWQ
Compute vs memory
- What it is
- FP8 (W8A8) halves memory and uses FP8 tensor cores on Hopper and later, with quality close to BF16: best for high-throughput serving. INT4 AWQ (W4A16) quarters weight memory and speeds up small-batch decode, but compute stays 16-bit and quality risk is higher.
- When to use it
- Choosing a quantisation format for a given GPU and workload.
TP vs PP
Inside vs across nodes
- What it is
- Tensor parallelism splits every layer and needs an all-reduce per layer, so it lives inside an NVLink node and lowers latency. Pipeline parallelism splits by layer groups, needs less bandwidth and can span nodes, but adds pipeline bubbles.
- When to use it
- Multi-GPU layout question.
Why disaggregate P/D?
Different bottlenecks
- What it is
- Prefill is compute-bound (sets TTFT), decode is memory-bound (sets inter-token latency). Separate pools let each scale and tune independently and stop long prompts stalling decode; the cost is a KV cache transfer that needs a fast fabric.
- When to use it
- System-design question on large-scale serving.
Which metric for chat UX?
TTFT and ITL, P99
- What it is
- Time to first token (responsiveness) and inter-token latency (smooth streaming) at P95/P99 under real load; throughput and cost per token for the business side, joined in goodput.
- When to use it
- Defining SLOs for an assistant product.
Which engine would you pick?
vLLM, then constraints
- What it is
- vLLM by default (broadest models and hardware, OpenAI API); TensorRT-LLM for NVIDIA-only peak speed; SGLang for prefix-heavy agent traffic; Triton to front many models; llm-d or Dynamo when serving spans many nodes. Then benchmark on your own prompts.
- When to use it
- The opening design question of most LLM platform interviews.
Serving engines compared
Positioning from each project's documentation (read 2026-11-19), not a benchmark. Speed depends on model, GPU, precision and traffic.
| Engine | What it is | Strength | Trade-off | Pick it when |
|---|---|---|---|---|
| vLLM | Open-source engine with PagedAttention and an OpenAI-compatible server | Broadest model and hardware support, many quantisation and speculative methods | Not always the fastest on a given NVIDIA GPU | First deployment, mixed hardware, most open-weight models |
| TensorRT-LLM | NVIDIA's optimised inference library with a Python LLM API | NVIDIA-tuned kernels, FP8 and FP4, in-flight batching | NVIDIA GPUs only, more setup | NVIDIA-only fleet where cost per token and latency matter most |
| SGLang | Serving framework for language and multimodal models | RadixAttention prefix reuse, broad hardware list | Smaller ecosystem than vLLM | Agents and chat with long shared prefixes |
| Triton | Serving layer with model repository, HTTP/gRPC, ensembles and metrics | Many models and frameworks behind one server | LLM speed comes from the backend (TensorRT-LLM, vLLM) | One endpoint for classic ML and LLMs, model pipelines |
Speculative decoding methods compared
All of them keep the target model's output distribution; they differ in where the draft comes from and what it costs to set up.
| Method | Extra model to host? | Training needed? | Typical fit | Caveat |
|---|---|---|---|---|
| Draft model | Yes, a small model of the same family | No, if a compatible small model exists | Families with small siblings sharing the tokenizer | Extra memory and a full draft pass per token |
| N-gram / prompt lookup | No | No | Code edits, RAG and summaries that copy the input | Little gain on free-form creative text |
| Medusa | No, extra heads on the target | Yes, the heads | Teams able to fine-tune small heads | Heads see only the last hidden state |
| EAGLE-3 | A light draft head | Yes, unless a published head exists | General chat and coding when a head exists for the model | Gain shrinks at large batch sizes |
| MTP heads | No, built into the model | No, trained with the model | Models that ship MTP modules (DeepSeek-V3 style) | Only for models trained with MTP |
Sources, read 2026-11-19 to 2026-11-21: the author's post comparing vLLM, TensorRT-LLM, SGLang and Triton (built on their documentation); the vLLM, TensorRT-LLM, SGLang, Triton Inference Server, llm-d, NVIDIA Dynamo, KServe and LMCache documentation; the papers on PagedAttention (Kwon et al., 2023), Orca (Yu et al., 2022), SGLang (Zheng et al., 2024), SmoothQuant (Xiao et al., 2023), AWQ (Lin et al., 2024), GPTQ (Frantar et al., 2023), speculative decoding (Leviathan et al., 2023), Medusa (Cai et al., 2024) and EAGLE-3 (Li et al., 2025); the DeepSeek-V3 technical report; NVIDIA's EAGLE-3 explanation; the author's own study notes. Speed-ups are the figures the papers report on their own setups, not a promise for yours: benchmark on your model, GPU and traffic. Flags change between releases: check the current docs.