Introduction
Distributed deep learning typically relies on data parallelism, where models are replicated across multiple GPUs and gradients are synchronized via an allreduce operation. However, as model sizes reach billions of parameters, this synchronization becomes a primary bottleneck. While gradient sparsification—communicating only the "top-$k$" most significant values—offers a potential solution, existing sparse allreduce algorithms suffer from a "scalability tax." Specifically, the "fill-in" problem causes sparse vectors to become dense during aggregation, and communication volume often scales linearly with the number of processes ($P$).
This paper introduces $Ok$-Topk, a novel sparse allreduce algorithm designed to achieve asymptotically optimal $O(k)$ communication volume, independent of the number of GPUs. By integrating load balancing with a threshold-reuse strategy, $Ok$-Topk enables significant speedups for large-scale model training.
The $Ok$-Topk Methodology
The $Ok$-Topk algorithm ensures that communication volume remains bounded (asymptotically $6k$), facilitating true scalability. The process is divided into two primary phases:
1. Split and Reduce
The gradient space is partitioned into distinct regions, with each worker responsible for reducing a specific region. To mitigate "hot-spots"—where certain workers might receive a disproportionate number of top-$k$ values—the algorithm employs a periodic space repartitioning strategy. Recognizing that gradient distributions evolve slowly, optimal boundaries are recalculated every 64 iterations and reused, maintaining efficiency without frequent overhead.
2. Balance and Allgatherv
Following local reduction, global top-$k$ values may remain unevenly distributed across nodes. $Ok$-Topk introduces a data-balancing step prior to the final "allgather" operation. This ensures that no single node is overwhelmed during the final synchronization phase, maintaining high throughput across the cluster.
Threshold Estimation: The "Secret Sauce"
A significant computational cost in sparse methods is the sorting required to identify top-$k$ values. $Ok$-Topk optimizes this by treating the gradient distribution as a slowly changing stochastic process. Instead of a full $O(n \\log n)$ sort every iteration, the algorithm calculates an accurate threshold periodically and reuses it. This reduces the complexity to a simple $O(n)$ comparison for most iterations.
Experimental Evaluation
The authors evaluated $Ok$-Topk on the Piz Daint supercomputer across three domains:
- Image Classification: VGG-16 on Cifar-10.
- Speech Recognition: LSTM on AN4.
- Natural Language Processing: BERT pre-training on Wikipedia.
Key Results and Insights
- Throughput Gains: For BERT on 256 GPUs, $Ok$-Topk achieved a 3.29x to 12.95x speedup compared to optimized dense allreduce and other state-of-the-art sparse methods.
- Asymptotic Scalability: Unlike competing algorithms where communication time doubles as the GPU count increases, $Ok$-Topk’s overhead remains nearly flat, proving its $O(k)$ optimality.
- Accuracy Preservation: The aggressive sparsification and threshold estimation did not compromise model convergence. For BERT, the final training loss was 2.43, compared to 2.33 for dense allreduce—a negligible difference given the massive performance gains.
Conclusion and Future Work
$Ok$-Topk demonstrates that sparse allreduce can be performed in $O(k)$ time by carefully managing aggregation and redistribution. While the algorithm has a slightly higher latency term due to its multi-step nature, it is highly effective for large models where bandwidth is the primary constraint. Future work includes integrating $Ok$-Topk with hybrid parallelism strategies to support the training of trillion-parameter models on commodity clusters.
Summary updated