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

Collective and point-to-point communication volumePCIe, NVLink, NVSwitch and network topologySmall-batch latency versus distributed capacity
1

Read

In this order, only the parts listed

0 of 2 done

  1. 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.

  2. 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.

2

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.
3

Try it yourself

Closed-book, before checking anything

For a synthetic eight-layer dense forward pass with batch size 2, hidden width 64, two-byte activations and four TP ranks, derive the decode message size of 256 bytes and ring egress of 384 bytes per rank per reduction. Two reductions per layer give 6,144 bytes per rank per batch step. Recompute for a 128-position prefill, then compare both startup and bandwidth terms using declared synthetic link parameters. Count PP traffic separately per boundary, not as a ring reduction.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 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. 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. 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. 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

Also in this section