Unit 4 of 11 · about 5 hours · derive
Communication volume, topology, and small-batch latency against capacity
Serving decode repeatedly pays small collective startup costs. A topology that fits the model can still miss the token-latency target even when its bandwidth-only estimate looks cheap.
You'll be able to
- Derive per-decode-step and per-prefill-pass collective and stage-boundary traffic with an explicit per-rank or aggregate convention.
- Map that traffic onto PCIe, NVLink, NVSwitch and network paths, including shared bottleneck links.
- Explain when more ranks provide memory capacity but increase small-batch latency after communication startup and dependencies are included.
Covers
Read
In this order, only the parts listed
0 of 2 done
- Serving activation trafficLLM Inference: From scratch, one token at a time - Module 09
Module 09, Tensor parallelism: split inside the layer - Communication volume; Pipeline parallelism: split across layers - Communication is tiny; Math by hand, Parts 3 and 4
Do the byte arithmetic, not the supplied hardware time estimates. The page mixes directional and bidirectional link peaks and calls a whole decode batch step's traffic per-token traffic. Use per-step bytes, a declared directional effective bandwidth and the startup term from your GPU communication model.
- Placement across links and nodesHands-On LLM Serving and Optimization - Chapter 7, multi-GPU and disaggregation
Chapter 7, Tensor Parallelism and Pipeline Parallelism, printed pp. 247 to 250, Figures 7-10 and 7-11
Treat the flowchart as candidate generation, not proof that TP needs NVLink or that a single-device plan always wins. Check the declared SLO and actual topology.
Focus on
- Reuse Ring and tree all-reduce, all-gather and reduce-scatter volume, Interconnects and topology: PCIe, NVLink, NVSwitch and RDMA, and NCCL algorithms, protocols, channels and rank placement. New work here is multiplying those costs by serving-layer frequency.
- For a replicated-activation dense schedule, message size is , with batch size , processed positions per sequence , hidden width and bytes per element . Decode has ; prefill uses its scheduled prompt or chunk length.
- With ranks, ring all-reduce sends bytes per rank. Two reductions per layer over layers cost matched collectives per pass. This is an implementation assumption, not a universal transformer law.
- Use for a simple ring model with per-step startup and directional effective bandwidth . PP sends one activation per stage boundary and retains the serial stage path. Shared links, uneven ranks and overlap change exposed time.
Common mistakes · 3
- Calling batch-step wire bytes bytes per output token without dividing by the number of active sequences. A step can generate many tokens, while each request still waits for the complete step.
- Using bidirectional aggregate peak as one rank's send bandwidth, or adding send and receive bytes and comparing them to a one-direction rate.
- Assuming a node count identifies the fabric. TP groups inside one node may cross slow PCIe or socket paths, while some NVLink domains span multiple nodes.
Try it yourself
Closed-book, before checking anything
Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.What changes when the example processes 128 positions instead of one?Answer
The activation message and bandwidth term grow 128-fold. The assumed collective count and each collective's startup term do not. Kernel efficiency and attention cost can also change.
2.Why can a tiny decode message still make TP slow?Answer
Many dependent collectives repeatedly pay startup and wait for the slowest participating rank. Dividing only bytes by bandwidth omits those costs.
3.Does PP's smaller traffic prove it has lower isolated-request latency?Answer
No. The request still traverses every stage sequentially and pays stage-boundary transfers. Its benefit may instead be model capacity or throughput with enough independent work.
4.What must change in the model when two transfers share one NIC?Answer
Their combined offered bytes compete for that NIC's directional capacity. They cannot both receive its full effective bandwidth at the same time.
You're done when
Your byte ledger reconciles per-rank and aggregate traffic, and your synthetic sweep identifies a capacity-feasible TP plan that loses latency after startup is restored.
Only when you can do this without notes.
Leads to
Notes
Resources · 2 for this unit, 11 more in the section
- Hands-On LLM Serving and Optimization - Chapter 7, multi-GPU and disaggregationChi Wang and Peiheng Hu (O'Reilly) · support
Read "Multi-GPU and Multi-Node Inferencing" (data, tensor, pipeline and expert parallelism) and "Prefill-Decode Disaggregation" (architecture, KV transfer, when to use it) in Chapter 7.
- LLM Inference: From scratch, one token at a time - Module 09Tushar Amrit · support
Work the Distributed Inference module's communication arithmetic before the tensor and pipeline parallel units.
Also in this section
- DistServe: Disaggregating Prefill and Decoding for Goodput-Optimized LLM ServingPeking University and Microsoft Research · primary
Read the interference model, independent phase parallelism, placement, KV transfer and goodput evaluation. Reuse the break-even method with your workload and topology; do not transfer the paper's speedups to different hardware.
- AI Systems Performance Engineering - Chapters 15 and 17, distributed and disaggregated inferenceChris Fregly (O'Reilly) · required
Read the disaggregated prefill and decode architecture and the MoE parallelism strategies in Chapter 15, then Chapter 17 on disaggregated pools, routing policies and scalability. Reproduce every communication and KV-transfer estimate for a small declared topology.
- AI Systems Performance Engineering companion code - Chapters 15 and 17Chris Fregly · required
Use the single-device KV-handoff and simulation paths before the multi-GPU pairs. Then choose one disaggregation, routing or MoE target compatible with available hardware and keep bundled results separate from newly captured evidence.
- NVIDIA Dynamo - Disaggregated Serving and KV-Aware RoutingNVIDIA · required
Trace frontend, prefill router, prefill worker, KV transfer, decode routing and decode worker. Record how load, cache overlap, worker discovery and transfer metadata affect placement; implement only a small simulated or available-hardware slice.
- TensorRT-LLM Disaggregated Serving and KV Cache ExchangeNVIDIA · required
Study the KV exchange abstraction, unique request identity, layout conversion, overlap and fleet-worker model. Use its reproducible benchmark sections only on supported hardware and pin the release.
- SGLang documentation - PD DisaggregationSGLang Project · support
Use the transfer backends, router integration, heartbeat, timeout and cleanup behavior as a second engine's view of the same handoff.
- Mooncake: A KVCache-Centric Disaggregated Architecture for LLM ServingMoonshot AI · support
Read the KV-centric architecture, transfer engine and scheduling sections to understand remote cache pools. Compare its assumptions with DistServe and your simpler handoff; defer reproduction requiring a large cluster.
- 100 Days of LLM Inference - Days 12, 17 and 18Elizabeth Thomas · support
Use the Dynamo, model-parallelism and disaggregation notebooks for a compact topology simulator and request-handoff trace. Label notebook outputs as local analytical or simulated evidence unless real devices were used.
- TensorTonic Language Modeling from Scratch - Route Cache-Aware Prefill RequestsTensorTonic · support
Solve after the routing unit and compare its cost rule with your own placement model.
- AI Performance Engineering - Distributed InferenceWafer · reference
A curated index. Use Section 5 only to find a distributed-serving paper the other entries lack.
- Python 3.14 hashlib - byte digests for KV integrity checksPython Software Foundation · reference
Usage and Hash Objects only: compute and compare a SHA-256 digest over a declared canonical KV payload. Add request/version checks separately; a byte digest is not cache compatibility or authentication.