Abstract
Deep learning frameworks such as TensorFlow and PyTorch provide a productive interface for expressing and training a deep neural network (DNN) model on a single device or using data parallelism. Still, they may not be flexible or efficient enough in training emerging large models on distributed devices, which require more sophisticated parallelism beyond data parallelism. Plugins or wrappers have been developed to strengthen these frameworks for model or pipeline parallelism, but they complicate the usage and implementation of distributed deep learning. Aiming at a simple, neat redesign of distributed deep learning frameworks for various parallelism paradigms, we present OneFlow, a novel distributed training framework based on an SBP (split, broadcast and partial-value) abstraction and the actor model. SBP enables much easier programming of data parallelism and model parallelism than existing frameworks, and the actor model provides a succinct runtime mechanism to manage the complex dependencies imposed by resource constraints, data movement and computation in distributed deep learning. We demonstrate the general applicability and efficiency of OneFlow for training various large DNN models with case studies and extensive experiments. The results show that OneFlow outperforms many well-known customized libraries built on top of the state-of-the-art frameworks.
Introduction
As deep learning models like GPT-3 grow to hundreds of billions of parameters, they increasingly exceed the memory and computational capacity of single accelerators. While established frameworks like TensorFlow and PyTorch excel at single-device execution and basic data parallelism, they were not natively architected for the complex model and pipeline parallelism required for today's massive architectures. Current solutions often rely on external plugins or wrappers (e.g., Horovod, DeepSpeed) which can introduce significant system overhead, complicate codebases, and lead to resource management issues like memory deadlocks. OneFlow addresses these challenges by redesigning the framework from the ground up, treating distributed communication as a first-class citizen.
Methods
OneFlow's design rests on two core pillars: a mathematical abstraction for tensor distribution and a decentralized runtime based on the actor model.
The SBP Abstraction
OneFlow views every tensor as a "global tensor" mapped to physical devices through three primary states:
- Split (S): The tensor is partitioned along a specific dimension across devices.
- Broadcast (B): Each device maintains an identical copy of the full tensor.
- Partial-value (P): Each device holds a partial result (e.g., a partial sum) that requires reduction to achieve the final value.
This SBP abstraction allows the compiler to automatically resolve distribution mismatches by inserting "boxing" operations (such as All-Gather or Reduce-Scatter), enabling seamless transitions between different parallelism schemes without manual intervention. For instance, implementing ZeRO (optimizer sharding) required only 300 lines of code in OneFlow, compared to thousands in other frameworks.
Actor-Based Runtime
To handle the complexity of distributed execution, OneFlow replaces centralized scheduling with a decentralized actor model. Each operation in the computational graph is represented by an "actor" that manages its own state and communicates via asynchronous message passing.
Crucially, OneFlow treats memory and hardware resources as explicit dependencies. Actors only execute when both data and resource "registers" are available, preventing out-of-memory errors and enabling efficient pipelining and backpressure management.
Key Results
The framework was evaluated across diverse benchmarks and large-scale models:
- Data Parallelism: On ResNet-50, OneFlow outperformed official TensorFlow and PyTorch implementations by 23% to 213%, depending on hardware precision.
- Model Parallelism: For large-scale face recognition (InsightFace), OneFlow matched or exceeded the throughput of highly optimized custom PyTorch versions with significantly less programming effort.
- Hybrid Parallelism: In GPT-2 training, OneFlow achieved higher throughput and lower memory consumption than specialized libraries like Megatron-LM and ZeRO-DP.
- CTR Estimation: For models with massive embedding tables (Wide & Deep), OneFlow outperformed NVIDIA’s HugeCTR, maintaining a lower memory footprint and avoiding OOM errors even with vocabularies exceeding 50 million.
Conclusion
OneFlow demonstrates that a unified abstraction (SBP) combined with a resource-aware runtime (Actor Model) can significantly simplify and accelerate distributed deep learning. By moving away from the "single-device first" mindset of legacy frameworks, OneFlow provides a scalable foundation for the next generation of massive AI models. Future work includes automating SBP configuration via a cost model and enhancing elasticity for dynamic hardware environments.
Summary updated