
Inference Engineering
Implement attention variants, sparse experts, decoding, quantization, serving schedulers, and distributed inference systems from first principles.
Unlock the full study plan
Upgrade to Pro to access the full curriculum.
What you will learn
Inference engineering is the work of serving large language models quickly and cheaply. This plan has 30 problems in six sections covering attention variants, efficient Transformer components, KV caching and decoding, quantization, batching and serving metrics, and distributed inference.
Prerequisites
You should know Python, NumPy or PyTorch, and how attention works in a Transformer. The attention mechanism and the KV cache are good preparation.
The sections, in order
- Attention architectures: scaled dot-product, multi-head, multi-query, grouped-query and multi-head latent attention.
- Efficient Transformer components: rotary embeddings for decoding, FlashAttention with online softmax, sampling, and mixture-of-experts routing and dispatch.
- KV cache and decoding: decoding with a KV cache, cache memory for each attention type, PagedAttention block allocation, prefix caching and speculative decoding.
- Quantization and GPU performance: INT8, per-channel, group-wise INT4 and block-wise FP8 quantization, and roofline analysis of prefill and decode.
- Batching and serving metrics: latency percentiles, TTFT, TPOT and throughput, dynamic and continuous batching, and chunked prefill.
- Distributed inference systems: memory and GPU-count estimates, tensor and expert parallelism, disaggregated prefill and decode, and cost under a latency target.
Where to go next
Write the kernels behind these systems with the Triton study plan, or see the full training-to-serving stack in Language Modeling from Scratch.