Introduction
Training modern large-scale models like GPT-3 or Llama-2 requires distributing computation across massive GPU clusters. A critical technique for this is intra-operator parallelism, which shards individual operations (e.g., matrix multiplications) across multiple devices. However, finding the optimal sharding plan for a model with tens of thousands of nodes is a daunting task. Existing automated tools often rely on symbolic cost models that fail to account for complex compiler optimizations and hardware-specific runtime behaviors.
The Challenge: Bridging the Gap Between Theory and Reality
Historically, researchers used static models to estimate communication overhead based on FLOPs and bytes. These models frequently diverge from actual performance due to two main factors:
- Compiler Optimizations: Modern compilers like XLA fuse operators, altering the physical execution graph in ways that static models cannot predict.
- Runtime Uncertainty: The performance of communication libraries (e.g., NCCL) varies significantly based on tensor size and hardware interconnects (PCIe vs. NVLink).
As shown in Figure 1, different parallelism strategies lead to varying communication patterns. A plan that appears theoretically optimal in terms of communication volume may actually be slower in practice if it prevents efficient kernel fusion or uses less optimized communication primitives.
The CFP Methodology
To address these discrepancies, the Communication-Free Preserve (CFP) system introduces a profiling-based approach. Instead of guessing performance, CFP measures actual execution time on the target hardware. To make this computationally feasible, CFP employs structural abstractions to shrink the search space.
As illustrated in Figure 4, the CFP workflow consists of five key stages:
- Element-level Dependence Analysis: CFP analyzes how individual tensor elements move to identify "parallelism-preserving subgraphs."
- ParallelBlocks Segmenting: Sequences of operators that can be parallelized without internal communication are grouped into "ParallelBlocks," drastically reducing decision points.
- Fingerprinting & Template Matching: Recognizing that large models are highly repetitive (e.g., dozens of identical Transformer layers), CFP creates "fingerprints" for blocks. It only profiles unique representative segments, reusing these results to estimate the entire model's cost.
- Cost Combination: The system combines profiled costs for unique segments and communication overheads.
- Global Search: A dynamic programming (DP) algorithm finds the globally optimal plan that minimizes total execution time while strictly respecting hardware memory limits.
Evaluation and Key Results
The authors evaluated CFP against the state-of-the-art framework, Alpa, using architectures like BERT, GPT, Llama-2, and GShard MoE (Mixture of Experts) on NVIDIA A100 and V100 clusters.
CFP consistently outperformed existing solutions:
- GPT & Llama-2: Achieved speedups of up to 1.51x and 1.31x, respectively.
- Mixture of Experts (MoE): Achieved a massive 3.43x speedup. CFP correctly identified that "hybrid" parallelism—splitting different dimensions for different parts of the expert network—was superior to the uniform sharding typically suggested by symbolic models.
- Efficiency: By exploiting model symmetry, CFP can optimize models with tens of thousands of operators in less than 15 minutes.
Conclusion
CFP demonstrates that a profiling-based approach, when combined with structural abstraction, can bridge the gap between theoretical parallelism plans and actual runtime performance. By preserving communication-free structures and exploiting model repetition, CFP provides a scalable and highly efficient solution for the next generation of large-scale model training. Future work aims to extend this profiling-based search to jointly optimize both intra-operator and inter-operator (pipeline) parallelism.
Summary updated