LearnQuestion bank

You must train a model that doesn’t fit in one accelerator’s memory. Lay out your options and how you would combine them for a model of a few hundred billion parameters.

ResearchSystem designHard

Theme reported publicly: Google DeepMind

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

Answer

Model answer, written in a candidate's voice

In short

  • Budget params, gradients, optimiser states and activations: about 16 B/param before activations (300B ≈ 4.8 TB); exact cost depends on precision, optimiser, sequence length and batch.
  • Use ZeRO/FSDP-style sharding of parameters, gradients, and optimiser states across data-parallel ranks.
  • Use tensor parallelism inside a node and pipeline parallelism across nodes, with micro-batches to reduce the pipeline bubble ((p−1)/(m+p−1)).
  • Add sequence/context parallelism for long contexts and activation checkpointing plus mixed precision to cut activation memory.
  • Place stages and shards topology-aware, checkpoint frequently, and plan for failures and stragglers.

In full

I would start by writing the memory budget rather than picking a parallelism mode: for a few hundred billion parameters, fp16 weights alone are hundreds of GB, and Adam-style fp32 moments plus master weights push optimiser state into multiple TB before gradients and activations, so no single accelerator can hold the model.

Example: 300e9 parameters, bf16 mixed precision + Adam bf16 weights 300e9 × 2 B = 0.6 TB bf16 gradients 300e9 × 2 B = 0.6 TB fp32 master + m + v 300e9 × 12 B = 3.6 TB total 300e9 × 16 B = 4.8 TB, before activations 80 GB devices needed just to hold this, fully sharded: 4.8e12 / 80e9 = 60 Pipeline bubble (GPipe-style schedule), p stages, m micro-batches: (p − 1) / (m + p − 1) p = 8, m = 32: 7 / 39 ≈ 0.18, so about 18% idle time

I would shard parameters, gradients, and optimiser states with ZeRO/FSDP across data-parallel ranks, then use tensor parallelism inside a node where bandwidth is highest and pipeline parallelism across nodes, feeding each stage with micro-batches so the pipeline bubble, roughly (p−1)/(m+p−1) for p stages and m micro-batches, shrinks as the number of micro-batches grows. For long sequences I would add sequence/context parallelism, and I would use mixed precision with activation checkpointing to trade compute for activation memory. Placement would be topology-aware so tensor-parallel groups stay on fast interconnect and pipeline stages cross slower links, with frequent checkpoints and restart logic for failures and stragglers handled by monitoring, rebalancing, and avoiding over-tight synchronisation. The key is that these are complementary: sharding makes the model fit, tensor/pipeline parallelism make it trainable at scale, and checkpointing/mixed precision/sequence parallelism keep activations and long-context cost manageable.

Corrected by an independent AI reviewer.

What a strong answer covers

  • Memory budget: parameters, gradients, optimiser states, activations.
  • Data parallelism with sharded states (ZeRO/FSDP).
  • Tensor parallelism inside a node; pipeline parallelism across nodes with micro-batches (pipeline bubble).
  • Sequence or context parallelism.
  • Activation checkpointing and mixed precision.
  • Topology-aware placement, checkpointing for failures, stragglers.

Common mistakes

  • Proposing data parallelism alone.
  • Forgetting activation memory.