Pidoku

The Inference Engineer

Module 1 Lesson 1.g 30 min Difficulty 1/5

Prerequisites 1.a–1.f


1. What is it?#

An inference engineer makes trained models run as fast, cheap and reliable services. The job spans the whole stack, from a GPU kernel to a fleet of racks, and that breadth is what makes it hard: problems hide at the boundaries between layers.

This lesson does two things. It describes the job — the layers, the questions you will be asked and the skills behind them — and it maps every layer to the module of this material that teaches it. Use it as your table of contents.


2. The stack, top to bottom#

flowchart TB
  U["Users, apps and agents"] --> P
  subgraph P["Platform — many models, many teams"]
    direction LR
    P1["gateway, auth, quotas"] --- P2["KV-aware routing"] --- P3["autoscaling, placement"]
  end
  P --> S
  subgraph S["Serving system — one model as a service"]
    direction LR
    S1["queues, admission"] --- S2["prefill / decode pools"] --- S3["KV cache tiers"]
  end
  S --> E
  subgraph E["Inference engine — vLLM, SGLang, TensorRT-LLM"]
    direction LR
    E1["scheduler, batching"] --- E2["KV cache manager"] --- E3["model runner, kernels"]
  end
  E --> H
  subgraph H["Hardware — GPUs, accelerators, network"]
    direction LR
    H1["SMs, tensor cores"] --- H2["HBM"] --- H3["NVLink, InfiniBand, Ethernet"]
  end

  class U neutral
  class P1,P2,P3 queue
  class S1,S2,S3 queue
  class E1,E2,E3 compute
  class H1,H2,H3 memory
LayerTypical questionsModules
Why and whatIs this worth serving ourselves? What will it cost?1, 2
The computerWhy is the CPU at 100% while the GPU idles? Why does the model take four minutes to load?3
The GPUIs this kernel bandwidth or compute bound? Why is utilisation 100% but throughput low?4, 5, 6
The hardware choiceH200, B300, MI355X or TPU for this model? How many?7, 8
The networkWhy does tensor parallelism across two nodes make it slower? How fast can we move a KV cache?9
The modelWhat does the forward pass compute, and where does the time go?10, 11
LLM inferenceHow much KV cache does this context need? How many users fit on a GPU?12
OptimisationFP8 or FP4? Which speculative decoding method? What does FlashAttention buy us?13
Many GPUsWhich parallelism for a 1T MoE model? Should we disaggregate?14
The enginevLLM, SGLang or TensorRT-LLM? What do these flags actually do?15–19
The serviceHow do we queue, shed load, stream and roll out new versions?20
The platformHow do fifty teams share one GPU fleet fairly?21
PerformanceWhere exactly are the milliseconds going?22
ProductionWhat is our SLO, our cost per token, our failure plan?23
What nextIs this new paper relevant to us?24

3. The skills that transfer#

Tools change every release. These skills do not:

  1. Back-of-the-envelope arithmetic. Bytes per token, FLOPs per token, KV cache per request, GPUs per thousand users. You will do this in nearly every lesson. If the estimate and the measurement disagree by more than 2x, something is misconfigured.
  2. Bottleneck thinking. Every system is limited by one resource at a time: compute, memory bandwidth, memory capacity, network, the CPU, or a queue. Find it before optimising anything.
  3. Measuring correctly. Time to first token, inter-token latency, throughput at a latency target, goodput. A benchmark without a latency target is not a result.
  4. Reading source code. Engines change faster than their documentation. Modules 16–19 read vLLM at a pinned commit to teach this skill.
  5. Systems design under cost. Every design choice has a price per token. Be able to say it.

4. How this material is organised#

The material goes from why to what to how to at scale:

flowchart LR
  subgraph W["Why"]
    M1["1 · Big picture"]
    M2["2 · Physics"]
  end
  subgraph MA["The machine"]
    M3["3 · Computer"]
    M4["4–6 · GPU"]
    M7["7–8 · Hardware"]
    M9["9 · Networking"]
  end
  subgraph MO["The model"]
    M10["10 · ML foundations"]
    M11["11 · Computation"]
    M12["12 · LLM inference"]
    M13["13 · Optimization"]
  end
  subgraph EN["Many GPUs and the engine"]
    M19["14 · Distributed"]
    M14["15 · Engines"]
    M15["16–19 · vLLM"]
  end
  subgraph SC["At scale"]
    M20["20 · Serving"]
    M21["21 · Platforms"]
    M22["22 · Performance"]
    M23["23 · Production"]
    M24["24 · Frontier"]
  end
  W --> MA --> MO --> EN --> SC

  class M1,M2 neutral
  class M3,M4,M7,M9 memory
  class M10,M11,M12,M13 compute
  class M19,M14,M15 io
  class M20,M21,M22,M23,M24 queue

Each module opens with an overview page, and every lesson assumes only what came before it. Each idea is taught once, in the place where you first need it, and later lessons link back to it instead of repeating it. Lesson labels such as 12.e mean module 12, lesson e.

Shortcuts#

You already knowYou can skim
Operating systems and Linux wellModule 3 (but read 3.g, model loading)
CUDA programmingModule 5; read 5.f (CUDA graphs)
Transformers and PyTorchModules 10–11; read 10.k and 10.l (number formats, quantization)
Distributed systems and Kubernetesparts of Modules 20–21; read 21.h (prefix-aware routing)

Do not skip Module 2 or Module 12. Everything else depends on them.


5. About the code#

Examples are there when running something teaches more than reading about it. They are written in whichever language fits the lesson:

  • Go for the systems around the model — schedulers, batchers, caches, routers, load generators and calculators. Each is a single file that runs with go run and only the standard library, so you can change a number and see what happens.
  • CUDA, Triton and Python where the lesson is about those APIs (kernels, PyTorch, vLLM internals). Translating them would teach something that does not exist.
  • Shell and YAML for running and deploying real engines.

You do not need to write Go to follow this material. Read the examples as precise pseudocode if you prefer, and run the real engines in Python.

Hardware: most of Modules 1–4 and 10–12 run on a laptop. A single NVIDIA GPU — a rented L4, A10G or consumer RTX card — is enough for most exercises after that. Multi-GPU lessons say when they need more and give a single-GPU fallback.


6. Hands-on exercise#

  1. Find two inference-engineering job postings. Map each requirement to a row of the table in section 2.
  2. Write down the one layer you know least about. Read that module’s overview page now, so you know what is coming.
  3. Set up your environment: install Go (optional), Python 3.11+, and get access to one NVIDIA GPU (local or rented). Lesson 16.b uses it to start your first vLLM server.

7. Interview questions#

  1. Walk me through what happens between a user pressing Enter and the first token appearing. Name each layer it passes through.
  2. A colleague says “the GPU is at 100% utilisation, so we need more GPUs.” What do you check first?
  3. Which three numbers would you ask for before estimating how many GPUs a new model needs?

↑↓ navigate↵ openesc close

100% drag to pan · scroll or pinch to zoom · double-click to zoom in