AI Infra Interviews logo

Handbooks 01 / Version 2 · October 2026 / Premium PDF

The LLM Inference Systems Design Handbook

From one GPU to a fleet: how serving systems batch, cache, schedule and scale, with every number worked.

Follow one request from the socket to the last token. Size the KV cache for a 70B model on eight H100s. Choose an operating point from a latency target, then scale out, route, autoscale and debug the fleet. Seventeen chapters, one running example, and the arithmetic an interviewer expects you to do out loud.

Premium guide PDFs and companion files require an active paid Premium membership or approved complimentary access. Referral Premium includes the rest of the site, but excludes these downloads. Keep the copies you download.

New to tokens, model weights or GPU memory? Read the short prerequisite guide ↓

Already a member? Sign in to download your copy →

The LLM Inference Systems Design Handbook cover: a stream of tokens flowing into an accelerator and settling into a grid of paged KV-cache blocks
60illustrated pages, 17 chapters
17diagrams and charts drawn from the worked numbers
8 + 42mock design rounds and self-check questions with answers

Read three pages before you decide

See how each chapter works through the numbers.

Read the selected pages below as text, including descriptions of the diagrams, or open their printed layouts. They cover GPU memory, the throughput-latency curve and the handoff between prefill and decode.

Sample page 13

The KV cache decides how many users fit

View the printed page ↗
What the diagram shows
GPU memory budget, in decimal GB. Of 80 GB, 8 GB is outside the engine allocation. Within its 72 GB allocation, 17.5 GB holds weights, 4 GB is runtime reserve and 50.5 GB is KV cache. Eight TP8 GPUs provide 404 GB of logical cache. At 320 KiB per token, the memory ceilings are 602 sequences at 2,048 tokens each, 301 at 4,096, 150 at 8,192 and 37 at 32,768. These counts do not guarantee a latency target.

One GPU of a TP8 node under the stated assumptions: 0.9 memory fraction, 17.5 GB weight share and a 4 GB runtime reserve. The concurrency bars are memory ceilings, not latency guarantees.

Average tokens held per sequenceConcurrent sequences that fit
2,048602
4,096301
8,192150
32,76837

Three cautions keep this answer honest. First, "tokens held" is prompt plus output so far, and it grows during the response, so plan on the length at completion, not at arrival. Second, the table is a memory ceiling. Whether 301 sequences at 4K context also meet a latency target is a separate question that Chapter 9 answers, and usually the answer is no. Third, the reserve and utilization fraction are assumptions; the engine prints the real KV capacity at startup, and that printed number beats any napkin.

Three ways to buy more cache

Fewer bytes per element. Storing keys and values in FP8 halves the cache to 160 KiB per token and roughly doubles the sequences that fit. vLLM exposes this as --kv-cache-dtype.[26] Quality has to be measured on your workload, because attention can be sensitive to key precision in particular.

Fewer weight bytes per GPU. Every gigabyte of weights removed becomes cache. FP8 weights free about 8.75 GB per GPU in the example. Across the node that is 70 GB, room for about 214,000 more tokens of cache. Chapter 12 treats weight and KV precision as two separate decisions, because they are.

Sample page 31

Find the operating point, then size the fleet

View the printed page ↗
What the diagram shows
Decode-only throughput versus step time. At batch 1: 83 output tokens/s and 12.0 ms; batch 32: 2,112 and 15.2 ms; batch 64: 3,486 and 18.4 ms; batch 128: 5,168 and 24.8 ms; batch 256: 6,810 and 37.6 ms. A horizontal 25 ms target intersects near batch 130 and 5,200 tokens/s. The model assumes 4,096 cached tokens per sequence, 50 percent of peak bandwidth and 1.5 ms fixed overhead. Only batches up to the 301-sequence memory ceiling are plotted. It does not predict mixed-workload p99 latency.

Decode-only model: 4,096 tokens of context per sequence, 50 percent of peak bandwidth and 1.5 ms fixed overhead per step. The 25 ms line gives a candidate near 130 sequences. Mixed-load p99 latency still needs measurement.

Choosing the point

For a 25 ms ITL target, solve t(B) = 25 ms: about 130 sequences and about 5,200 tokens per second. Running 256 gives 31 percent more throughput but misses the step-time target. Running 64 gives about 33 percent less throughput, with more headroom for interference or jitter. Lower throughput alone does not prove that hardware is wasted.

Measure before trusting the model. Prefill shares the same steps, so a real mix yields fewer decode tokens per second, and the SLO is on p99 gaps, which chunked prefill, preemption and jitter push above the average. Run the load test from Chapter 8 and read the operating point off the measured goodput curve.[4]

Little's law turns traffic into concurrency

Little's law says the average number of items in a stable system equals their arrival rate times the average time each spends inside.[21] Choose the boundary first. Arrival to last token counts requests waiting, prefilling and decoding. The batch B in our curve counts only sequences actively decoding.

Worked example.

10 requests arrive per second and each takes 20 seconds from arrival to last token. On average 10 × 20 = 200 requests are in flight.

Sample page 37

Separate prefill and decode only when it pays

View the printed page ↗
What the diagram shows
Time runs downward. Here the prefill pool sends token 1 before the KV handoff finishes. The remaining transfer delays token 2, so it affects the first token gap. An 8,192-token prompt carries 2.5 GiB. A design that withholds token 1 until handoff instead adds that wait to TTFT. The client sends a prompt to the prefill pool, which returns token 1. The cache handoff to the decode pool must finish before that pool produces token 2. The arrows show event order, not proportional elapsed time.

Time runs downward. Here the prefill pool sends token 1 before the KV handoff finishes. The remaining transfer delays token 2, so it affects the first token gap. An 8,192-token prompt carries 2.5 GiB. A design that withholds token 1 until handoff instead adds that wait to TTFT.

Transfer time.

Over one 400 Gb/s NIC at an assumed 50 GB/s effective: about 53.7 ms. Spread across eight such NICs, one per GPU: about 6.7 ms. Compare with about 290 ms to compute that prefill (Chapter 2).

Which latency grows depends on who sends the first token. In the figure, the prefill pool streams token 1 to the client before the handoff finishes. The remaining transfer delays token 2, so it appears in the first-to-second-token gap. If a design waits for the decode pool to send token 1, that remaining transfer instead contributes to TTFT. Trace the client-visible events before adding times.

Layer-by-layer transfer can overlap some of the copy with prefill, but the decode pool must have the required state before it uses it. The transfer needs a fast network and a library that moves GPU memory directly, such as NVIDIA's NIXL through vLLM's connector.[30] The 50 GB/s example is the raw 400 Gb/s rate used as an optimistic payload assumption; protocol and contention overhead make a real copy slower. Measure the effective payload rate and the portion hidden by overlap separately.

The other costs are operational. Two pools must be sized against each other, and the right ratio changes with the traffic's prompt-to-output mix. A burst of long prompts backs up the prefill pool while decode sits idle, or the reverse. Dynamo's planner and llm-d's scheduler exist largely to keep that ratio right as traffic shifts.[32][33]

New to serving models?

Before your first calculation

A serving system takes a prompt, runs a model and sends the generated answer back. The handbook follows the resources that request needs: GPU memory to hold its state, compute to process it and time in a shared queue.

Token
A tokenizer turns text into numbered vocabulary entries, often word fragments. The prompt and answer both contain tokens. Different tokenizers can count the same text differently.
Parameter or weight
A learned number used in the model's calculations. A 70B model has roughly 70 billion parameters. Its weights are reused across requests.
BF16
A format storing each value in 16 bits, or 2 bytes. Counting 70 billion weights at 2 bytes each gives about 140 GB before any request state or workspace.
KV cache
The keys and values retained from earlier token positions so the model can reuse them while generating. Unlike shared weights, this state usually grows for each active conversation.
GPU and H100
A GPU performs many calculations in parallel and has its own fast memory. The H100 SXM example has 80 GB per GPU. Eight connected GPUs provide room for the weights and requests; Chapter 10 explains how work is split.

Keep units consistent: 1 GB = 1,000,000,000 bytes, 1 GiB = 1,073,741,824 bytes and 1 KiB = 1,024 bytes. Convert both a memory budget and a request's footprint to bytes before dividing them. A GB and a GiB are different-sized units.

Attention compares a new token's query with earlier keys and uses the matching values. A head is one such attention calculation. Our model has 64 query heads sharing 8 sets of keys and values, so the cache formula counts 8 KV heads. Chapter 3 works through the dimensions.

Who it is for

Written for the design round, and for the pager after it.

Preparing for an inference or ML-infrastructure loop

The design round asks you to size a fleet, choose a batching policy and defend a latency target. Most chapters end with how to say it in the room, and Chapter 16 runs eight full design rounds.

Moving from backend engineering into AI infrastructure

You know queues, caches and load balancers. The handbook shows where LLM serving breaks those instincts: memory that grows per token, steps that mix two workloads, and a tail that compounds.

Operating a serving fleet today

Failure drills start from what a dashboard shows and name the first metric to split. Admission, autoscaling and routing chapters give the signals to act on and the numbers to set them.

Already studying the concepts and the course

Concept pages explain one mechanism each. The handbook joins them: one running example carried through every decision, and self-check questions with worked answers at the end of each chapter.

Contents

Seventeen chapters, one system.

Foundations

  1. Follow one request from the socket to the last token
  2. Use the roofline to form a performance hypothesis
  3. The KV cache decides how many users fit

The engine

  1. Batching, from fixed groups to every step
  2. Paging the cache, and what happens when it fills
  3. Reusing work that other requests already paid for
  4. Scheduling mixed work with a token budget

Service levels

  1. Measure what users feel: TTFT, ITL, tails and goodput
  2. Find the operating point, then size the fleet

Scaling out

  1. Splitting a model across GPUs for serving
  2. Separate prefill and decode only when it pays
  3. Making each decode step do more: speculation and precision

The fleet

  1. Admission, backpressure and autoscaling
  2. Many models, many tenants, one fleet
  3. Failure drills: symptoms, first checks and fixes

Practice

  1. Eight mock design rounds, with what a strong answer contains

Reference

  1. Formula sheet and glossary

A calculation from Chapter 3

How many users fit on eight H100s?

Llama 3.1 70B has 80 layers and 8 key/value heads of dimension 128. Each BF16 value takes 2 bytes, and each head stores both a key and a value. One token's cache is therefore 2 × 80 × 8 × 128 × 2 bytes = 327,680 bytes. Divide by 1,024 to get 320 KiB. At 32,768 tokens, the conversation holds 10 GiB of cache.

Give the engine 90 percent of each 80 GB GPU, subtract a 17.5 GB weight share and a 4 GB runtime reserve, and each GPU keeps 50.5 GB for cache: 404 GB across the node, about 1.23 million tokens. At an average of 4,096 tokens per sequence that is about 301 concurrent sequences. That is a memory ceiling. The handbook then shows why a 25 ms latency target lands nearer 130.

Try your own model in the KV-cache calculator → · Read the KV cache sizing concept →

Interview questions it prepares you for

Practice the prompts, then check the reasoning.

Each prompt below has its own worked answer on the site. The handbook gives the system-level reasoning that connects them.

How it was made

Worked calculations, with sources and assumptions.

Mechanisms come from the original papers, including Orca, PagedAttention, SGLang, Sarathi-Serve, DistServe, Splitwise, Mooncake and speculative decoding, and from vendor specifications and maintainer documentation. The handbook cites 40 primary sources by number. Its worked examples and self-check answers are recomputed by the build and must match the text before an edition ships.

What changed in Version 2

The 18 October revision separates a roofline ceiling from a measured bottleneck. Chapters 2, 9 and 11 now state the memory boundary, cache and work-distribution assumptions behind their estimates. The running H100 example and checked arithmetic are retained. For the next practical step, the Premium GPU work-mapping project lets you explore layouts, partial waves and scan offsets on a CPU.

Every chapter opens with links to the concept pages and questions that go deeper:

The KV cacheContinuous batchingPagedAttentionPrefix cachingChunked prefillTTFT, TPOT and goodputDisaggregated prefill and decodeSpeculative decodingMulti-LoRA serving

Reviewed 2026-10-18. Calculations are first-order estimates with stated assumptions; no GPU benchmark was run. Prices in examples are illustrative, not quotes. The cover is conceptual vector artwork.

Questions

Before you download

How do I get the PDF?

The complete PDF requires active paid Premium membership or approved complimentary access. Referral Premium does not include this download. Sign in with an eligible account, then download it from this page. You keep the copies you download, and new editions are available while your access is active. The three sample pages above are free to read.

Does it replace the concept pages and the Inference Engineering course?

No. Concept pages explain one mechanism each, and the course teaches in short lessons. The handbook connects them into whole designs: one running example carried from a single request to a sized, routed and debugged fleet, with the arithmetic done at every step. Every chapter links to the concept pages and questions that go deeper.

Which engines and hardware does it cover?

The mechanisms apply to any modern serving engine. Examples cite vLLM and SGLang documentation, NVIDIA Dynamo, llm-d and the Kubernetes Gateway API Inference Extension, and the worked numbers use H100 specifications. Engine flags change between releases, so the handbook names the setting and links the maintainer's page.

Are the numbers benchmarks?

No. They are first-order calculations from published specifications and model configurations, with every assumption stated so you can replace it with a measurement. Where a paper reports a measured result, the handbook attributes it to the authors. No GPU benchmark was run for this edition.

Are the interview rubrics from real companies?

No. The rubrics in the mock rounds describe what strong answers tend to contain. They are a study aid written for this handbook, not any company's grading criteria.

Keep the other guides beside it.

The AI Infrastructure Field Guide builds the foundations from the first tensor to distributed systems. The AI Accelerator Field Guide compares GPUs and TPUs and is free with an account. The Open Model Field Guide covers model releases, architectures and deployment paths.