System Design Lab
LLM inference is autoregressive: the KV cache grows per token and dominates GPU memory, so batching and memory layout decide throughput.
Change request rate, prompt and output lengths, model size, GPU count, and the time-to-first-token target. Toggle continuous batching with paged attention and tensor parallelism. The design moves from one GPU serving one request at a time, to a KV cache with batching, to continuous batching plus paged attention, to tensor-parallel sharding for big models, and finally prefill/decode disaggregation at scale.
Guided walkthrough
Reason about it one step at a time
Takeaway
Normal evolution scenarios
Click left to right for the intended demo path. Each card changes the workload inputs.
Recommended shape
Bottlenecks
Why this changes
Decision tradeoffs
Source-backed rules
These are the durable system-design claims behind the model. The exact slider thresholds are deliberately labeled as teaching assumptions.
PagedAttention stores the KV cache in fixed pages to eliminate fragmentation
Borrowing OS virtual-memory paging, vLLM stores the KV cache in non-contiguous fixed-size blocks, cutting waste from fragmentation and raising serving throughput 2-4x.
vLLM (PagedAttention)vLLM combines continuous batching with paged attention for high-throughput serving
The documentation describes continuous (in-flight) batching and PagedAttention as the core mechanisms that keep the GPU busy across requests of different lengths.
vLLM DocsTensorRT-LLM shards large models across GPUs with tensor and pipeline parallelism
For models too large for one GPU, TensorRT-LLM splits each layer across devices and supports multi-GPU and multi-node parallelism plus disaggregated serving.
NVIDIA TensorRT-LLMTriton Inference Server schedules and batches inference requests in production
Triton documents dynamic and in-flight batching, scheduling, and multi-backend serving used to run LLM inference at scale behind a single endpoint.
NVIDIA TritonTeaching assumptions
- Per-GPU memory, token throughput, and batching efficiency are conservative teaching numbers for one modern data-center GPU, not vendor benchmarks.
- KV cache size is approximated as proportional to sequence length and sub-linear in model scale; modern frontier models use Grouped-Query Attention (GQA/MQA) to share key/value heads, which shrinks the KV cache by roughly 8x and is folded into the coefficient here.
- Prefill is modeled as the compute-bound first-token phase and decode as the memory-bound token loop; their relative cost varies by hardware and kernel.