Shuffle-Exchange Brings Faster: Reduce the Idle Time During Communication for Decentralized Neural Network Training

Yang XiangarXiv 2020 · DOI · arXiv

Abstract

As a crucial scheme to accelerate the deep neural network (DNN) training, distributed stochastic gradient descent (DSGD) is widely adopted in many real-world applications. In most distributed deep learning (DL) frameworks, DSGD is implemented with Ring-AllReduce architecture (Ring-SGD) and uses a computation-communication overlap strategy to address the overhead of the massive communications required by DSGD. However, we observe that although $O(1)$ gradients are needed to be communicated per worker in Ring-SGD, the $O(n)$ handshakes required by Ring-SGD limits its usage when training with many workers or in high latency network. In this paper, we propose Shuffle-Exchange SGD (SESGD) to solve the dilemma of Ring-SGD. In the cluster of 16 workers with 0.1ms Ethernet latency, SESGD can accelerate the DNN training to $1.7 \times$ without losing model accuracy. Moreover, the process can be accelerated up to $5\times$ in high latency networks (5ms).

Introduction

In large-scale distributed training, workers must synchronize their gradients to ensure they are all learning the same global model. Most modern frameworks (like PyTorch and TensorFlow) use Ring-AllReduce for this. While Ring-AllReduce is efficient in terms of bandwidth—each worker sends a constant amount of data regardless of the number of workers—it has a hidden "latency tax."

Comparison of centralized and decentralized (ring) communication architectures alongside the step-by-step gradient exchange process.

To synchronize a single layer across $n$ workers, the system requires $O(n)$ sequential handshakes. In a cluster with many workers or high network latency (e.g., standard Ethernet vs. expensive InfiniBand), the time spent waiting for these handshakes to complete—the "idle time"—can dominate the training process. For a 50-layer model on 16 workers, you might trigger 1,500 handshakes per iteration. The authors observed that in some configurations, this idle time accounts for over 80% of the total communication cost.

Methodology: Shuffle-Exchange SGD (SESGD)

The authors propose Shuffle-Exchange SGD (SESGD) to break this $O(n)$ bottleneck. The approach consists of three main components:

  1. Shuffle-Exchange: Instead of one giant ring, workers are divided into several smaller groups. In each iteration, workers only synchronize gradients with others in their specific group. This reduces the number of handshakes from $O(n)$ to $O(\sqrt{n})$.
  2. Randomized Grouping: To ensure that information eventually propagates to all workers, the groups are randomly reshuffled at the start of every iteration. To keep the system decentralized and avoid extra communication, every worker uses the same pseudo-random seed to determine the new group assignments.
  3. Gradient Correction: Simply shuffling workers would normally lead to "gradient error," where local models diverge too far from the global truth. The authors introduce a correction formula that treats local model parameters as accumulated gradients, ensuring the decentralized process still converges to the same solution as standard SGD.

Experimental Evaluation

The researchers evaluated SESGD using three standard image classification benchmarks: CIFAR-10, CIFAR-100, and ImageNet. They tested these datasets across various architectures, including ResNet18, ResNet50, DenseNet121, and VGG16.

Results and Key Insights

The primary bottleneck in many real-world clusters is not bandwidth, but the number of communication events (handshakes). By reducing these events, SESGD significantly improves efficiency.

Timeline visualization of GPU computation and Ethernet (ETH) communication, illustrating the idle time gaps that occur during synchronization.
  • Significant Speedups: In a cluster of 16 workers with low-latency Ethernet (0.1ms), SESGD accelerated training by 1.7x. In high-latency environments (5ms, typical of WLAN or less optimized cloud setups), the speedup reached 5x.
  • No Accuracy Trade-off: Across all tests, SESGD achieved final top-1 accuracies nearly identical to standard Ring-SGD. For example, on CIFAR-10, SESGD hit 93.30% accuracy compared to Ring-SGD’s 93.14%.
  • Decentralized Coordination: By using a shared random seed, the authors achieve complex group shuffling without a central "master" node, maintaining the benefits of a decentralized architecture.

Conclusion and Future Work

SESGD demonstrates that you don't need to talk to everyone at every step. As long as the communication graph is "connected" over the course of several iterations (via shuffling), the mathematical convergence remains stable. Future work could investigate how SESGD interacts with gradient quantization or sparsification to see if bandwidth and latency bottlenecks can be solved simultaneously. While the $O(\sqrt{n})$ theory suggests even better gains at larger scales, empirical data on hundreds or thousands of nodes remains a subject for future study.

Summary updated

Abstract

As a crucial scheme to accelerate the deep neural network (DNN) training, distributed stochastic gradient descent (DSGD) is widely adopted in many real-world applications. In most distributed deep learning (DL) frameworks, DSGD is implemented with Ring-AllReduce architecture (Ring-SGD) and uses a computation-communication overlap strategy to address the overhead of the massive communications required by DSGD. However, we observe that although $O(1)$ gradients are needed to be communicated per worker in Ring-SGD, the $O(n)$ handshakes required by Ring-SGD limits its usage when training with many workers or in high latency network. In this paper, we propose Shuffle-Exchange SGD (SESGD) to solve the dilemma of Ring-SGD. In the cluster of 16 workers with 0.1ms Ethernet latency, SESGD can accelerate the DNN training to $1.7 \times$ without losing model accuracy. Moreover, the process can be accelerated up to $5\times$ in high latency networks (5ms).
BibTeX
@misc{xiang2020shuffle,
  author = {Yang Xiang},
  title = {{Shuffle-Exchange Brings Faster: Reduce the Idle Time During Communication for Decentralized Neural Network Training}},
  year = {2020},
  eprint = {2007.00433},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2007.00433},
}
Figure