NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Improving Automatic Parallel Training via Balanced Memory Workload Optimization

Yujie Wang, Youhe Jiang, Xupeng Miao, Fangcheng Fu, Shenhan Zhu, Xiaonan Nie, Yaofeng Tu, Bin Cui

TL;DR

Galvatron-BMW is a novel framework that automates the complex task of distributed Transformer training by exploring a massive search space of five parallelism dimensions. By combining decision-tree pruning, dynamic programming, and a unique bi-objective workload balancing strategy, it achieves up to 5.3x throughput speedups over standard methods and significantly outperforms expert-tuned systems like DeepSpeed.

What Problem Does This Paper Address?

Training massive Transformer models (like GPT-3 or BERT-xHuge) is a logistical nightmare. These models are too large for a single GPU, requiring them to be split across multiple devices using various "parallelism" strategies. The primary challenge is the "abundance of choice":

  • Data Parallelism (DP): Replicating the model and splitting the data.
  • Sharded Data Parallelism (SDP): Splitting model states to save memory.
  • Tensor Parallelism (TP): Splitting individual operators (like matrix multiplies) across GPUs.
  • Pipeline Parallelism (PP): Splitting layers across GPUs in a sequence.
  • Activation Checkpointing (CKPT): Trading extra computation for reduced memory by recomputing activations during the backward pass.

Finding the optimal combination of these five dimensions for every single layer in a model is a combinatorial explosion that usually requires significant human expertise. Existing "automatic" systems often only look at a subset of these options or rely on sub-optimal heuristics, leading to inefficient hardware utilization.

Methods

The authors propose Galvatron-BMW, a system that takes a model and hardware description as input and outputs an optimal parallel execution plan.

System overview of Galvatron-BMW showing the search space construction, optimization framework, and cost estimator.

Key technical innovations include:

  1. Decision-Tree Search Space Decomposition: To avoid brute-forcing millions of combinations, they use a decision tree to prune inefficient strategies. For example, they prioritize applying Pipeline Parallelism across slower inter-node links (like Ethernet) while keeping high-bandwidth links (like NVLink) for Tensor Parallelism.
  2. Dynamic Programming (DP) Search: They treat the model as a sequence of layers and use a DP algorithm to find the best strategy for each layer that minimizes execution time while staying within a strict memory budget.
  3. Bi-objective Workload Balance (The "BMW" part): Standard pipeline parallelism often suffers from "bubbles" (idle time) or memory imbalances. Galvatron-BMW iteratively adjusts pipeline partitions to balance both computation time and memory usage across stages.
  4. Accurate Cost Estimation: Unlike previous models, their estimator accounts for the 1.3x slowdown that occurs when modern GPUs attempt to perform computation and communication simultaneously (resource contention).
Illustration of the five basic parallelism building blocks used by Galvatron-BMW.

Datasets

The system was evaluated using representative Transformer models across NLP and Computer Vision:

  • NLP: BERT (Huge, xHuge) and T5 (Large, and an imbalanced variant T5-512/4) trained on English Wikipedia.
  • CV: Vision Transformer (ViT-Huge, xHuge) and Swin Transformer (Huge) trained on ImageNet-1K.
  • LLMs: Scaling tests were performed on GPT-3 variants (15B, 39B, and 65B parameters).

Key Insights and Ideas

  • The Memory-Time Trade-off: A perfectly time-balanced pipeline (where every GPU does the same amount of math) is often memory-imbalanced because different stages in a pipeline (specifically using the 1F1B schedule) store different amounts of activations. Galvatron-BMW finds the "sweet spot" between these two extremes.
  • Pruning via Intuition: The authors found that pure Sharded Data Parallelism (SDP) is almost always superior to a hybrid of DP and SDP. By formalizing this as a "Takeaway," they significantly reduced the search space without losing the optimal solution.
  • Layer-Level Heterogeneity: The optimal strategy isn't uniform. For models like Swin Transformer, shallower layers (with large activations) might prefer data parallelism, while deeper layers (with more parameters) benefit more from tensor parallelism.
Comparison of different pipeline partition plans. The "Optimal partition" (dark green) balances memory and time to achieve the highest throughput (Tpt).

Key Results

  • Throughput Gains: Galvatron-BMW achieved up to 530% speedup compared to pure parallelism strategies and up to 242% speedup over state-of-the-art hybrid systems like DeepSpeed 3D.
  • Scalability: The system successfully optimized models with over 10 billion parameters across 64 A100 GPUs.
  • Efficiency: Despite the massive search space, the optimization process takes only hundreds of seconds, which is negligible compared to the weeks required for actual model training.
  • Comparison with Alpa: On large GPT-3 models, Galvatron-BMW outperformed Alpa (a JAX-based auto-parallel system) by better balancing memory and communication through its inclusion of activation checkpointing in the search space.

Limitations and Future Work

  • Homogeneous Hardware: The current framework assumes a cluster of identical GPUs. Extending this to heterogeneous environments (e.g., a mix of A100s and V100s) is a noted future direction.
  • Static Structures: The system is designed for models with static computational graphs. Adapting it for dynamic structures (like MoE models with dynamic routing) would require further research.
  • Search Time for Ultra-Deep Models: While linear, the search time could become a bottleneck for models with thousands of unique layers, suggesting a need for even coarser-grained layer fusing in the future.

Summary updated

BibTeX
@article{wang2024improving,
  author = {Yujie Wang and Youhe Jiang and Xupeng Miao and Fangcheng Fu and Shenhan Zhu and Xiaonan Nie and Yaofeng Tu and Bin Cui},
  title = {{Improving Automatic Parallel Training via Balanced Memory Workload Optimization}},
  journal = {IEEE Trans. Knowl. Data Eng.},
  year = {2024},
  url = {https://openreview.net/forum?id=KCUci1x0tg},
}
Figure