Multidimensional Parallel Planning
Real training jobs combine dimensions. The useful skill is to turn a model, batch, topology and reliability requirement into a legal plan whose memory and critical path can be defended before allocation.
Section 8 of 10 · 13 units · about 54 hours
By the end you can Given a model, global batch and named topology, enumerate legal parallel plans, reject infeasible ones, predict memory and step time, execute one CPU-safe composed plan, and explain the largest prediction error.
Units
- The parallel dimensions and world-size factorization4h
- Named device meshes, rank coordinates and group construction4h
- Batch and token equations and divisibility across dimensions4h
- Per-rank parameter, gradient, optimizer, checkpoint and buffer memory4h
- Per-rank activation and temporary memory under a composed plan3h
- Per-layer FLOPs and the collective volume of every dimension5h
- Bubble and imbalance cost, critical paths and overlap constraints5h
- Link contention, intra- and inter-node placement and fast links for TP and EP5h
- TP versus CP for long context, and DP, ZeRO and PP under batch limits4h
- Configuration search with legal-plan pruning and predicted regimes5h
- Measured-to-predicted residuals and the topology and assumption manifest4h
- Correctness tests for a composed 2D or 4D plan4h
- Plan ranking under uncertain bandwidth and heterogeneous devices3h
Build it
Mini project · about 16 to 24 hours
Composed parallel plan with tested critical path
Extend trainlab with a mesh planner that turns a world size into legal parallel layouts with predicted memory and step time. Validate every ledger against CPU collectives and independent oracles, and freeze one prediction to reconcile against measurement. Legal plans feed the recovery dossier and the capstone mesh choice.
- 1Build the
plan/mesh validator: dense and expert ownership tables, world-size factorization, rank-coordinate maps with round trips, group construction, and invalid-product rejection tested with CPUgloocollectives. - 2Add the batch-token ledger and layout validator: unique examples and valid tokens per update, divisibility tables for heads, widths, vocabulary, sequence, layers and experts, with invalid and uneven cases refused loudly.
- 3Extend the ledger to per-rank state, buffers and checkpoint staging with live-window peaks, then add activation lifetimes and per-stage temporary memory under the pipeline schedules you validated earlier.
- 4Derive per-layer FLOPs and the full collective-volume ledger across data, sharded, tensor, sequence, context, pipeline and expert dimensions, then map groups onto links with a contention table; solve the CS336 data-parallel, FSDP and TP calculations and the scaling-book sharding case first.
- 5Build the composed critical-path simulator with imbalance cases and overlap-versus-serialization bounds, then compare three workload scenarios that keep batch and update fixed while naming the assumption that reverses each winner.
- 6Extend the planner past the TensorTonic topology cases with sharding, expert reuse and schedule costs, keeping rejection reasons and adding no-feasible-plan and tied-score tests; freeze one prediction, reconcile the largest residual with a controlled change, and test a held-out configuration.
- 7Run the TorchFeather composed CPU example, then add a concatenated-batch oracle with update checks and negative cases in trainlab; close with bandwidth-sensitivity and heterogeneous-stage simulations reporting reversals and capacity cliffs.
What you hand in
- The
plan/mesh, batch, memory, volume and critical-path ledgers with the planner and its rejection record. - CPU equivalence evidence: oracle comparisons, residual manifests with raw trials, and the held-out configuration report.
- The three-scenario comparison, sensitivity report, and the composed-oracle negative cases with first-mismatch owners.
How to check it
- Self-grade with the rubric below
- TensorTonic: Choose a Topology-Aware Parallel Plan
Pass the public cases in your harness; keep the simplified scorer apart from the trainlab planner.
- TorchFeather CPU example: GPipe with replicated DP
Run the composed example on CPU; add the concatenated oracle and update checks in trainlab.
- CS336 Assignment 2 parallelism calculations
Solve the data, sharded, tensor and two-dimensional calcs on paper before trusting the ledger.
- How To Scale Your Model: sharding case
Answer on paper first with TPU figures labeled as such; carry the comparison into trainlab.
How it's graded
Mesh legality
Pass: Ownership tables cover every rank once per mesh, round trips pass, and invalid products fail before group creation.
Great: Dense and expert meshes share one world with distinct reduction groups named, plus a rejected configuration per rule.
Ledger accuracy
Pass: Batch, state, activation and volume ledgers match independent shape counts, and peaks come from live windows.
Great: One controlled change moves the largest residual, and the held-out configuration report explains the miss.
Plan ranking
Pass: The search enumerates legal plans with rejection reasons, and the winner carries topology and batch constraints.
Great: Sensitivity and heterogeneous runs name reversals and cliffs, and losing regimes stay in the report.
Composed correctness
Pass: The concatenated-batch oracle matches one update, and a wrong denominator fails with the owner named.
Great: Negative cases cover uneven layouts and tied state, each localized to group, layout and collective order.
Resources
- The Ultra-Scale Playbook - 5D Parallelism and Finding the Best ConfigurationHugging Face
Study 5D Parallelism in a Nutshell, then Finding the Best Training Configuration (fitting a step in memory, reaching the global batch, optimizing throughput) at https://nanotron-ultrascale-playbook.static.hf.space/index.html#finding_the_best_training_configuration. Rebuild a small planner that enumerates legal DP, TP, CP, PP and EP degrees and ranks them by predicted memory and step time; its heatmaps are its own H100 cluster's results.
- Picotron - 4D CompositionHugging Face
Trace create_config.py, process_group_manager.py and train.py across DP, TP, PP and CP. Run the CPU 3D example or a smaller equivalent, assert group membership and compare observed event order with the planner.
- How to Scale Your Model - Chapters 4 to 6Google DeepMind
Use Part 4 (transformer math), Part 5 (training parallelism) and Part 6 (LLaMA 3 case study) to independently estimate parameters, FLOPs, memory, communication, time and cost for one configuration, then the GPU rooflines in Part 12. Keep TPU constants labeled and compare its recommendation with the Playbook.
- Efficient Large-Scale Language Model Training on GPU Clusters Using Megatron-LMNarayanan et al. (SC 2021)
Read the composition of tensor, pipeline and data parallelism, the interleaved schedule and the performance analysis of parallel configurations. Check its guidance against your planner on one model and cluster.
- CS336 Assignment 2 (Spring 2026) - Section 8 Analyzing Parallelism StrategiesStanford University
Solve
data_parallel_calcs,fsdp_calcs,tp_calcsandfsdp_tp_calcs(Sections 8.2 to 8.5) with your planner, and reconcile any disagreement before trusting either. - First-Principles Video - Device Mesh Composition SegmentUmar Jamil
Watch 08:37:34 on device meshes and combining pipeline with data parallelism. Reconstruct its rank-coordinate table and compare it with Picotron process groups and your planner output.
- Distributed Training Guide - Chapter 7 FSDP plus TPLambda Labs
Read the 2D FSDP plus TP path in
07-2d-paralleland explain why FSDP is applied after TP and what limits the TP degree. Running it needs several GPUs. - Transformer Math 101 - Distributed TrainingEleutherAI
Use the sharded-optimizer, 3D-parallelism and activation equations as a cross-check of your planner's memory terms.
- TorchFeather - ParallelDims and Composition PlanTorchFeather
Inspect distributed/parallel_dims.py and model/parallelize.py. Build the exact mesh product and divisibility table for one FSDP, TP, CP, PP and EP configuration, then identify ordering assumptions in its composition.
- TensorTonic - Choose a Topology-Aware Parallel PlanTensorTonic
Solve Choose a Topology-Aware Parallel Plan, then compare its memory and communication model with yours.
- HetPipe - Heterogeneous Partitioning and PlacementPark et al.
Read arXiv:2005.14038v1 Section 4, Pipelined Model Parallelism Within a VW, for its Model Partitioning paragraph, Section 7, Partitioning Algorithm, and Section 8.1, Methodology, for resource allocation to virtual workers. Reuse device-specific compute, memory and placement constraints in a synchronous simulator; do not adopt its stale-weight update semantics or source speedups.
- NanotronHugging Face
Inspect configuration, parallel context and trainer paths used by the Ultra-Scale benchmarks only after the planner works. Its "3D" means DP, TP and PP: there is no context or expert parallelism.
- Bumblebee - Parallel State and CompositionBumblebee
Only as a possible capstone target: read
primitive/parallel/and the composition tests in a clean checkout to compare TP, EP, ETP, CP and PP contracts. Its multi-GPU paths are untested upstream.