Unit 13 of 13 · about 3 hours · derive
Hierarchical collectives and compressed communication with accuracy controls
Flat collectives waste the fast tier, and raw compression wastes accuracy. Hierarchy and accuracy-controlled compression are the two levers that survive at cluster scale.
You'll be able to
- Derive the three-phase hierarchical all-reduce bytes and state when hierarchy wins.
- Explain quantization, sparsification and error feedback with their accuracy controls.
- State the warmup and measurement contract that makes a compression claim trustworthy.
Covers
Read
In this order, only the parts listed
0 of 3 done
- Hierarchical all-reduce with the worked savingMachine Learning Systems Volume II - Collective Communication
Hierarchical Communication with Hierarchical AllReduce: the three phases plus the flat 40 ms versus hierarchical 8.3 ms worked comparison
- Compression, error feedback and when to use itMachine Learning Systems Volume II - Collective Communication
Gradient Compression Under Bandwidth Scarcity with Quantization, Sparsification, Error feedback and When to use compression, including the telescoping-sum argument
- Cross-node collectives and the node-bound quizHow to Scale Your Model - Sharded Matrices and GPU Collectives
How Do Collectives Work on GPUs, Cross-node collectives: the fat-tree time set by node egress bandwidth, and why cross-node all-to-all gains nothing from the hierarchy
Focus on
- Hierarchy works in three phases: reduce-scatter inside each node over the fast tier, all-reduce each GPU's shard across nodes over the slow tier, then all-gather inside each node. The saving equals the bytes kept off the slow tier.
- Compression only helps bandwidth-bound traffic above the crossover size. Below it the latency term is unchanged, so small routed messages gain nothing from fewer bytes.
- Error feedback carries the compression residual forward, so the telescoping sum preserves the true total across steps. Naive top-k without it is biased and drifts.
- One-bit and sparse schemes usually start with a full-precision warmup plus a measured accuracy check. A byte saving without a convergence comparison is not a result.
Common mistakes · 3
- Quoting the book H100-cluster reference values as targets. They are the authors' cluster numbers; your fabric needs its own , and measurement.
- Compressing latency-bound traffic. Shrinking a 4 KB routing message changes almost nothing because startup dominates its cost.
- Skipping warmup for 1-bit schemes. Early-step statistics are unstable, so full-precision warmup plus a loss comparison is part of the method, not optional.
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 are the three hierarchical phases, and which bytes avoid the slow tier?Answer
Intra-node reduce-scatter, inter-node all-reduce of each GPU's shard, intra-node all-gather. Only the shards cross the slow tier; the full payload never leaves the fast tier.
2.Why does error feedback preserve the true gradient sum across steps?Answer
Each step sends the compressed value of the gradient plus the carried residual, and keeps the new residual for the next step. Summed over steps the residuals telescope, so the total sent differs from the total of the true gradients only by the last residual.
3.A 140 GB gradient compresses to 1.4 GB. Does the operation become latency-bound?Answer
No. At 1.4 GB it still sits far above any realistic crossover size, so it stays bandwidth-bound with a proportionally smaller term.
4.What must a compression experiment report besides the byte saving?Answer
Warmup policy, the accuracy or loss comparison against the uncompressed run, and the fabric and message regime, so the saving is tied to preserved model quality.
Practice
- How to Scale Your Model: GPU Quiz 4 on collectives
Quiz 4, Question 5 in How Do Collectives Work on GPUs: the precise cost of an all-gather over exactly 2 nodes, answered before opening the solution
Treat the given link numbers as the question givens, not as predictions for your own fabric.
You're done when
You derive the three-phase bytes, explain the telescoping sum, and can state the warmup-plus-accuracy contract for any compression proposal.
Only when you can do this without notes.
Leads to
Notes
Resources · 2 for this unit, 13 more in the section
- Machine Learning Systems Volume II - Collective CommunicationML Systems Textbook · primary
Read From Parallelism to Communication Patterns, Network Performance Modeling, Collective Operation Primitives, AllReduce Algorithms, Hierarchical Communication and Communication-Computation Overlap. Use its latency and bandwidth model to derive one communication budget, and return to The Distributed Training Step in https://mlsysbook.ai/vol2/distributed_training/distributed_training.html during DT-3.
- How to Scale Your Model - Sharded Matrices and GPU CollectivesGoogle DeepMind · required
Work the collective-cost problems in Part 3 (all-gather, reduce-scatter, all-reduce and all-to-all volumes, latency versus bandwidth) before opening each answer, then read How Do Collectives Work on GPUs in Part 12 at https://jax-ml.github.io/scaling-book/gpus. The worked answers use TPU link constants; redo them with your own bandwidth and latency.
Also in this section
- Ultra-Scale Playbook - A0: Parallel Programming Crash CourseHugging Face · required
Read A0 from processes and ranks through point-to-point communication, broadcast, reduce, all-reduce, all-gather, reduce-scatter, the ring all-reduce and asynchronous operations. Reproduce every small
torch.distributedexample on Gloo and annotate tensor ownership before moving to higher parallelism. - Building a Distributed Training Framework from First PrinciplesUmar Jamil · required
Watch only 04:32:59 for autograd and distributed mathematics, 05:04:19 for distributed graphs and DDP, 09:48:52 for collectives, and 10:49:41 for DeviceMesh, DDP and FSDP. Pause after each segment to reproduce the rank and tensor transitions with CPU torchrun; the nearly twenty-hour full video is not required.
- CS336 Spring 2025 - Lecture 8 Parallelism (executable lecture)Stanford University · support
Read
lecture_08.pyPart 1 (collective operations,torch.distributed, all-reduce and reduce-scatter benchmarks) and skim Part 2 (data, tensor and pipeline parallelism sketches). Run its CPU examples before the Playbook appendix. - Picotron - Process Groups and Communication FilesHugging Face · required
Trace picotron/process_group_manager.py plus tp_communications.py, pp_communications.py and cp_communications.py. Draw every group, rank coordinate and tensor transfer for one 2 x 2 layout, then add a failing collective-order test in your own project.
- Picotron Tutorial - Steps 1 to 3 and Part 1 VideoHugging Face · support
Follow
step2_process_group_managerandstep3_dataloaderwith their diffs and the Part 1 video (model, process group manager and dataloader). Rebuild the rank grid yourself before reading the solution. - Machine Learning Engineering Open Book - Communication PatternsStas Bekman · required
Read
network/comms.mdfrom point-to-point through ring all-reduce, thennetwork/README.mdandnetwork/debug/README.mdselectively. Derive bytes and steps before running anything;network/benchmarks/all_reduce_bench.pyneeds two or more GPUs and reports bus bandwidth. - Writing Distributed Applications with PyTorchPyTorch · required
Work through process-group setup, point-to-point communication and the collective operations, then adapt the examples to test broadcast, all-reduce, all-gather, reduce-scatter and all-to-all on Gloo with several CPU processes. Check backend support in the 2.14
torch.distributedreference; Gloo all-to-all runs on CPU in 2.14. - CS336 Assignment 2 (Spring 2026) - Sections 5.1 and 8.1Stanford University · required
Complete
distributed_communication_single_nodewith the Section 5.1.1 benchmarking practices on as many processes as you have, then derive the ring all-gather, reduce-scatter and all-reduce costs in Section 8.1 and solvealternate_ring_all_reduce. - TensorTonic - Collective Simulation ProblemsTensorTonic · support
Solve Simulate Distributed Collectives and Calculate Collective Effective Bandwidth. The bandwidth problem counts ring passes; reconcile it with your alpha-beta model and with bus bandwidth before comparing numbers.
- AI Systems Performance Engineering - Chapter 4 Distributed Networking CommunicationChris Fregly (O'Reilly) · support
Read NCCL for Distributed Multi-GPU Communication, Topology Awareness in NCCL, NCCL Communication Algorithms, NCCL Communicator Lifecycle and Environment Gotchas, and Profiling and Debugging NCCL. With two or more GPUs, run
code/ch04/nccl_benchmark.pyfrom the companion repository and label the exact topology. - nccl-tests and its performance notesNVIDIA · support
With two or more GPUs, run
all_reduce_perfover a message-size sweep and readdoc/PERFORMANCE.mdfor algorithm bandwidth versus bus bandwidth. Without them, use the document to interpret published numbers. - PyTorch 2.14 `torch.distributed` referencePyTorch · reference
Look up the backends table,
init_process_groupwith timeout anddevice_id,new_groupandnew_subgroups, theWorkandasync_opcontract,monitored_barrier,destroy_process_groupandTORCH_DISTRIBUTED_DEBUG. Use it for API lookup beside the tutorial first pass. - PyTorch 2.14 torchrun (elastic launch) referencePyTorch · reference
Read Single-node multi-worker through the elastic membership rows for
RANK,WORLD_SIZEandLOCAL_RANK, plus flags--standalone,--nnodes,--nproc-per-node,--rdzv-backendand--rdzv-endpoint. Launch every CPU run withtorchrun --standaloneand a distinct port per run.