AI Infra Interviews logo
Distributed Training & Parallelism / 06
medium★ EssentialNewOpenAIAnthropicxAI

You need to train a 100B dense model and it does not fit on one node. Walk me through how you would lay it out.

Sixteen bytes per parameter says 1.6 TB of state against a 640 GB node, so the model spans nodes before the first token. The arithmetic that sizes the fleet, the layout that puts each axis on the right link, and the two numbers that decide FSDP against pipeline across nodes.

Updated Sep 2026 · Grounded in real AI infrastructure interview loops and written to a senior-engineer editorial bar, with every number worked and every diagram hand-built.

TL;DR: 100e9 × 16 B = 1.6 TB of static training state, which is 2.5 nodes of 8 × H100 before activations, so the model spans nodes and the question is how. Tensor parallelism of 8 inside each node over NVLink, then either FSDP across nodes (simpler, about 3 model-sizes of traffic per step) or pipeline parallelism across nodes (less traffic, a bubble), with data parallelism over whatever remains. The fleet size comes from compute, not memory: 2 trillion tokens at 40% MFU on 1,024 H100s is about 34 days.

How to approach it

Do the memory floor out loud first: bytes per parameter times parameters, compared to a node. Then say that memory only sets a minimum and compute sets the real fleet, and size the fleet from a token budget and a deadline. With the fleet size in hand, assign parallelism axes to links: TP on NVLink, the cross-node axis on the NIC, and DP across the rest. State the FSDP-vs-PP decision as a comparison of per-step bytes against per-step compute. Close with the layout as a product of three numbers and the per-rank memory it leaves.

A strong answer

A typical situation: a lab has 1,024 H100s for six weeks and a 100B dense architecture with 2 trillion tokens of data. The layout has to satisfy memory, compute and network at once, so take them in that order.

1. memory floor
   static state = 100e9 × 16 B = 1.6e12 B = 1,600 GB
   one node     = 8 × 80 GB = 640 GB
   minimum GPUs to hold state at 80% usable = 1,600 ÷ (80 × 0.8) = 25 → 32 GPUs (4 nodes)
   sanity: 4 nodes hold the state and nothing else; activations come on top,
           so the memory floor is a lower bound, not a plan

2. compute sets the fleet
   FLOPs = 6 × 100e9 × 2e12 = 1.2e24
   on 1,024 H100s at 989 TFLOPS and MFU 0.4:
     rate = 1,024 × 989e12 × 0.4 = 4.05e17 FLOP/s
     time = 1.2e24 ÷ 4.05e17 = 2.96e6 s ≈ 34 days
   sanity: on the 32 GPUs from step 1 the same run takes 1,090 days; memory told us
           where the floor is, compute told us the fleet is 32× larger than the floor

3. per-rank memory at 1,024 GPUs
   static state per GPU if fully sharded = 1,600 GB ÷ 1,024 = 1.6 GB
   sanity: the state is now trivial per GPU; what fills the 80 GB is activations,
           communication buffers and the temporary gathered weights of one layer

With 1,024 GPUs, the layout question is which axes to use, not whether it fits. Two designs are reasonable.

Design A: TP8 × FSDP128. Tensor Parallelism across the 8 GPUs of each node splits every layer's matrices, so each GPU computes 1/8 of every GEMM and the four activation all-reduces per block run on NVLink at 900 GB/s. Across the 128 nodes, FSDP shards the TP-sharded parameters further and gathers them per layer. Traffic per step across the NIC is about 3 × the per-node parameter bytes:

params per TP rank = 100e9 ÷ 8 = 12.5e9 → 25 GB in bf16
FSDP traffic per rank per step ≈ 3 × 25 GB = 75 GB → at 50 GB/s: 1.5 s
compute per rank per step, 16k tokens per DP replica:
  6 × 100e9 × 16,384 ÷ 8 TP ranks = 1.23e15 FLOPs ÷ (989e12 × 0.4) ≈ 3.1 s
ratio ≈ 0.48: hidden if prefetch works, exposed if the micro-batch shrinks

Design B: TP8 × PP8 × DP16. Pipeline Parallelism and the Bubble splits the layers into 8 stages, one per node, so each node holds one eighth of the model and the FSDP all-gathers disappear; cross-node traffic is a 134 MB activation per micro-batch per boundary plus the once-per-step gradient all-reduce over the 16 DP replicas. The cost is the bubble, (p−1)/m of compute time: with 8 stages and 32 micro-batches that is 7/32 ≈ 22% of compute idle, and more micro-batches to shrink it means more activation memory held in flight.

A: TP8 × FSDP128B: TP8 × PP8 × DP16
Cross-node bytes per step per GPUabout 75 GB (weights, twice, plus grads)about 3 GB (activations plus a sharded grad all-reduce)
Idle from structurenonebubble 7/(m) of compute
Micro-batch neededlarge enough to hide 1.5 smany small ones to shrink the bubble
Codeone fully_shard meshstage assignment, schedule, balance
Failure of a nodereshard across 127 nodesstage is gone, whole pipeline replica stalls

Decision: Design A on 1,024 GPUs with 400 Gbps NICs, because a 0.48 communication-to-compute ratio hides behind one-layer-ahead prefetch and the code is a single device mesh. The condition that reverses it is bandwidth: on a 200 Gbps fabric the ratio doubles to about 1 and the run exposes communication on every step, at which point Design B's bubble of about 20% is cheaper than Design A's exposed 50%. Above roughly 4,000 GPUs, the FSDP all-gather over thousands of remote ranks also becomes latency-bound, and the Llama 3 answer, TP inside, PP across, DP over the rest, becomes the default.

One more number closes the memory question at the chosen layout: activations. At 16k tokens per micro-batch, hidden size around 12,288 for a 100B, about 34 × tokens × hidden bytes per layer without checkpointing is 6.7 GB per layer per GPU before TP's division; with TP8 and selective activation checkpointing this lands in the 30 to 50 GB range per GPU for a 100-layer model, which is why the 80 GB card is full even though the sharded state is 1.6 GB.

1.6 TB OF STATE AGAINST ONE NODE training state 100e9 × 16 B 1.6 TB one 8-GPU node 8 × 80 GB 640 GB Derive the fleet from the memory floor. Backwards from the GPUs you own fits and runs badly. Sixteen bytes a parameter is the number to know before any of this starts.

The reversal condition: a fabric that cannot carry the pipeline's activation sends inside the compute time, which pushes you back toward more tensor parallelism inside the node and fewer pipeline stages. Communication Volume Estimates is where those bytes come from. NCCL_DEBUG=INFO on the first run confirms the rings match the layout you drew.

What interviewers probe next

  • "Why not TP16 across two nodes?" The four all-reduces per block would cross the NIC at 50 GB/s instead of NVLink at 900 GB/s; the activation traffic of about 75 GB per micro-batch would take 1.5 s on the NIC against 3 s of compute, and TP's all-reduce sits on the critical path with no overlap.
  • "What if it were a 100B MoE with 20B active?" Memory floor is the same (1.6 TB, total parameters), compute drops 5×, and expert parallelism replaces most of TP; the all-to-all becomes the traffic to size.
  • "How does the fleet change for 10 trillion tokens?" Linearly: 5× the FLOPs is 170 days on 1,024 GPUs or 34 days on 5,120, and at 5,120 the layout changes to include pipeline parallelism.
  • "Where do checkpoints land in this?" 1.6 TB per full checkpoint, written sharded by every rank in parallel; at 2 TB/s aggregate that is under a second of I/O and the cost is the barrier, not the bytes.

Common mistakes

  • Sizing the fleet from memory: "1.6 TB, so 32 GPUs" and stopping, which produces a three-year run.
  • Forgetting the 16 and using 2 bytes per parameter (the inference number), then concluding the model fits on three cards.
  • Proposing tensor parallelism across nodes because the model "needs more than 8 ways".
  • Leaving activations out of the per-rank memory and being surprised that a 1.6 GB sharded state runs out of memory.

Key takeaways

  • Memory floor: 100e9 × 16 B = 1.6 TB, 2.5 nodes; it is a minimum, not a plan.
  • Compute sets the fleet: 6 × N × tokens ÷ (GPUs × peak × MFU); 2T tokens on 1,024 H100s at 40% is 34 days.
  • TP8 inside the node on NVLink; across nodes, FSDP when cross-node traffic per step is under about half the compute time, PP when it is not.
  • After sharding, activations fill the card, not parameters.
That one was free — and so are 10 answers per topic without an account. Signing in doubles that to 20, opens the Plus lessons in the courses, and remembers which topics you keep getting wrong.no card · Google sign-in · nothing to cancel
HOW DID IT GO?
0
READING SIGNED OUT

Signing in doubles your free answers, from 10 to 20 per topic, and the site starts remembering you: mastery per topic, bookmarks, and a next-focus recommendation. Free, no card.

Sign in free

The concepts behind this question

Ranked by how closely each one overlaps this question's topic, so the first card is the thing to read if the answer above moved too fast.

Core
🕸️ Distributed TrainingSign in
ZeRO and FSDPZeRO and FSDP keep data parallelism's simple programming model but shard the optimizer state, gradients and parameters across ranks, cutting per-GPU memory from 16 bytes per parameter toward 16/N. The price is 1.5x DDP's communication and a dependence on tokens per GPU that decides when sharding stops paying and tensor parallelism takes over.
Advanced
🕸️ Distributed Training🔒 Premium
Tensor ParallelismTensor parallelism splits individual weight matrices across GPUs so each rank computes a slice of every layer, which is how a model whose single layer does not fit one GPU gets trained at all. It costs four all-reduces per transformer block on the critical path, which is why it stays inside the NVLink domain and rarely exceeds 8 ranks.
Advanced
🧮 Napkin Math & Capacity🔒 Premium
Communication Volume EstimatesEvery parallelism strategy is a promise to move a certain number of bytes between GPUs every step, and the fabric either affords it or it does not. This page derives the per-rank volume for data parallelism, ZeRO/FSDP, tensor parallelism, pipeline parallelism and expert parallelism, works each for a 70B model at 8 and 64 ranks, and turns the bytes into seconds on NVLink and on a 400 Gb/s NIC. The result is the rule that decides every 3D layout: per-layer traffic stays on NVLink, per-step traffic can cross the fabric.
Foundational
🚀 Inference & Serving
The KV CacheThe KV cache stores each token's attention keys and values so decode never recomputes them, turning a quadratic cost into a linear one at the price of memory that grows with every token in every concurrent sequence. Its size, 128 KB per token for Llama 3.1 8B and 320 KB for 70B in bf16, is what caps concurrency and context on a given GPU, so it decides batch size, replica count and whether a model fits at all.
UP NEXT ON YOUR JOURNEY
FEDITOR'S NOTE

Scored on doing the memory floor before anything else, on sizing the fleet from compute rather than from memory, and on putting tensor parallelism inside the node with a reason.

DISCUSSION · 0

No comments yet — be the first to share your approach.