3.3.11 · D3Deep Learning Frameworks

Worked examples — Distributed training overview

2,572 words12 min readBack to topic

This is a drill page. The parent note gave you the machinery — data parallelism, model parallelism, communication overhead, gradient accumulation. Here we run that machinery on every kind of number it can face: the easy case, the slow-network case, the "no speedup at all" case, the memory-doesn't-fit case, and the exam-trap case where the naive answer is wrong.

Before line one, one promise: every symbol below is re-earned here. If you have not met a term, it is defined the moment it appears.

The scenario matrix

Distributed training problems live in a small number of "cells". If you can solve one example from each cell, you can solve any homework or interview question.

Cell What makes it special The trap it tests
A. Ideal / linear communication time ≈ 0 do you know the best case ceiling?
B. Comm-bound sync time comparable to compute speedup collapses below
C. Degenerate one device only formula must give speedup exactly 1
D. Limit infinitely many devices speedup saturates, not
E. Memory-bound model does not fit → must split pick model parallel, not data parallel
F. Gradient accumulation batch too big for RAM simulate large batch, no extra GPU
G. Async / stragglers one slow worker sync waits for slowest; async uses stale weights
H. Word problem plain-English scenario translate story → the right formula
I. Exam twist numbers chosen to fool you "more GPUs" gives less speedup

We now walk nine examples, one per cell, in order.


Every example uses these three quantities, so let us pin them down once, in plain words.

The picture below is the spine of every example. Look at it before reading on.

Figure — Distributed training overview

Cell A — The ideal / linear case


Cell B — The communication-bound case

This is the parent's BERT-Large example, re-derived from scratch.


Cell C — The degenerate case

Always test a formula on the boundary it must obviously satisfy.


Cell D — The limit

Figure — Distributed training overview

The curve shows Cells A–D at once: it rises, then flattens at . That flat ceiling is why "more GPUs always means faster" is false — the headline mistake from the parent note.


Cell E — The memory-bound case (model does not fit)

Here data parallelism is useless: it needs a full copy on every GPU, but no single GPU can hold one copy.

Recall When do I reach for model parallelism instead of data parallelism?

Trigger for model parallelism ::: when a single copy of the model does not fit in one device's memory.


Cell F — Gradient accumulation (big batch, small memory)


Cell G — Synchronous vs. asynchronous (the straggler)


Cell H — Word problem (translate the story)


Cell I — The exam twist (the naive answer is wrong)


Recall

Recall Cell A vs Cell D: what caps speedup?

Cell A (free comms) ceiling is ; Cell D (fixed comms) ceiling is ::: , reached as .

Recall Which cell forces model parallelism?

Cell E ::: when one full model copy exceeds a single GPU's memory.

Recall Sync vs async iteration cost with a straggler?

Sync ::: pays the slowest worker's time (max); async ::: pays roughly the average but risks stale gradients.

See also: 3.9-Gradient-descent-optimizers for the update rule , 4.2-GPU-acceleration for where comes from, 5.1-Training-at-scale for real hybrid setups, and 3.4.1-Transformers-overview for why the models in Cell E got so large.