Pidoku

The State of Inference

Module 1 Lesson 1.e 45 min Difficulty 1/5

Prerequisites 1.a–1.d


1. What is it?#

This lesson is a snapshot of the industry you are learning to work in. It names the workloads, the hardware, the software and the money as they stand today. Every later module explains one piece of this picture in depth. Here you see the whole thing at once, so you know why each piece matters.

Facts were checked on 11 November 2026. Versions, prices and roadmaps move every month, so every claim below has a source at the end of the lesson. Treat any number here as true on that date, not forever.

The short version:

  2023                                  2026
  ────                                  ────
  chatbots answering one question       reasoning models and agents doing multi-step work
  a few hundred output tokens           thousands to tens of thousands of tokens per task
  dense models, 7B–70B                  mixture-of-experts models, hundreds of billions to 1T+
  one GPU or one 8-GPU server           racks of 72 GPUs on one NVLink domain
  FP16 weights                          FP8 standard, FP4 on Blackwell and newer
  "put it behind Flask"                 disaggregated prefill/decode, KV-aware routing,
                                        multi-tier KV caches, dedicated serving frameworks
  training was the big bill             inference is the big bill

2. Why does it matter?#

You can learn every mechanism in this material in isolation — the KV cache, batching, quantization, tensor parallelism — and still not know which ones matter for a real system. The answer depends on what the workload looks like now. A technique that was a research curiosity in 2023 (disaggregated serving) is the default architecture in 2026. A tool that was the default in 2024 (Hugging Face TGI) is archived. If you study from an outdated picture, you optimise for a world that no longer exists.


3. Simple analogy#

Think of the electricity grid. A power plant (the GPU) is useless without transmission lines (the network), substations (the serving software) and a market that decides who gets power at what price (routing, scheduling and cost). In 2023 most of the effort went into building bigger power plants. In 2026 the plants are still growing, but the hard engineering has moved to the grid: moving the KV cache between machines, routing each request to the GPU that already holds its context, and pricing tokens so the whole thing pays for itself.


4. The workloads#

Inference is now the larger share of AI compute#

For the first years of the LLM boom, the expensive, visible part was training. That has flipped. Industry analyses in 2026 project that spending on inference hardware passes spending on training hardware, and custom accelerators built mainly for inference (TPU, Trainium, the Groq-derived LPX) are the fastest-growing segment. The reason is in lesson 1.b: training is paid once per model; inference is paid on every request, for as long as the model is in use.

Reasoning models multiply tokens per request#

A reasoning model “thinks” before it answers: it generates a long chain of intermediate tokens the user may never see. A chat answer of 300 tokens can become a 5,000–20,000 token reasoning trace. Estimates of the extra compute per query range from about 10x to 100x for hard tasks. Two consequences you will meet throughout this material:

  • Decode dominates. Generating tokens one at a time is memory-bandwidth bound (lesson 2.e). More output tokens means more time in the slowest, least efficient phase.
  • The KV cache grows with every token. Long reasoning traces hold large amounts of GPU memory for the whole request (12.e, 12.f), which limits how many users fit on a GPU.

Agents multiply requests per task#

An agent is a model in a loop: it plans, calls a tool, reads the result, and calls the model again. One user task becomes tens or hundreds of model calls. Three properties of agent traffic change how serving systems are built:

  1. Huge prefix reuse. Every turn re-sends the system prompt, the tool definitions and the conversation so far. Most of each prompt was already processed on the previous turn. Reusing that work (prefix caching, 12.m) is now the largest single saving for agent workloads.
  2. Long, growing contexts. Contexts of 100k+ tokens are routine, so the KV cache no longer fits in GPU memory alone. It spills into CPU memory, local SSD and shared storage (14.k, 14.l). Research in 2026 reports that for multi-turn agent workloads, the time to load cached KV from storage, not the arithmetic, is often the bottleneck.
  3. Latency compounds. If one agent step takes two seconds and a task takes forty steps, the user waits more than a minute. Fast decode (high tokens per second per user) has become a product feature, which is why hardware built for fast decode (SRAM machines, 7.k) is back.

Multimodal and non-text models#

Production traffic increasingly includes images, audio and video as inputs, embedding and reranking models behind search, speech recognition, and diffusion models that generate images, video, and — newly — text. Diffusion language models (DiffusionGemma, Inception’s Mercury, ByteDance’s Seed Diffusion) generate many tokens in parallel per step and advertise 4–10x faster single-request generation than comparable autoregressive models. They are early in production, but vLLM already serves some of them. Module 24 covers what they change.


5. The models#

Open-weight models are close enough to the frontier that many companies self-host. The open models that dominate the engines’ release notes in late 2026 — DeepSeek-V4, Kimi-K3, GLM-5.3, Qwen3.8, MiniMax-M3 — share an architecture pattern you will study in detail:

TrendWhat it means for inferenceWhere it is taught
Mixture of experts (MoE)Hundreds of billions to over a trillion parameters, but only a few percent active per token. Memory is huge; compute per token is modest. Serving them well needs expert parallelism across many GPUs.14.g, 14.h
Compressed attention (GQA, MLA)Fewer or compressed key/value heads shrink the KV cache by 4–30x.12.g
Sparse and hybrid attentionDeepSeek-style sparse attention reads only the most relevant past tokens; hybrid models (Qwen3-Next, Kimi Linear and their successors) mix linear-attention layers with a fixed-size state and a few full-attention layers. Engines now manage several kinds of cache at once.17.i, 24.b
Built-in draft heads (MTP)Models ship with extra heads that predict several tokens ahead, used for speculative decoding without a separate draft model.13.n, 13.o
Low-precision checkpointsOfficial FP8 and NVFP4 releases, so quantization is often done by the model maker, not you.13.e, 13.g

The practical lesson: a 2026 model is rarely “one dense transformer that fits on one GPU”. It is a sparse, multi-GPU, multi-cache system before you serve a single request.


6. The hardware#

VendorIn volume todayShipping or ramping nowTaught in
NVIDIAHopper H100/H200, Blackwell B200/B300, GB200/GB300 NVL72 racksVera Rubin (HBM4, ~22 TB/s per GPU) in the second half of 2026; Groq 3 LPX decode racks7.a–7.f
AMDInstinct MI300X, MI325X, MI355XHelios racks of 72 MI455X GPUs, shipping from late Q3 20267.h
GoogleTPU v5e, v6e (Trillium), v7 (Ironwood)TPU 8 previewed, split into a training chip (8t) and an inference chip (8i)7.i
AWSInferentia2, Trainium2Trainium3 UltraServers7.j
SRAM machinesGroq (licensed to NVIDIA), Cerebras—7.k

Three facts shape almost every hardware decision:

  • Memory bandwidth is the decode bottleneck, so each generation’s headline for inference is its HBM bandwidth, not its FLOPs (4.e).
  • The unit of deployment is now a rack. A GB300 NVL72 puts 72 GPUs on one NVLink domain, so a trillion-parameter MoE model can be served as if on one giant GPU (7.d).
  • No single chip wins every workload. Independent benchmarks (SemiAnalysis InferenceX, which tests GB300 NVL72 against MI355X and others nightly) show the cheaper platform per million tokens changes with the model and with the interactivity target. The only reliable answer is to benchmark your model at your latency target (Module 8, 22.g).

7. The software#

LayerThe main open options (late 2026)Status
Inference engine — runs the model on GPUs, batches, manages the KV cachevLLM (v0.32.0, 18 Oct 2026), SGLang (v0.5.23, 2 Nov 2026), TensorRT-LLM (v1.2 stable, 1.4 in release candidates), llama.cpp / Ollama for local and edgevLLM and SGLang are the defaults for open models; TensorRT-LLM for maximum NVIDIA performance
Distributed serving framework — many engines as one serviceNVIDIA Dynamo (v1.6.2, 5 Nov 2026), llm-d (v1.0.0, 20 Oct 2026, a CNCF Sandbox project)Both do disaggregated prefill/decode and KV-aware routing; Dynamo is engine-agnostic, llm-d is Kubernetes-native
Routing standardKubernetes Gateway API Inference Extension (v1.6, its endpoint picker chooses a replica using KV cache and load)Implemented by llm-d, kgateway, agentgateway and others
KV cache tiersLMCache, Mooncake, NVIDIA NIXL for transfersMoving KV between GPU, CPU, SSD and remote storage
RetiredHugging Face TGI — maintenance mode from December 2025, repository archived; Hugging Face points new deployments to vLLM or SGLangDo not start new projects on it

Module 15 compares the engines, Modules 16–19 take vLLM apart, and 21.j covers Dynamo and llm-d.


8. The techniques that became defaults#

A technique moves from “paper” to “default” when every major engine ships it on by default. In 2026 these are defaults for LLM serving:

flowchart LR
  subgraph D["Default in every major engine"]
    direction TB
    A["Continuous batching<br/><small>12.j</small>"]
    B["Paged KV cache<br/><small>12.l</small>"]
    C["Prefix caching<br/><small>12.m</small>"]
    E["Chunked prefill<br/><small>12.k</small>"]
    F["FP8 weights and KV<br/><small>13.e</small>"]
    G["CUDA graphs + compiled kernels<br/><small>13.k, 13.m</small>"]
  end
  subgraph S["Standard at scale"]
    direction TB
    H["Disaggregated prefill / decode<br/><small>14.j</small>"]
    I["KV-aware routing<br/><small>21.h</small>"]
    J["KV offload to CPU / SSD / remote<br/><small>14.k</small>"]
    K["Wide expert parallelism<br/><small>14.e, 14.h</small>"]
    L["Speculative decoding (EAGLE-3, MTP)<br/><small>13.n</small>"]
  end
  subgraph N["Arriving now"]
    direction TB
    M["FP4 weights and KV cache<br/><small>13.g</small>"]
    O["Attention / FFN disaggregation<br/><small>24.j</small>"]
    P["Hybrid and sparse attention caches<br/><small>17.i</small>"]
    Q["Diffusion LLM serving<br/><small>24.j</small>"]
  end
  D --> S --> N

  class A,B,C,E,F,G compute
  class H,I,J,K,L queue
  class M,O,P,Q warn

9. The economics#

  • Prices per token keep falling fast. For a fixed level of capability, the price per million tokens has dropped by roughly an order of magnitude per year since 2022. Better hardware, FP8 and FP4, MoE models and serving software each contribute.
  • Total spend still rises. Cheaper tokens unlock reasoning and agents, which use far more tokens. This is why inference engineers are in demand even as each token gets cheaper.
  • Cost is a function of latency. Serving the same model at 30 tokens/s per user can cost a fraction of serving it at 150 tokens/s per user, because faster per-user speed means smaller batches (2.d). Every price you see assumes an interactivity target; ask which one.
  • The power wall is real. New AI data centers are planned in gigawatts. A Rubin NVL72 rack needs on the order of 200 kW and liquid cooling (7.l). Power and cooling, not chips, often decide how fast capacity can grow.

10. Common mistakes when reading the landscape#

  1. Treating vendor benchmarks as neutral. “Up to 30x” claims compare a new system at its best point against an old one at a bad point. Look for independent, reproducible numbers.
  2. Ignoring the interactivity target. Throughput per GPU without tokens/s per user is meaningless.
  3. Assuming the newest technique applies to you. Disaggregation pays off for long prompts at large scale; for a small model on two GPUs it adds complexity and nothing else.
  4. Copying a dated tutorial. Engine flags and defaults change every release. Check the release notes for the version you run.

11. Hands-on exercise#

  1. Open the release notes of the latest vLLM and SGLang releases. List three features in each and find the module of this material that explains the idea behind each one.
  2. Pick one open model you might serve. From its model card, write down: total and active parameters, attention type (MHA, GQA, MLA, sparse, hybrid), maximum context, and the precisions it is published in. You will compute its memory footprint in 12.f.
  3. Open the InferenceX dashboard, pick one model, and find the interactivity level at which the cheapest platform changes. Write one sentence explaining why (you will be able to explain it fully after Module 12).

12. Interview questions#

  1. Why has inference overtaken training as the larger share of AI compute spending?
  2. How do reasoning models and agents change the ratio of prefill to decode work?
  3. Why is prefix caching worth more for agent workloads than for single-turn chat?
  4. A vendor claims 3x better tokens per dollar than a competitor. What three questions do you ask?
  5. Why did disaggregated prefill and decode move from research to default between 2024 and 2026?

Sources#

Checked on 11 November 2026.

↑↓ navigate↵ openesc close

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