TL;DR
Training frontier-scale language models across tens of thousands of chips requires slicing up weights and activations, but conventional frameworks lock each network axis into a single rigid parallelism role (like data or tensor parallelism) across an entire layer. SMART-Sharding breaks that rigidity by using reusable symbolic cost tables and memory-aware dynamic programming to search a staggering $2.1 \times 10^{34}$ per-tensor sharding plans in about 92 seconds on CPUs. Across five frontier Mixture-of-Experts (MoE) models on a modeled 32,768-chip TPU cluster, it delivers 1.22–1.78× predicted per-layer speedups over the best conventional strategies and finds valid plans on hardware topologies where conventional approaches fail completely.
What Problem Does This Paper Address?
When training massive AI models on large clusters—such as 3D-torus TPU pods with $X$, $Y$, and $Z$ ring axes—engineers have to decide how to partition (shard) every weight and activation tensor across chips. Conventional frameworks simplify this by assigning one fixed parallelism role to each mesh axis for the entire transformer layer:
- Data Parallelism (RDP / FSDP): Splits the batch (and, in FSDP, the model weights).
- Tensor Parallelism (TP): Splits attention heads and expert widths.
- Sequence + Expert Parallelism (SP+EP): Splits sequence length in attention and experts in MoE blocks.
This one-role-per-axis rule is easy to reason about, leaving only $4^3 = 64$ conventional plans on a 3D torus. However, it leaves huge performance on the table. A role couples how a block's inputs and weights are sharded, and it forces the same axis to play the same role in both the attention and MoE blocks.
The alternative—assigning shardings independently to every tensor—explodes the search space to $2.1 \times 10^{34}$ candidate plans for a single MoE layer. Brute-force enumeration is impossible, and greedy local choices fail because one tensor's sharding dictates the communication cost of downstream blocks.
Methods
SMART-Sharding makes exact per-tensor sharding search tractable by combining symbolic performance modeling with dynamic programming:
- Reusable Symbolic Cost Tables: Building on SMART (a symbolic roofline performance model), SMART-Sharding compiles each operator block in a layer into closed-form symbolic formulas for compute, HBM, and interconnect time. Instead of pricing complete plans, it builds a cost table per block for every valid combination of its own input, weight, and output shardings. This table depends only on the number of mesh axes (1, 2, or 3), not on specific model sizes or chip counts—so it is built once (206 seconds for 3 axes) and reused across all design points.
- Memory-Aware Dynamic Programming: For a specific model and topology, SMART-Sharding substitutes the numeric parameters into the table and runs a backward dynamic program through the layer. Because each block only depends on the few tensors currently "live" at that point in the layer (at most 3 at once for these transformer layers), the search avoids combinatorial explosion.
- Pareto Frontiers for Memory and Weight Prefetching: Training must fit within strict chip HBM limits, and weight all-gathers can be prefetched to overlap with earlier computation. Because neither memory nor overlapped prefetching can be captured by a single additive cost, the dynamic program tracks a Pareto frontier of
(memory, block_time, gather_time)triples at each step, pruning only strictly dominated options.
Datasets
Rather than training on a standard ML dataset, the authors evaluate SMART-Sharding on five synthetic, frontier-scale MoE models (gpt-oss-synthetic-1 through 5, inspired by the GPT-OSS architecture). These models scale from 0.558T to 118T total parameters (0.143T to 1.95T active parameters) and are evaluated on a modeled 32,768-chip TPU v7 (Ironwood-like) pod across 27 torus mesh shapes (1D, 2D, and 3D). They also run two parameter sweeps on gpt-oss-synthetic-3 varying the number of experts ($E$) and expert width ($F$) at a fixed active parameter count.
Key Insights and Ideas
- Conventional plans are often infeasible, not just slower: Across 135 model-and-topology design points, 110 admit a feasible plan—yet conventional strategies are feasible at only 60 of them and optimal at just 13. Rigid axis roles frequently violate divisibility constraints or blow past HBM limits.
- Decoupling activation and weight sharding pays off: SMART-Sharding can use a mesh axis to shard attention activations by batch (eliminating activation collectives) while sharding attention weights by head (which can be prefetched ahead of time). No conventional role allows this pairing.
- Sharding experts across multiple axes: In MoE-heavy models, SMART-Sharding shards experts across both short mesh axes (e.g., $Y$ and $Z$), halving the expert-weight gather time compared to conventional plans that can only shard experts along one axis.
- Model geometry bounds the gains: When varying expert width at fixed active parameters, SMART-Sharding's speedup shrinks to $1.02\times$ at the widest experts ($F=4D$), where both conventional and custom plans become bottlenecked by gathering expert weights.
Key Results
- Search Speed: Building the 3-axis symbolic cost table takes 206 seconds once; searching $2.1 \times 10^{34}$ candidates per 3D-torus design point takes a median of 92 seconds on CPUs.
- Per-Layer Speedups: Across the five MoE models (each using its best feasible topology), SMART-Sharding achieves 1.22–1.78× predicted per-layer speedups (median 1.33×) over the best conventional plans.
- Same-Topology Gains: On the 60 design points where both methods are feasible, SMART-Sharding is strictly faster at 47 (reaching up to 5.9×, median 1.38×) and ties at 13.
Limitations and Future Work
- Forward-Pass Focus: While the memory model accounts for gradients and optimizer states, the runtime cost model currently evaluates only the forward pass, omitting backward-pass compute and gradient-reduction communication.
- Omitted System Optimizations: The framework does not yet model pipeline parallelism or offloading weights to host memory. The authors note that both extensions are complementary to their symbolic dynamic programming approach and leave them for future work.
Summary updated