Distributed training spreads the work of training a single model across many accelerators, from a few GPUs in one server to thousands across a cluster. It exists for two reasons: a model can take too long to train on one device, or be too big to fit on one at all. Today’s large language models need both kinds of help.
Three ways to split the work
- Data parallelism: every device holds a full copy of the model and processes a different slice of each batch. After the backward pass the devices average their gradients, so every copy takes the same step. It speeds training up but doesn’t help a model that won’t fit.
- Model parallelism: the model itself is divided. Pipeline parallelism gives each device a run of layers; tensor parallelism splits the matrix multiplications inside each layer. Megatron-LM used the second to train an 8.3-billion-parameter language model on 512 GPUs.
- Sharding: plain data parallelism stores the weights, gradients and optimizer state on every device. ZeRO and similar schemes partition those states across devices instead, removing the duplication while keeping data parallelism’s simplicity.
Large runs usually combine all three, for example tensor parallelism inside a server, pipeline stages across servers, and data parallelism across groups of servers.
The catch
Devices must constantly exchange gradients, weights or activations, and that communication competes with computation. Adding hardware helps only as long as the network between devices keeps up, which is why the interconnect is as important as the chips. Failures matter too: across thousands of devices, something breaks often enough that long runs rely on regular checkpoints to resume.