Model Parallelism
Definition
Model Parallelism — a method of distributing computations where layers or individual tensors of a single model are placed on different devices (GPU, TPU). It is used when the volume of parameters, activations, or optimizer states exceeds the memory of a single accelerator.
Types
| Type | What is split | Communication |
|---|---|---|
| Tensor Parallelism | Individual tensors within a layer | High, on each layer |
| Pipeline Parallelism | Layers by stages | Moderate, between stages |
| Sequence Parallelism | Activations by sequence length | Moderate |
| Expert Parallelism | Experts in MoE | Depends on routing |
flowchart LR
A[Input] --> B[GPU 0: layers 1-8]
B --> C[GPU 1: layers 9-16]
C --> D[GPU 2: layers 17-24]
D --> E[Output]
Features
- Requires high-speed interconnect (NVLink, InfiniBand).
- Pipeline Parallelism introduces bubbles, compensated by microbatching.
- Combines with Distributed Training and Mixed Precision Training.
- During inference overlaps with Multi-GPU Inference.