Inference Engineering

Advanced · Roadmap · 32 lessons · 8 groups

Running a trained model efficiently in production, not training one. Thirty-two lessons from latency and throughput through hardware, serving software and the techniques that speed generation up, to running it all at scale.

0%

Not started

Nothing saved yet. Progress is kept in this browser until you sign in.

Start the path

What inference engineering actually is

3 lessons

  1. 01 / 03What is inference engineering?Running a trained model efficiently in production — a different job from training one, and a discipline that exists because serving at scale got hard.22 min
  2. 02 / 03Open vs closed modelsCalling a closed model's API versus self-hosting an open-weight one — and how that choice changes what you actually control.19 min
  3. 03 / 03The inference stackThe layers between a trained checkpoint and an API that serves it — hardware, engine, serving framework — and where performance work happens at each.60 min

The metrics the whole discipline optimizes

4 lessons

  1. 01 / 04Time to first tokenHow long before the first output token appears, why prefill dominates it, and why it is the latency users actually feel.34 min
  2. 02 / 04Tokens per second and throughputPer-request generation speed versus aggregate system throughput — two different numbers that can move in opposite directions.20 min
  3. 03 / 04Latency versus throughputBatching more requests raises aggregate throughput but can raise individual latency — tuning a serving system means picking a point on that curve.16 min
  4. 04 / 04Latency percentiles and end-to-end metricsWhy averages hide the real user experience — p50/p95/p99 latency, and measuring the whole request path, not just model compute.20 min

What a serving engine actually computes

4 lessons

  1. 01 / 04Prefill and decodeThe two phases of generating a response — prefill processes the prompt in parallel, decode generates tokens one at a time — with opposite performance profiles.15 min
  2. 02 / 04KV cache mechanicsWhat is actually stored in the KV cache, why it exists, and how its size scales with context length, batch size and model size — from the serving engine's side.12 min
  3. 03 / 04Attention variants for servingMulti-head, multi-query and grouped-query attention — why reducing the number of KV heads became a serving-performance decision, not just a modeling one.18 min
  4. 04 / 04Mixture of expertsSparse MoE models route each token to a subset of expert sub-networks, changing the compute/memory tradeoff versus a dense model of similar size.53 min

What the chip underneath actually limits

5 lessons

  1. 01 / 05GPU architecture for inferenceWhat actually matters about a GPU for serving — compute throughput, memory bandwidth, memory capacity — and how hardware generations change these numbers.20 min
  2. 02 / 05Arithmetic intensity and the roofline modelThe ratio of compute to memory movement an operation needs, and the roofline model that predicts whether it is compute- or memory-bound on given hardware.24 min
  3. 03 / 05Memory-bound vs compute-boundWhy LLM decode is usually memory-bandwidth-bound rather than compute-bound, and what that implies about where optimization effort actually pays off.12 min
  4. 04 / 05Choosing hardwareSizing and procuring GPUs for a real workload — matching hardware to model size, batch size and latency targets, not just buying the newest chip.34 min
  5. 05 / 05Local and edge inferenceRunning inference on consumer hardware or at the edge rather than a datacenter — far tighter memory and power constraints, and the tradeoffs that forces.11 min

The layer between a model and an API

3 lessons

  1. 01 / 03Inference enginesWhat a dedicated inference engine like vLLM, TensorRT-LLM or SGLang does beyond running the model forward — and why it beats calling a raw framework directly.44 min
  2. 02 / 03Kernel fusionCombining multiple small GPU operations into one kernel to avoid repeatedly reading and writing memory between them.83 min
  3. 03 / 03Benchmarking inference systemsMeasuring a serving system's real performance under realistic load — the gap between a synthetic single-request number and actual production traffic.32 min

Techniques that buy real speed without new hardware

5 lessons

  1. 01 / 05QuantizationReducing numerical precision to cut memory and increase speed — the quality cost, and post-training quantization versus quantization-aware training.10 min
  2. 02 / 05Speculative decodingA small, fast draft model proposes several tokens at once, verified in parallel by the full model — speeding up generation without changing its output.96 min
  3. 03 / 05Continuous batchingDynamically adding and removing requests from a running batch as they arrive and finish, keeping GPUs busy under real, bursty traffic.23 min
  4. 04 / 05FlashAttention and PagedAttentionFlashAttention restructures attention to avoid wasted memory traffic; PagedAttention manages the KV cache like virtual memory to reduce fragmentation.7 min
  5. 05 / 05Prefix cachingReusing the KV cache computed for a shared prompt prefix across multiple requests, at the serving-engine level.5 min

Past one GPU, and past text generation

4 lessons

  1. 01 / 04Model parallelismSplitting a model too large for one GPU across several — tensor, pipeline and expert parallelism — and the different tradeoffs each one makes.20 min
  2. 02 / 04Disaggregated servingSeparating the prefill and decode phases onto different hardware pools, since they have such different performance characteristics.89 min
  3. 03 / 04Embedding and multimodal inferenceServing embedding models and vision-language models — different bottlenecks than text generation, since there is often no multi-step decode at all.61 min
  4. 04 / 04Speech inferenceServing speech recognition and text-to-speech models, where real-time conversational latency requirements are especially strict.25 min

Keeping it running under real traffic

4 lessons

  1. 01 / 04Autoscaling and cold startsScaling GPU capacity with demand, and the real cost of a cold start — how long it takes a new instance to load a large model before it can serve anything.20 min
  2. 02 / 04Routing and load balancingDirecting a request to the right instance — accounting for which model or adapter is loaded, current queue depth, and which serving phase an instance handles.18 min
  3. 03 / 04Observability and costMonitoring a production inference system — the metrics that matter, attributing cost per request, and catching degradation before users do.32 min
  4. 04 / 04Testing and safe deploymentRolling out a new model version or serving configuration without downtime, and catching a regression before it reaches all production traffic.30 min
Esc
↑↓ navigate↵ open? shortcuts

Keyboard shortcuts

Press Esc to close

Anywhere

⌘K
Search and commands
/
Search
?
This sheet
Esc
Close

Reading a lesson

J
Next lesson
K
Previous lesson
B
Bookmark