Home Knowledge Base Distributed Data Parallelism (DDP)

Distributed Data Parallelism (DDP) is the most widely-used distributed training strategy that replicates the entire model on every GPU and partitions the training data across GPUs — where each GPU computes gradients on its data partition and then all GPUs synchronize gradients via all-reduce before applying the same parameter update, ensuring all replicas remain identical while achieving near-linear throughput scaling with the number of GPUs.

How DDP Works

1. Initialization: The model is replicated identically on N GPUs. Each GPU receives a different shard of the training data (via DistributedSampler). 2. Forward Pass: Each GPU computes the forward pass on its local mini-batch independently. 3. Backward Pass: Each GPU computes gradients on its local mini-batch. Gradients are different on each GPU (different data). 4. All-Reduce: Gradients are summed (and averaged) across all GPUs using an efficient collective operation (NCCL ring or tree all-reduce). After all-reduce, every GPU has identical averaged gradients. 5. Parameter Update: Each GPU applies the identical optimizer step using the identical averaged gradients, maintaining weight synchrony.

Scaling Behavior

Large Batch Training Challenges

Implementations

Distributed Data Parallelism is the workhorse of large-scale model training — the strategy that scaled deep learning from single-GPU research experiments to thousand-GPU production training runs by distributing the data while keeping the model replicated and synchronized.

data parallel distributed trainingdistributed data parallelismgradient synchronizationddp pytorchbatch size scaling

Explore 500+ Semiconductor & AI Topics

From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.