Varuna: Scalable, Low-cost Training of Massive Deep Learning Models

Sanjith Athlur, Nitika Saran, Muthian Sivathanu, Ramachandran Ramjee, Nipun Kwatra

Abstract

Training massive deep learning models with billions of parameters typically requires expensive, specialized "hyperclusters" with high-speed interconnects. Varuna is a training system designed to democratize this process by enabling efficient training on commodity networking and low-cost, pre-emptible "spot" VMs. By leveraging a novel pipeline parallelism approach and dynamic "job morphing," Varuna reduces training costs by 4-5x while maintaining performance and accuracy.

Introduction

The current landscape of state-of-the-art AI, featuring models like GPT-3, is dominated by the need for "hyperclusters"—hundreds of GPUs linked via ultra-high-speed interconnects like NVLink or Infiniband. These requirements create significant resource silos and financial barriers. Furthermore, existing frameworks are often "brittle"; they cannot easily adapt to the fluctuating availability of cheap "spot" VMs, which cloud providers can reclaim at any time.

Varuna addresses these challenges by tackling three main pillars: handling slow commodity networks, managing transient resources, and ensuring ease of use for programmers.

Parallelism in Deep Learning

To understand Varuna's efficiency, one must look at how models are partitioned across GPUs. Traditional approaches often rely on data parallelism or intra-layer model parallelism.

Overview of different GPU training paradigms, highlighting the distinction between data-parallel and model-parallel (inter-layer vs intra-layer) approaches.

While intra-layer parallelism (splitting a single layer across multiple GPUs) is common, it requires massive bandwidth to synchronize activations and gradients frequently. Varuna instead favors pipeline parallelism (inter-layer partitioning), where different layers are placed on different GPUs. The authors demonstrate that pipeline communication is approximately 300x more efficient than intra-layer methods, making it feasible to train massive models over standard Ethernet.

The Varuna System

Varuna introduces several architectural innovations to facilitate training on commodity hardware:

1. Novel Micro-batch Scheduling

A core challenge in pipeline parallelism is the "bubble"—idle time where GPUs wait for data from previous stages. Varuna employs a new scheduling algorithm that outperforms predecessors like GPipe.

Comparison of the Varuna schedule versus the GPipe schedule, demonstrating how Varuna reduces idle time and handles micro-batches more efficiently.

As shown in the scheduling comparison, Varuna's approach is "work-conserving." It can reorder tasks to handle network jitter opportunistically, ensuring that the pipeline remains as full as possible even under the less predictable conditions of commodity networking.

2. Job Morphing for Elasticity

"Job morphing" is Varuna’s standout feature for handling pre-emptible resources. When GPUs are added or removed from a cluster, Varuna automatically reconfigures the pipeline depth and the number of data-parallel replicas. Crucially, it maintains a constant global batch size and hyperparameters, ensuring that the mathematical consistency of the training process is preserved regardless of the underlying hardware changes.

3. Auto-partitioning and Tracer

To minimize the burden on developers, Varuna includes an auto-partitioning tool that identifies optimal "cut-points" in a model. It also features a tracer to detect and synchronize "hidden" shared states, such as tied weights, across different partitions, making the system largely "non-intrusive" to existing codebases.

Evaluation and Results

The researchers evaluated Varuna using various massive language models, including BERT-large and GPT-2 variants ranging from 2.5 billion to 200 billion parameters.

  • Cost Efficiency: By enabling the use of spot VMs, Varuna achieves a 4-5x reduction in cost compared to dedicated instances.
  • Throughput: On commodity networking, Varuna is up to 18x faster than intra-layer approaches like Megatron and 26% faster than other pipeline-parallel systems like GPipe.
  • Scalability: The system successfully trained a 200 billion parameter model on 294 GPUs over commodity networking, achieving 27.3 TFlops/s per GPU.
  • Convergence: Empirical evidence shows that a 2.5B parameter GPT-2 model converges to the same accuracy even when using a 16x larger mini-batch than previous state-of-the-art implementations.

Conclusion

Varuna challenges the belief that massive model training is reserved for those with access to specialized hyperclusters. By shifting the communication bottleneck through efficient pipeline parallelism and introducing robust elasticity via job morphing, Varuna makes large-scale AI training more accessible and cost-effective. While future work may explore decentralized management to further improve fault tolerance, the current open-source release provides a powerful tool for the community to scale Transformer-based architectures on standard data center hardware.

Summary updated

BibTeX
@inproceedings{athlur2022varuna,
  author = {Sanjith Athlur and Nitika Saran and Muthian Sivathanu and Ramachandran Ramjee and Nipun Kwatra},
  title = {{Varuna: Scalable, Low-cost Training of Massive Deep Learning Models}},
  booktitle = {EuroSys},
  year = {2022},
  doi = {10.1145/3492321.3519584},
}
Figure