LLM Inference Metrics Explained: TTFT, TPOT, Tokens/Sec & Memory-Bandwidth Bottlenecks
How to benchmark and size production LLM serving: Time-to-First-Token (prefill), Time-Per-Output-Token (decode), Throughput vs. Goodput, and why decode is memory-bandwidth bound
LLM Inference Metrics break perceived speed into TTFT (Time-to-First-Token, governed by prefill compute), TPOT / ITL (Time-Per-Output-Token, governed by GPU memory bandwidth), and Goodput (requests/sec meeting your latency SLAs).
Optimizing total throughput alone can make streaming chat feel sluggish (high TTFT/TPOT), and misunderstanding compute-bound prefill vs. memory-bound decode leads to buying the wrong GPUs.
Every LLM serving interview and GPU capacity plan boils down to Roofline math: Prefill = FLOPs, Decode = HBM Bandwidth!
Back-of-the-envelope formula max_tok_per_s ≈ HBM_Bandwidth / Active_Weights_GB immediately tells you why 4-bit quantization speeds up decode 3× on the same GPU.
Knowing human reading speed (~5–8 tokens/sec) lets you set realistic TPOT SLAs (<100ms) while maximizing batch throughput.
Classic infra question: 'A 70B FP16 model (140 GB) runs on an H100 (3,350 GB/s HBM). What is the theoretical ceiling on batch=1 decode tokens/sec?' (~24 tok/s!)
You cut a 70B model's weights from FP16 (140 GB) to INT4 (35 GB) on the exact same GPU. Why does batch=1 decode speed jump nearly 3×–4×?
- Compute End-to-End Latency = TTFT + TPOT × (Output_Tokens − 1) and Tokens/Sec = 1000 / TPOT_ms.
- Explain why Prefill is Compute-Bound (FLOPs) while Autoregressive Decode (batch=1) is Memory-Bandwidth-Bound (GB/s).
- Estimate the theoretical maximum decode speed of any GPU from
Memory_Bandwidth_GBps / Model_Size_GB. - Distinguish raw Throughput from SLA-compliant Goodput.
Prefill processes 1,000 prompt tokens in parallel (matrix-matrix math → GPU compute engines roar at 100%). Decode processes 1 token at a time (matrix-vector math → compute engines sit idle waiting for weights to stream across GPU memory bandwidth!).
1. The 4 Core Serving Metrics
| Metric | What It Measures | Primary Bottleneck | Target for Interactive Chat |
|---|---|---|---|
| TTFT (Time to First Token) | Prompt prefill + queue wait | GPU Compute (FLOPs) | < 300–500 ms |
| TPOT / ITL (Time per Output Token) | Streaming smoothness | GPU HBM Bandwidth (GB/s) | < 30–50 ms (20–33 tok/s) |
| Throughput | Total system tok/s across all users | Batch size & KV VRAM | Maximize via Continuous Batching |
| Goodput | Requests/sec meeting BOTH TTFT & TPOT SLAs | Balanced scheduling (prefill/decode disaggregation) | Primary production SLA KPI |
The exact honest questions almost every beginner wonders — answered in plain English without hiding behind jargon.
Because long prefills stall streaming decode tokens on the same GPU, modern clusters (DistServe, vLLM/SGLang disaggregated serving) dedicate separate GPU pools to Prefill and Decode, transferring the KV-cache over fast NVLink/InfiniBand!
vLLM PagedAttention Physical Block Allocator & Shared Prefix Pool
Watch 3 concurrent users allocate non-contiguous 16-token KV pages on demand while sharing Page #0 (System Prompt).
# Back-of-the-Envelope LLM Inference Roofline & SLA Calculator
def estimate_decode_ceiling(active_params_b: float, bytes_per_param: float, hbm_gb_s: float) -> float:
model_gb = active_params_b * bytes_per_param
return hbm_gb_s / model_gb # theoretical max batch=1 tokens/sec
def total_latency_s(ttft_ms: float, tpot_ms: float, out_tokens: int) -> float:
return (ttft_ms + tpot_ms * max(0, out_tokens - 1)) / 1000.0
# H100 SXM: ~3,350 GB/s HBM bandwidth on a 70B dense model
print(f"70B FP16 H100 ceiling: {estimate_decode_ceiling(70, 2.0, 3350):.1f} tok/s")
print(f"70B INT4 H100 ceiling: {estimate_decode_ceiling(70, 0.5, 3350):.1f} tok/s")
print(f"200-token reply latency (TTFT=300ms, TPOT=25ms): {total_latency_s(300, 25, 200):.2f}s")