What is Data parallelism?

Distributed training in which each GPU holds a full model replica, processes its share of the data, and gradients are averaged across GPUs before updating.

Field: AI Hardware & Software Stack

Japanese name: データ並列

The flow of one step

In data parallelism, every GPU holds a replica of the model with the same weights. The batch is divided by the number of GPUs, and each GPU runs the forward and backward passes on its share. Because the data differ, the gradients obtained differ from GPU to GPU. The gradients of all GPUs are therefore gathered by communication and averaged. Each GPU updates its weights with the same averaged gradient, so the replicas stay in the same state. If 4 GPUs each take 64 samples, for example, one step processes 64 × 4 = 256 samples.

Advantages and limits

Its advantage is that it can be used with almost no rewriting of the model itself. It does assume, however, that the whole model fits on one GPU. In the basic scheme, each GPU holds all the weights and gradients, so the memory needed for the model does not shrink. Communication to gather the gradients is needed at every step. As the number of GPUs or the model grows, this communication becomes heavy. Because the overall batch becomes larger, settings such as the learning rate may also need adjusting.

Difference from other kinds of parallelism

What data parallelism divides is the data, not the model. Tensor parallelism splits the weight matrix of one layer across several GPUs. Pipeline parallelism cuts the sequence of layers and gives each group of layers to a GPU. These two are methods for handling a model that does not fit on one GPU. In large-scale training they are combined with data parallelism. The gradients are averaged with a communication operation called all-reduce.

Try it: questions about Data parallelism

Which describes data parallelism in multi-GPU training?

  1. AEach GPU holds a full model replica, computes on its share of the data, and gradients are averaged across GPUs before updating weights
  2. BModel layers are split so each GPU handles different layers
  3. COne GPU computes while the others stand by
Show answer and explanation

Answer: A. Each GPU holds a full model replica, computes on its share of the data, and gradients are averaged across GPUs before updating weights

In data parallelism, every GPU holds the same model, the training batch is divided among them, and each performs forward and backward passes. Their gradients differ, so an all-reduce communication sums and averages gradients across GPUs, and everyone updates weights with the same gradient, keeping the replicas identical. It is simple and effective when the model fits on one GPU, but communication grows heavier as GPUs are added.

FAQ

Does doubling the number of GPUs make training twice as fast?

It rarely reaches exactly twice. The data processed in one step doubles, but the time to gather the gradients is added. The larger the share of communication, the smaller the benefit of adding GPUs.

Does data parallelism reduce the memory each GPU needs?

Not the part for the model's weights. That is because each GPU holds a replica of the whole model. When the model does not fit on one GPU, tensor parallelism or pipeline parallelism is used.

Questions that mention Data parallelism (1)

Data parallelism appears in 2 practice questions across 2 topics, including AI Hardware & Software Stack, GPU Programming.

  1. Which characteristic best describes work that GPUs process quickly?

Books on AI Hardware & Software Stack Ad

As an Amazon Associate I earn from qualifying purchases.

This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.

Back to the glossary