Unit 10 of 13 · about 5 hours · implement
Configuration search with legal-plan pruning and predicted regimes
The preceding ledgers become useful only when they reject bad allocations and expose alternatives. Search a bounded space before requesting hardware, then validate its leading assumptions.
You'll be able to
- Enumerate legal integer plans and retain a reason for every rejection.
- Rank feasible plans using peak memory, local compute, communication, bubble and topology costs.
- Predict OOM, exposed-communication and bubble-dominated regimes without presenting analytical labels as measurements.
Covers
Read
In this order, only the parts listed
0 of 2 done
- A bounded configuration searchThe Ultra-Scale Playbook - 5D Parallelism and Finding the Best Configuration
Finding the Best Training Configuration: Steps 1 to 3, then Benchmarking thousands of configurations
Use the search ordering, not fixed model-size or rank-count thresholds as universal rules. The heatmaps are Hugging Face's H100-cluster results at sequence length 4096 and global batch 1M tokens.
- A finite planner with an exact scoring contractTensorTonic - Choose a Topology-Aware Parallel Plan
Choose a Topology-Aware Parallel Plan: statement, feasibility rules, lexicographic score and three public examples
Implement its supplied model exactly for this problem. It has no FSDP, EP, pipeline activation-lifetime or step-time model; passing it does not validate those parts of trainlab.
Focus on
- Enumerate factor tuples, then prune by mesh reuse, model divisibility, batch integrality and peak capacity with reserve. For degree 1, charge no network transfer. Keep a full rejection record instead of deleting inconvenient cases.
- Apply stage-specific cost functions to local shapes. A plan with smaller FLOPs per rank can lose through tiny GEMMs, launch overhead, bubbles or contending links.
- Use predicted regimes as hypotheses: memory exceeds usable capacity, a required transfer is exposed, or idle schedule time dominates. Feasibility and a fast predicted time are separate questions.
- Rank only plans with the same model, valid tokens and update contract. Add checkpoint staging, failure-domain restrictions and supported implementation features as constraints, not invented performance bonuses.
Common mistakes · 3
- Using the TensorTonic score as a throughput estimate. It ranks modeled byte counts lexicographically, not seconds.
- Pruning on persistent memory alone while a gather or pipeline live set exceeds capacity.
- Treating the first predicted winner as measured optimal. Preserve close alternatives and uncertainty ranges.
Try it yourself
Closed-book, before checking anything
Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.Can a configuration with the correct world-size product still be illegal?Answer
Yes. It can violate batch, tensor-layout, expert-reuse, sequence, stage or supported-implementation constraints.
2.Why should feasibility use a memory reserve?Answer
Tensor estimates omit or approximate workspace, runtime allocations and allocator effects. State the reserve and test sensitivity rather than treating nominal capacity as fully usable.
3.What evidence distinguishes a predicted communication regime from a demonstrated one?Answer
A measured timeline and controlled variation showing exposed communication limits step time on the executed topology. Byte volume alone is not enough.
Practice
- TensorTonic: Choose a Topology-Aware Parallel Plan
Implement
topology_aware_parallel_planusing the function signature and public cases on the pageThe free public cases exercise single-node TP, CP with PP, and DP with TP under the supplied model. They do not check FSDP, EP or real throughput. Add your own no-feasible-plan and tied-score tests; the section mini-project extends the planner.
You're done when
The named problem's public cases pass, independent enumerations agree, and your extended planner reports feasible candidates and explicit rejection reasons for all three scenarios.
Only when you can do this without notes.
Leads to
Notes
Resources · 2 for this unit, 11 more in the section
- The Ultra-Scale Playbook - 5D Parallelism and Finding the Best ConfigurationHugging Face · primary
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.
- TensorTonic - Choose a Topology-Aware Parallel PlanTensorTonic · support
Solve Choose a Topology-Aware Parallel Plan, then compare its memory and communication model with yours.
Also in this section
- Picotron - 4D CompositionHugging Face · required
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.
- First-Principles Video - Device Mesh Composition SegmentUmar Jamil · support
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 · support
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. - How to Scale Your Model - Chapters 4 to 6Google DeepMind · required
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) · required
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 · required
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. - Transformer Math 101 - Distributed TrainingEleutherAI · support
Use the sharded-optimizer, 3D-parallelism and activation equations as a cross-check of your planner's memory terms.
- TorchFeather - ParallelDims and Composition PlanTorchFeather · support
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.
- NanotronHugging Face · depth
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 · depth
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. - HetPipe - Heterogeneous Partitioning and PlacementPark et al. · support
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.