LearnQuestion bank

Compare data parallelism, FSDP/ZeRO, tensor parallelism and pipeline parallelism: what is split, what is communicated, and when to combine them.

ML engineeringTechnicalHard

Answer it yourself first, out loud or on paper, then compare.

Answer

Model answer, written in a candidate's voice

In short

  • DP: replicate model, split batch, all-reduce gradients each step.
  • ZeRO/FSDP: shard optimiser state, gradients and parameters; all-gather params and reduce-scatter gradients.
  • TP: split matrices/activations inside layers; frequent intra-layer communication, needs high-bandwidth interconnect.
  • PP: split layers into stages; communicate boundary activations/gradients; bubbles reduced by micro-batching.
  • Combine for very large models: TP inside node, PP across nodes, DP/FSDP across replicas; trade memory savings against communication and bubbles.

In full

The core distinction is what is partitioned and how often devices talk. Data parallelism replicates the full model and splits the batch, so each step needs a gradient all-reduce across replicas; it is simple and efficient when the model fits comfortably. ZeRO/FSDP instead shards optimiser state, gradients and often parameters across data-parallel ranks, using all-gathers for parameters and reduce-scatters for gradients, which saves memory at the cost of extra communication. Tensor parallelism splits individual matrices and activations within a layer, so it communicates frequently and is best kept on high-bandwidth interconnects such as NVLink within a node. Pipeline parallelism splits layers into stages across devices, communicating only at stage boundaries, but it introduces pipeline bubbles that micro-batching and enough in-flight micro-batches are used to reduce. For very large models I would combine them: TP inside a node, PP across nodes for layer-level scaling, and DP or FSDP across replicas, choosing the mix by memory pressure versus interconnect bandwidth and by how much pipeline bubble and communication overhead I can tolerate.

Corrected by an independent AI reviewer.

What a strong answer covers

  • DP replicates the model and all-reduces gradients.
  • ZeRO/FSDP shard optimiser state, gradients and parameters, with all-gather/reduce-scatter.
  • TP splits matrices within layers (high-bandwidth interconnect needed); PP splits layers into stages (bubbles, micro-batching).
  • 3D parallelism for very large models, with communication vs memory trade-offs.

Common mistakes

  • putting tensor parallelism across slow inter-node links
  • ignoring pipeline bubbles.