KatInterview

Planning a Sparse-Expert LLM Training Run on 256 GPUs

System DesignModel answer
HardModel answerSystem Designmixture-of-expertsdistributed-trainingexpert-parallelism

Last updated

Plan an end-to-end training setup for a bilingual sparse-expert language model on about 1T tokens and 256 A100-80GB GPUs, including a path to 1,024 GPUs.

You are asked to plan the pretraining of a bilingual sparse Mixture-of-Experts language model on roughly 1 trillion tokens, using a cluster of 256 NVIDIA A100-80GB GPUs (32 nodes of 8 GPUs, NVLink within a node, InfiniBand between nodes).

Walk through your design and justify the trade-offs. Cover at least:

  1. Budget and sizing: the compute estimate, expected wall-clock time and rough cost.
  2. Model architecture: number of experts, router design, top-k, whether to use shared experts.
  3. Parallelism plan: how you combine data, tensor, pipeline and expert parallelism, and where the all-to-all traffic runs.
  4. Memory: optimizer and gradient sharding (ZeRO/FSDP), activation recomputation, and a per-GPU memory estimate.
  5. Routing mechanics: capacity factor, token-dropping policy, load-balancing and router stabilization losses, and how routing behaves at evaluation and inference time.
  6. Data: corpus mix across the two languages, filtering, deduplication, decontamination, tokenizer design and sequence packing.
  7. Training recipe: batch size, optimizer, learning-rate schedule, and how you de-risk the recipe before the full run.
  8. Reliability: checkpointing, fault detection, automatic recovery.
  9. Observability and evaluation: which metrics you track and what alerts you set.
  10. Failure modes: router collapse, stragglers, expert overload, loss spikes, each with concrete mitigations.
  11. Scale-out: what changes when you move the same system to 1,024 GPUs, and how you keep cost under control.

State your assumptions explicitly (context length, target quality, language pair) and use numbers wherever you can.

Hints

Hint 1

Start from the compute budget: training FLOPs are roughly 6 x active parameters x tokens, and a realistic MFU for MoE on A100s is far below the 312 TFLOPS peak. Work backward to an active-parameter count that fits your time limit.

Hint 2

Think about where the all-to-all should run. If the expert-parallel group fits inside one NVLink node, token dispatch avoids the slower inter-node network, and TP/PP may be unnecessary at this model size.

Hint 3

Separate dense parameters from expert parameters when reasoning about data-parallel group sizes and optimizer sharding, since they are replicated over different numbers of ranks.

Hint 4

For each failure mode (router collapse, overload, stragglers, node failures, loss spikes), name the signal you would monitor, the threshold that triggers action, and the automated or manual response.