EfficientML.ai Lecture 19 - Distributed-Training (Part II) (MIT 6.5940 Fall 2026)
Overview
The lecture explains how to combine data, pipeline, tensor, and sequence parallelism, and how Berkeley's Alpa searches distributed-training layouts by modeling compute, communication, and resharding costs. It then covers bandwidth-saving gradient compression, including Deep Gradient Compression's momentum correction and warm-up, which enabled up to 99.9% sparsity and about 597× gradient-size savings, plus delayed gradient averaging to hide network latency.
Key takeaways
- Hybrid parallelism should reflect both the model's memory needs and the network topology: the lecture's 900 GB/s intra-node links favor all-to-all communication within a node, while 50 GB/s inter-node links motivate ring communication between nodes.
- Alpa reduces distributed-training configuration complexity by searching interoperator and intraoperator parallelism separately and accounting for compute, communication, and resharding costs.
- Deep Gradient Compression can reach 99.9% gradient sparsity while retaining near-baseline accuracy when it accumulates optimizer velocity rather than raw gradients and uses warm-up and gradient clipping.
- A nominal 99.9% pruning rate does not yield 1,000× end-to-end compression when sparse indices must be transmitted and biases remain dense; the cited ImageNet result was about 597×.
- Independent sparsity patterns across workers can become dense after all-reduce; PowerSGD avoids this particular mismatch by aggregating aligned low-rank representations.
- Delayed gradient averaging can hide communication latency behind local computation, but subtracting the worker's already-counted stale local gradient is essential to limit accuracy loss.
Chapters
- The lecture reviews data, pipeline, tensor, and sequence parallelism, including FSDP and ZeRO sharding of weights, gradients, and optimizer states.
- A 2D layout combines data parallelism across ranks with pipeline parallelism within each rank, while another combines pipeline and tensor parallelism.
- For two nodes with 900 GB/s intra-node links and 50 GB/s inter-node links, hierarchical sequence parallelism uses all-to-all within nodes and ring attention between nodes.
- A 32-GPU example combines data, model, and pipeline parallelism, illustrating the configuration search across possible GPU partitions.
- Alpa, a unified compiler for distributed training, searches hierarchically: first interoperator parallelism across operators, then intraoperator parallelism within operators.
- For matrix multiplication, it considers splitting A, splitting B, or splitting both and using an all-reduce to combine partial results.
- Its cost model accounts for compute, communication, and resharding between operations, then uses optimization solvers to select a layout.
- Alpa reportedly matched manual optimization for GPT models up to 39 billion parameters and beat a manual baseline by as much as 8× on a 70-billion-parameter mixture-of-experts model.
- Adding GPUs does not guarantee linear speedup: communication can make measured scaling fall below the ideal y = x curve.
- The lecture highlights 20-gigabit-per-second Ethernet as an example of a network bottleneck that can leave computation waiting for communication.
- When diagnosing scaling, check compute, memory bandwidth, and networking bandwidth as separate constraints.
- Communication latency ranges from microseconds within a rack to milliseconds across a data center, with much longer delays possible over distant or wireless links.
- Gradient pruning sends only selected nonzero values instead of a dense 32-bit tensor; the lecture notes that gradients can reach 99% sparsity readily.
- Top-k selection keeps the largest gradients, while error feedback stores pruned residuals locally so they may be transmitted in later iterations.
- Naive pruning with local gradient accumulation can increase throughput but reduce accuracy by about 1 percentage point in the example.
- Gradient quantization is another bandwidth strategy, reducing transmitted values from 32-bit floats to formats such as 8-bit integers.
- Momentum smooths noisy gradients by maintaining a velocity that is a weighted average of past gradients, and the optimizer updates weights using that velocity.
- Accumulating dropped gradients directly can shift the optimizer's update direction away from vanilla momentum SGD.
- Deep Gradient Compression corrects this by accumulating the velocity, rather than the raw gradient, to preserve the intended momentum update.
- The lecture also identifies gradient clipping as an important component of Deep Gradient Compression.
- During early training, rapidly changing parameters make stale accumulated gradients especially disruptive.
- Learning-rate warm-up gradually increases the rate from zero to its target, while sparsity warm-up gradually raises the pruning ratio.
- In the reported comparison, momentum correction reduced the accuracy loss from local gradient accumulation to 0.36%; combining correction and warm-up recovered baseline accuracy in the cited cases.
- Deep Gradient Compression maintained near-baseline accuracy at 99.9% gradient sparsity, with about 597× gradient-size savings on ImageNet after accounting for indexing overhead and dense biases.
- Different workers can prune different gradient coordinates, so all-reduce can fill in zeros and make the aggregated tensor progressively denser.
- Possible mitigations include enforcing shared sparsity patterns, using coarse-grained sparsity, or pruning again during communication, each with trade-offs.
- PowerSGD instead compresses gradients through low-rank factorization and aligns dimensions across workers for aggregation.
- The lecture shows PowerSGD with rank 2 achieving near-linear speedup as the number of workers increases in the cited evaluation.
- One-bit SGD transmits a sign-like representation and retains quantization residuals locally in higher precision.
- Ternary gradients encode positive, negative, or zero values using a threshold, mapping values outside the threshold to signed levels.
- Stochastic quantization makes a value nonzero with probability proportional to its magnitude relative to the tensor maximum.
- Because stochastic rounding preserves the original gradient in expectation, it avoids systematic quantization bias and can also be applied to weights and activations.
- Bandwidth can improve through compression, quantization, or faster hardware, but latency is constrained by distance and the speed of light.
- The lecture gives Shanghai-to-Boston transmission at light speed as a roughly 162-millisecond lower bound.
- Synchronous SGD forces workers to wait for communication before beginning the next update, so longer network delays extend total training time.
- Delayed gradient updates aim to overlap communication with computation by allowing workers to proceed using temporarily stale information.
- With a one-step delay, a worker can begin the next computation before the previous gradient exchange finishes, provided communication completes before the later synchronization barrier.
- Delayed gradient averaging applies gradients from earlier iterations, with delay represented by D steps.
- A correction subtracts the local gradient from D steps earlier because that contribution has already been included in the delayed average.
- In the reported example, correction maintained accuracy around 89% for delays of 5 and 10 steps, while omitting correction caused greater degradation.
- Delayed gradient aggregation showed roughly 3×, 2×, and 4× speedups across the cited CIFAR, ImageNet, and Shakespeare evaluations, with accuracy largely maintained.
- An eight-node Raspberry Pi test reached up to about 7.5× speedup, close to the ideal 8× scaling and higher than the cited 4.2× result for FedAvg without delay.
- The lecture contrasts gradient compression for bandwidth bottlenecks with delayed gradient updates for latency bottlenecks.
- Its final technical recap covers Alpa, gradient pruning and quantization, momentum correction, warm-up, and stale-gradient tolerance.
- The semester review spans efficient inference, pruning, quantization, neural architecture search, distillation, and training methods such as federated learning.
- Application topics include large language models, long-context methods such as StreamingLLM, diffusion-based image and video generation, visual-language models, and point-cloud models.
- The course emphasizes co-designing machine-learning algorithms with systems and hardware rather than treating model development as an algorithm-only problem.
- Students are invited to attend open-ended project presentations and an online review session to share feedback for future course offerings.
Transcript excerpt
0:01 Okay, good afternoon everyone. Let's get started. Welcome to the last lecture of efficient ML.AI. So this is lecture 20 uh distributed training part two. So last week uh we talked about how to paralyze the training across multiple GPUs since using a single GPU you may not fit a pretty large model or it takes too long to train. Uh today we'll talk about hybrid uh parallelism combining different parallelization approaches and how to automate this process and then we want to introduce the bandwidth and latency bottleneck of of distributed training and then introduce gradient compression deep gradient compression. Previously we talked about how to compress the weight how to compress the
0:47 activations. Now let's talk about how to compress the gradient so that you need to send and receive less gradient. We'll talk about gradient pruning and also gradient quantization. And lastly, we'll uh talk about how can you tolerate such long latency by using delayed gradient delayed gradient update to overcome the latency bottleneck. So let's start with introducing the hybrid and mixed parallelism. This is a quick overview of what we have learned so far. the four different parallelization approaches including the data parallelism, pipeline parallelism, tensor parallelism and also sequence parallelism. So on the top left corner is data parallelism. You have a a blue
1:37 data on the top and uh green data on the bottom. You feed them concurrently to two different GPUs. They share the same weight and they process them concurrently. So split the data and you have n copies of the model. You can also do sharding. So for example the fs fsdp we talked about last last week and zero approaches where you can fully shard the weight the gradient um the optimizer states across all the GPUs. Next we also have the uh pipeline
This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.
In this course
Related notes
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, MIT HAN Lab.