How would you plan the infrastructure for training a 70B-parameter language model on 1.4 trillion tokens? Using C≈6ND FLOPs (floating-point operations, for N parameters and D tokens) and 16 bytes per parameter for mixed-precision AdamW model states, how much model-state memory does it need, how long does it take on 1,024 GPUs (graphics processing units, 312 TFLOP/s peak each at 40% model FLOPs utilisation, MFU), what data-pipeline throughput is required, and how do you handle parallelism, checkpointing and failure recovery?

ML system design, Case studies
Level L5 Expert. Length Long. Nature Th+Mat Both.

What's being asked

Whether you can size compute, memory, parallelism, storage I/O and fault tolerance for a multi-week distributed pre-training run without glossing over hardware bottlenecks.

Key idea

At 16 bytes per parameter, 70B parameters need 1.12 TB just for model states, so model states must be split across GPUs using 3D parallelism (tensor parallelism inside a node, pipeline parallelism across nodes, and data parallelism with sharded optimiser states or FSDP). Total compute is C≈6×70×109×1.4×1012=5.88×1023 FLOPs, taking about 53.3 days on 1,024 GPUs at 40% model FLOPs utilisation (MFU), which demands asynchronous checkpointing and automated node recovery.

Steps

  1. Clarify requirements and scale: confirm model size N=70×109 parameters, dataset size D=1.4×1012 tokens (the 20:1 Chinchilla ratio covered in compute-optimal scaling questions), context length (say 4,096 tokens), precision (BF16, or brain floating point, activations and weights with FP32, or 32-bit floating point, optimiser states), and cluster specs (1,024 80 GB GPUs, 8 per node with fast intra-node NVLink interconnect and multi-rail InfiniBand networking across nodes, each GPU rated at 312 TFLOP/s, or 312×1012 FLOP/s, dense BF16 peak).
  2. Define ML and cluster metrics: offline, monitor training and validation cross-entropy loss, gradient norm stability, and periodic downstream evaluation benchmarks. For infrastructure, track MFU (the fraction of peak hardware FLOPs achieved by useful model matrix multiplications, targeting 40%+), tokens/s per GPU, step time variance, and cluster goodput (the percentage of wall-clock time producing saved progress after accounting for failures and restarts).
  3. Design the data pipeline and compute required throughput: curate, deduplicate, filter for quality, tokenise and pre-shuffle the 1.4 trillion tokens into binary shards (at 2 bytes per 16-bit unsigned integer token ID, which works only if the vocabulary has under 65,536 tokens, raw tokenised data is 1.4×1012×2 B=2.8 TB). First compute training time: total FLOPs C≈6ND=6×(70×109)×(1.4×1012)=5.88×1023 FLOPs. Effective cluster rate at 40% MFU is 1,024×312×1012×0.40≈1.278×1017 FLOP/s (127.8 PFLOP/s, or 1015 FLOP/s). Training time is 5.88×1023/1.278×1017≈4,601,112 s≈53.3 days. The data loader must therefore stream at least 1.4×1012/4,601,112≈304,274 tokens/s (≈0.61 MB/s raw token IDs), with multi-worker prefetching and deterministic shard-offset state for exact resume.
  4. Calculate memory and design 3D parallelism: mixed-precision AdamW stores BF16 weights (2 B), BF16 gradients (2 B), FP32 master weights (4 B), and Adam first and second moments in FP32 (8 B), totalling 16 B/parameter, or 70×109×16 B=1.12 TB (1012 bytes; ≈1.02 TiB, 240 bytes) before activations. Combine three parallelism axes across the 1,024 GPUs: use TP (tensor parallelism) =8 inside each node over NVLink because TP requires two all-reduce collectives per transformer layer; use PP (pipeline parallelism, say 4 or 8 stages) across nodes with an interleaved 1F1B (one forward, one backward) schedule to shrink pipeline bubbles while only sending small point-to-point activations between nodes; and use DP (data parallelism) across the remaining replicas (for example, 1,024/(8×4)=32 DP groups) with the optimiser states sharded (ZeRO-1, or a distributed optimiser, is the usual partner of TP and PP; ZeRO-3 / FSDP, fully sharded data parallelism, shards weights and gradients too but is awkward to combine with pipeline parallelism, so many runs use FSDP with TP and no PP), plus selective activation checkpointing (recomputation) to fit large micro-batches.
  5. Plan checkpointing and failure recovery: a full training checkpoint stores BF16 weights plus FP32 master weights and Adam moments (about 14 B/parameter, so roughly 0.98 TB; gradients are not saved), plus random-number and dataloader states. Writing it synchronously over a 10 GB/s shared filesystem would stall all 1,024 GPUs for ∼100 s every save. Instead, save sharded checkpoints every 30–60 minutes using two-tier asynchronous checkpointing: copy each rank's shard to host memory (RAM) or local NVMe (solid-state) storage in a few seconds so training resumes at once, while background threads flush shards to parallel object storage. At 1,024 GPUs, hardware, ECC (error-correcting code) memory or link errors happen every few hours to days; keep hot-standby spare nodes, run automated health probes before restart, and auto-resume from the latest valid checkpoint.
  6. Validate before full launch: run scaling-law proxy experiments at smaller sizes (1B–7B) to lock in learning rate, warmup and batch-size schedules, then run NCCL (collective communication library) all-reduce benchmarks, a short 1,024-GPU burn-in to catch faulty links early, and a checkpoint-restore test verifying identical loss curves across a simulated crash.
  7. Monitor, iterate and address interviewer trade-offs: watch loss spikes, gradient norms, per-node temperature or clock throttling, network packet drops, and straggler GPUs dragging down synchronous steps. Interviewers will probe: why TP stays intra-node while PP spans nodes (all-reduce bandwidth vs point-to-point); how micro-batch count trades activation memory against pipeline bubble overhead; activation recomputation vs MFU; and checkpoint interval vs wasted compute on crash.

Common mistakes

How long your answer should be

About 7–9 minutes: state the 1.12 TB memory, 5.88 × 10²³ FLOPs, ~53.3 days and ~304k tokens/s calculations, then walk through 3D parallelism, async checkpointing and fault recovery.

Read this

Previous in ML system design: How would you design a system to serve a 7B-parameter large language model (LLM) chat service at scale? For a 32-layer model with hidden size 4,096 in 16-bit floating point (fp16, 14 GB of weights), what are the key–value (KV) cache memory per token, the memory for a 4,096-token sequence, roughly how many full-length sequences fit on an 80 GB GPU (graphics processing unit), and what is the serving cost per million output tokens if a GPU costs USD 2 per hour and sustains 2,500 output tokens/s?
Next in ML system design: none