BlueFog: Make Decentralized Algorithms Practical for Optimization and Deep Learning

Bicheng Ying, Kun Yuan, Hanbin Hu, Yiming Chen, Wotao YinarXiv 2021

Abstract

Decentralized algorithm is a form of computation that achieves a global goal through local dynamics that relies on low-cost communication between directly-connected agents. On large-scale optimization tasks involving distributed datasets, decentralized algorithms have shown strong, sometimes superior, performance over distributed algorithms with a central node. Recently, developing decentralized algorithms for deep learning has attracted great attention. They are considered as low-communication-overhead alternatives to those using a parameter server or the Ring-Allreduce protocol. However, the lack of an easy-to-use and efficient software package has kept most decentralized algorithms merely on paper. To fill the gap, we introduce BlueFog, a python library for straightforward, high-performance implementations of diverse decentralized algorithms. Based on a unified abstraction of various communication operations, BlueFog offers intuitive interfaces to implement a spectrum of decentralized algorithms, from those using a static, undirected graph for synchronous operations to those using dynamic and directed graphs for asynchronous operations. BlueFog also adopts several system-level acceleration techniques to further optimize the performance on the deep learning tasks. On mainstream DNN training tasks, BlueFog reaches a much higher throughput and achieves an overall $1.2\times \sim 1.8\times$ speedup over Horovod, a state-of-the-art distributed deep learning package based on Ring-Allreduce. BlueFog is open source at https://github.com/Bluefog-Lib/bluefog.

Introduction

In large-scale distributed training, communication is almost always the bottleneck. Standard methods rely on global averaging—either through a central Parameter Server or the popular Ring-Allreduce protocol. As the number of GPUs increases, the time spent synchronizing gradients grows, often linearly with the number of nodes in Ring-Allreduce.

Comparison of distributed training architectures: Parameter Server, Ring Allreduce, and Decentralized.

Decentralized algorithms offer a solution: instead of global communication, each node only communicates with its immediate neighbors in a sparse graph. This theoretically makes communication costs constant ($O(1)$), regardless of cluster size. However, implementing these algorithms efficiently is difficult, leading most researchers to stick with slower, centralized defaults.

Methods

BlueFog is a high-performance Python library designed to bridge the gap between decentralized theory and system-level performance. It provides a unified abstraction for various communication styles, including static vs. dynamic topologies and push vs. pull communication.

Graph topology and corresponding weight matrices for pull and push communication styles.

Key technical contributions include:

  • Unified Abstraction: A single interface for diverse decentralized algorithms, supporting both synchronous and asynchronous modes.
  • Deep Learning Wrappers: Seamless integration with PyTorch, injecting decentralized logic like neighbor_allreduce into training loops.
  • System-Level Optimizations: Techniques such as tensor fusion to reduce network call overhead, hierarchical communication (leveraging NVLink for intra-node speed), and computation/communication overlapping (AWC/ATC strategies).
  • Asynchronous RMA: Using Remote Memory Access to allow "push" or "pull" operations without global handshakes, mitigating the impact of stragglers.

Evaluation

The authors evaluated BlueFog using standard benchmarks like ImageNet-1k and models including ResNet-50, VGG-16, and BERT-large to cover various parameter sizes and computation-to-communication ratios.

Key results include:

  • Throughput: BlueFog achieved a $1.2\times \sim 1.8\times$ speedup over Horovod on mainstream DNN tasks.
  • Scalability: For communication-heavy models like VGG-16, BlueFog maintained higher efficiency as GPU counts increased compared to Ring-Allreduce.
  • Convergence: On ImageNet, decentralized training reached the same top-1 accuracy as standard Distributed SGD, proving that sparse averaging does not sacrifice model quality.

Conclusion

BlueFog demonstrates that decentralized algorithms are a practical, high-performance alternative to centralized methods for deep learning. While performance gains are most notable in network-constrained environments (e.g., 25Gbps Ethernet), the library's flexibility and system-level optimizations make it a valuable tool for large-scale optimization. Future work includes deeper integration with NVIDIA’s NCCL for all asynchronous features and exploring sensitivity to hyperparameters in decentralized settings.

BlueFog is open-source at https://github.com/Bluefog-Lib/bluefog.

Summary updated

BibTeX
@misc{ying2021bluefog,
  author = {Bicheng Ying and Kun Yuan and Hanbin Hu and Yiming Chen and Wotao Yin},
  title = {{BlueFog: Make Decentralized Algorithms Practical for Optimization and Deep Learning}},
  year = {2021},
  eprint = {2111.04287},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2111.04287},
}
Figure