Auto-Parallelizing Large Models with Rhino: A Systematic Approach on Production AI Platform

Shiwei Zhang, Lansong Diao, Siyu Wang, Zongyan Cao, Yiliang Gu, Chang Si, Ziji Shi, Zhen Zheng, Chuan Wu, Wei Lin

TL;DR

Rhino is a production-ready system that automatically transforms single-device tensor programs into highly efficient distributed programs capable of scaling to thousands of GPUs. By operating on a low-level compiler intermediate representation (IR) and employing a novel hierarchical search algorithm, Rhino achieves 19–25% better throughput than state-of-the-art frameworks like Alpa and DeepSpeed while significantly reducing compilation time.

What Problem Does This Paper Address?

Training "Large Models" with hundreds of billions of parameters (like PaLM or M6) is a monumental engineering challenge. It requires complex "3D parallelism"—a mix of data, model, and pipeline parallelism—that usually takes experts weeks to tune manually.

While researchers have proposed "auto-parallelization" systems to solve this, the authors identify four major hurdles preventing these systems from succeeding in real-world production:

  1. Semantic Dependency: Most systems rely on high-level concepts like "layers" or "batch size," which makes them brittle when new, non-standard architectures emerge.
  2. Limited Strategy Space: They often miss advanced techniques like "strided partitioning" or pipeline parallelism for non-linear models.
  3. Brittle Heuristics: Search algorithms are often based on intuition rather than data from real production clusters.
  4. Black-Box Nature: Users have little control when things go wrong, such as encountering Out-of-Memory (OOM) errors.

Methods

Rhino addresses these issues by working at the HLO (High-Level Optimizer) level—the same IR used by the XLA compiler. This makes it agnostic to the specific deep learning framework (JAX, TensorFlow, etc.) and the high-level model semantics.

To find the best way to shard tensors across devices (SPMD parallelism) without falling into an NP-hard search trap, Rhino uses a three-level subgraph merging algorithm:

  • Level 1 (Dynamic Programming): It identifies "cone structures"—subgraphs where nodes have only one input except for the root. It uses DP to find the best sharding for these local groups.
  • Level 2 (Integer Linear Programming): It groups these cones into linear segments and uses ILP to optimize sharding within those segments.
  • Level 3 (DP): Finally, it "stitches" these segments together to form the global strategy.
Figure 4: Hierarchical segmentation on graph and their match- ing merging methods.

Advanced Parallelism

Rhino introduces strided partitioning, allowing tensors to be sharded in ways that minimize communication during Reshape operations—a common bottleneck that human experts often overlook.

Figure 3: Different sharding methods of a 4x2 tensor.

Pipeline Planning

For pipeline parallelism, Rhino uses ILP with a "bound tightening" heuristic. By analyzing the ancestors and descendants of instructions, it prunes the search space, ensuring the optimizer doesn't waste time on wildly unbalanced stage divisions.

Datasets

The system was evaluated using several representative large-scale model architectures rather than specific static datasets:

  • GPT-3 variants: Ranging from 350M to 6.7B parameters.
  • GShard MoE (Mixture-of-Experts): Ranging from 350M to 10B parameters.
  • General Models: VGG19 (image recognition), DNABERT (genomic sequences), UNet (diffusion models), and Wide-ResNet.

Key Insights and Ideas

  • The 0.5% Rule: The authors discovered that in massive computation graphs, only about 0.5% of nodes are "critical nodes" (computationally intensive ops like MatMul). By using these as boundaries for segmentation, Rhino reduces a graph of 76,000 instructions down to just 377 subgraphs, making the search feasible.
  • Semantic Independence is Power: Because Rhino doesn't care about "layers," it can discover novel strategies, such as sharding a tensor differently on the forward pass versus the backward pass of the same "layer."
  • Memory as a Hard Constraint: Instead of just trying to be fast, Rhino treats GPU memory limits as a strict constraint in its ILP formulation, effectively preventing the OOM errors that plague other auto-parallelizers.

Key Results

  • Superior Throughput: Rhino outperformed Alpa and Megatron/DeepSpeed by 19% to 25% in end-to-end training throughput.
  • High Efficiency: It achieved a Model Flops Utilization (MFU) of up to 75.9% for GPT models and 55.1% for MoE models.
  • Search Speed: The system offers two optimization levels. The "O2" level speeds up the strategy search by 1.5x to 3x while sacrificing only about 10% in final performance, making it ideal for rapid iteration in production.
  • Scalability: Rhino demonstrated near-linear scaling when moving from 1 to 16 GPUs across multiple nodes.
Figure 2: Rhino execution planner workflow.

Limitations and Future Work

While Rhino is highly effective for static computation graphs, the paper does not deeply explore dynamic workloads where the graph structure changes during execution. Additionally, while the system handles memory constraints well, the authors note that the "O2" optimization level can sometimes lead to increased use of AllToAll communication, which might not be optimal on clusters with lower interconnect bandwidth. Future work could involve further refining these heuristics to better account for specific network topologies.

Summary updated

BibTeX
@misc{zhang2023auto,
  author = {Shiwei Zhang and Lansong Diao and Siyu Wang and Zongyan Cao and Yiliang Gu and Chang Si and Ziji Shi and Zhen Zheng and Chuan Wu and Wei Lin},
  title = {{Auto-Parallelizing Large Models with Rhino: A Systematic Approach on Production AI Platform}},
  year = {2023},
  eprint = {2302.08141},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2302.08141},
}
Figure