🚀 Inference optimization 40 articles · 9 chapters
Module 4: Inference optimization
LLM inference basics, inference engine internals, common frameworks, quantization, speculative decoding, prefill/decode disaggregation, on-device inference, profiling and end-to-end practice.
Start learningChapters
How LLMs generate text in two phases (prefill and decode), how the KV cache works, and which metrics matter for inference performance
PagedAttention, Continuous Batching, Prefix Cache, Chunked Prefill, Attention backends, and graph optimization—the five core techniques in modern inference engines
A ~1200-line minimal inference engine as the through-line: continuous batching, PagedAttention, FlashAttention, tensor parallelism, and CUDA Graph as they appear in real code
From scale and granularity through SmoothQuant, GPTQ/AWQ, KV cache quantization, and FP8/NVFP4/MXFP4, then pick a scheme and run controlled experiments on vLLM v0.32.0
Draft + Verify and distribution-preserving sampling, comparing independent drafts, N-gram/Suffix, Medusa/EAGLE/MTP, plus where the gains stop and how to measure them in vLLM
Storage and communication costs of TP, PP, DP, and EP for inference, plus single-node and multi-node vLLM deploys, MoE DP+EP, DCP, and controlled experiments to pick a layout
Problems with mixed P/D batching, DistServe/Splitwise-style disaggregation, KV cache transfer, and goodput with SLO-aware scheduling
Containerizing and deploying vLLM inference services on Kubernetes, plus observability, autoscaling, load balancing, and capacity planning
Resource constraints, heterogeneous hardware, runtimes, and optimization methods for on-device inference, plus a reproducible performance evaluation workflow
Study tips
Prerequisites
The prerequisites module plus basic CUDA programming
- The LLM inference basics chapter explains what makes inference different from training.
- Quantization and speculative decoding are where most inference work is happening now.
- Practice deploying with a real inference framework such as vLLM.
- For on-device inference, measure latency, memory, power and accuracy on a real device.