System Design Lab
LLM pretraining is bounded by GPU memory and inter-GPU communication; both force you to split the model across many accelerators.
Scale model parameters, GPU count, global batch, sequence length, interconnect bandwidth, and checkpoint interval. The design moves from a single GPU to data parallelism with all-reduce, to tensor and pipeline parallelism for a model too big for one device, to full 3D parallelism with activation checkpointing, and finally to thousands of GPUs that demand fast collectives plus frequent checkpoint-and-recover.
Guided walkthrough
Reason about it one step at a time
Takeaway
Normal evolution scenarios
Click left to right for the intended demo path. Each card changes the workload inputs.
Recommended shape
Bottlenecks
Why this changes
Decision tradeoffs
Source-backed rules
These are the durable system-design claims behind the model. The exact slider thresholds are deliberately labeled as teaching assumptions.
Tensor parallelism splits each layer across GPUs to train models too big for one device
Megatron-LM partitions the attention and MLP matrices across GPUs so a single transformer layer fits in aggregate device memory, exchanging activations over the fast intra-node interconnect.
Megatron-LMZeRO shards optimizer state, gradients, and parameters to cut the per-GPU memory floor
Standard data parallelism replicates the full ~16 bytes/param of optimizer state on every GPU; ZeRO partitions that state across data-parallel ranks so memory falls roughly linearly with the number of devices.
DeepSpeed ZeRO (arXiv:1910.02054)Pipeline parallelism splits layers into stages and overlaps micro-batches to keep GPUs busy
GPipe assigns contiguous layer stages to different accelerators and pipelines micro-batches through them, with re-materialization (activation recompute) to bound the activation memory per stage.
GPipe (arXiv:1811.06965)Combining tensor, pipeline, and data parallelism scales transformer training to thousands of GPUs
Efficient large-model training composes the three parallelism axes (3D parallelism), placing high-bandwidth tensor-parallel traffic within a node and lower-bandwidth data-parallel all-reduce across nodes.
Megatron-LM scaling (arXiv:1909.08053)Teaching assumptions
- Memory is modeled as ~16 bytes/param for weights, gradients, and Adam optimizer state, plus an activation term that grows with batch and sequence length; real frameworks vary with precision and ZeRO sharding.
- Per-GPU memory is a fixed teaching figure (80 GB) and collective/data thresholds are round numbers, not vendor benchmarks.
- Failure rate is approximated as proportional to GPU count, so expected lost work scales with both fleet size and checkpoint interval.