BML: A High-performance, Low-cost Gradient Synchronization Algorithm for DML Training

Songtao Wang, Dan Li, Yang Cheng, Jinkun Geng, Yanshu Wang, Shuai Wang, Shu-Tao Xia, Jianping Wu

TL;DR

BML is a novel gradient synchronization algorithm designed to run on BCube network topologies rather than the traditional Fat-Tree structures used in most data centers. By leveraging a hierarchical, multi-threaded approach, BML reduces distributed training time by up to 56% while requiring significantly fewer switches, making large-scale machine learning both faster and more cost-effective.

The Communication Wall in Distributed ML

In the world of Distributed Machine Learning (DML), adding more machines should theoretically mean faster training. However, practitioners often hit a "communication wall." As models grow to billions of parameters, the time spent synchronizing gradients between servers starts to dwarf the time spent actually computing them.

This problem is exacerbated by a quirk of ML convergence: to keep a model's quality high at a large scale, researchers must often reduce the "sub-minibatch" size on each individual GPU. When these batches get smaller, the ratio of communication to computation shifts dramatically toward communication. Current data center standards, like the Fat-Tree (Clos) topology, are great for general-purpose traffic but inefficient for the specific, intensive "all-to-all" patterns of gradient synchronization. They require many expensive switches and force data to traverse multiple "hops," leading to high latency and wasted bandwidth.

Methods: Topology and Algorithm Co-design

The authors propose a two-part solution: a shift in hardware topology and a custom algorithm to exploit it.

1. BCube Topology

Instead of Fat-Tree, the authors advocate for BCube, a recursive, server-centric network.

BCube Network Topology

In BCube, servers have multiple network interfaces (NICs) and connect to multiple levels of small, commodity switches. This reduces the total number of switches needed and puts the servers at the center of the routing logic.

2. The BML Algorithm

BML (BCube Machine Learning) is a fully distributed synchronization algorithm designed specifically for this topology. It operates in two main stages:

  • Aggregation Stage: Servers exchange and sum gradient pieces with their neighbors across different network levels.
  • Broadcast Stage: The fully aggregated gradients are pushed back out to all participants.

3. Parallelism

BML runs $k$ synchronization threads simultaneously (where $k$ is the number of network interfaces per server). Each thread uses a different "level" of the BCube network, ensuring that synchronization traffic never collides and utilizes the full bidirectional bandwidth of every link.

BML Algorithm Execution

Key Insights and Results

The researchers evaluated BML using classic deep learning benchmarks (MNIST for LeNet-5 and ImageNet for VGG-19) on a physical testbed of 9 dual-GPU servers connected via 40Gbps Mellanox NICs.

  • Topology-Algorithm Co-design: You cannot optimize DML through software alone. By choosing a network topology (BCube) that matches the hierarchical nature of the BML algorithm, the theoretical synchronization time drops to $1/k$ of the standard Parameter Server (PS) approach.
  • Switch Efficiency: BML is remarkably "lean." It theoretically requires only about $k/5$ of the switches (where $k$ is typically 2–4) compared to a Fat-Tree network connecting the same number of servers.
  • Solving the Small-Batch Bottleneck: BML shows its greatest strength when the sub-minibatch size is small, which is critical for maintaining model accuracy when scaling to hundreds or thousands of GPUs.
  • Job Completion Time (JCT): In real-world tests, BML reduced the total training time for LeNet-5 by 18.7% to 56.4% and for VGG-19 by 29.2% to 52.1% compared to the standard Parameter Server model on a Fat-Tree network.

Limitations and Future Work

  • Hardware Requirements: BML requires servers to be equipped with multiple NICs (e.g., 2 to 4). While easy to achieve via PCIe slots, it departs from standard single-NIC server configurations.
  • Framework Integration: The current implementation is built for TensorFlow. Significant engineering effort would be needed to integrate BML into other popular frameworks like PyTorch or JAX.
  • Physical Scale: The empirical results are based on a 9-server cluster. While theoretical math scales to 1,024 servers, testing on a "mega-cluster" of hundreds of nodes is necessary to uncover potential real-world routing or congestion issues at massive scales.

Summary updated

BibTeX
@inproceedings{wang2018bml,
  author = {Songtao Wang and Dan Li and Yang Cheng and Jinkun Geng and Yanshu Wang and Shuai Wang and Shu-Tao Xia and Jianping Wu},
  title = {{BML: A High-performance, Low-cost Gradient Synchronization Algorithm for DML Training}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2018},
}
Figure