Distributed Training
Training a model across multiple GPUs and machines simultaneously. A large task is split into parts that are computed in parallel.
Why
Modern models do not fit into the memory of a single card and would take years to train on it. Distribution provides:
- acceleration by tens or hundreds of times;
- the ability to train models larger than the memory of a single card.
Strategies
| Strategy | Idea |
|---|---|
| Data Parallel | Each GPU holds a copy of the model, computes its own chunk of data |
| Model Parallel | The model is sliced between GPUs by layers |
| Pipeline Parallel | Layers are distributed in a pipeline |
How Implemented
- PyTorch DDP — standard for data parallel;
- DeepSpeed / FSDP — for giant models;
- Horovod — classic framework.