How Inference Works
Know exactly where the time and money go when a model runs.
- 13.1 The inference stack: three layers
- 13.2 Prefill and decode
- 13.3 The KV cache
- 13.4 Latency metrics: TTFT, TPS, ITL
- 13.5 Throughput vs latency
- 13.6 Compute-bound vs memory-bound
- 13.7 Calculating bottlenecks by hand
- 13.8 Optimizing attention
- 13.9 Budgets: picking a model for your app
Checkpoint. Given a model and a GPU, estimate TTFT and decode speed within 2x.
Hardware
Understand the machine your model runs on.
- 14.1 Inside a GPU
- 14.2 GPU generations: Ampere to Blackwell
- 14.3 Interconnect: NVLink and InfiniBand
- 14.4 Cloud instances and pricing
- 14.5 Beyond NVIDIA: TPU, AMD, Trainium
- 14.6 Local inference
Checkpoint. Pick the cheapest GPU setup that meets a given latency target, and justify it.
The Software Stack
From CUDA kernels up to inference engines.
- 15.1 CUDA and kernels
- 15.2 Writing your first kernel
- 15.3 PyTorch compilation and CUDA graphs
- 15.4 Inference engines: vLLM, SGLang, TensorRT-LLM
- 15.5 Continuous batching
- 15.6 PagedAttention
- 15.7 NVIDIA Dynamo
- 15.8 Benchmarking and load testing
Checkpoint. Run a benchmark and explain every number in its report.
Making It Fast
The techniques that cut latency and cost in real systems.
- 16.1 Quantization: the idea
- 16.2 Quantization in practice: FP8, INT4, FP4
- 16.3 Speculative decoding
- 16.4 Prefix caching
- 16.5 Tensor and pipeline parallelism
- 16.6 Expert parallelism
- 16.7 Disaggregated prefill and decode
Checkpoint. Choose and justify the right optimizations for a given workload.
Beyond Text
Serving vision, speech, embeddings and image generation.
- 17.1 Vision language models
- 17.2 Embedding models
- 17.3 Speech to text
- 17.4 Text to speech
- 17.5 Image and video generation
Checkpoint. Explain how serving a speech or image model differs from serving an LLM.
Production
Ship it, scale it, keep it up, and keep the bill down.
- 18.1 Containerizing a model
- 18.2 Autoscaling and cold starts
- 18.3 Multi-cloud GPU capacity
- 18.4 Testing and zero-downtime deploys
- 18.5 Client code: streaming, retries, timeouts
- 18.6 Observability
- 18.7 Cost engineering
- 18.8 Where to go from here
Checkpoint. Run a production LLM endpoint and explain its latency, throughput and cost.