DBS: Dynamic Batch Size For Distributed Deep Neural Network Training

Qing Ye, Yuhao Zhou, Mingjia Shi, Yanan Sun, Jiancheng LvarXiv 2020

Abstract

Distributed deep learning often suffers from "stragglers"—slower workers that force faster ones to sit idle during synchronization. This paper introduces Dynamic Batch Size (DBS), a strategy that monitors worker performance in real-time and rebalances the workload by adjusting individual batch sizes, effectively eliminating idle time and speeding up training without sacrificing model accuracy.

Introduction

In the world of distributed training, Synchronous Stochastic Gradient Descent (S-SGD) is the gold standard because it is stable and mathematically sound. However, it has a major "weakest link" problem. In a typical setup, every worker (GPU/CPU) gets an equal slice of the data and a fixed batch size. Because the system must wait for every worker to finish its computation before updating the model, a single slow worker—due to hardware variations, network jitter, or background tasks—stalls the entire cluster.

Existing solutions usually fall into two camps: Asynchronous SGD, which introduces "stale gradients" that can hurt convergence, or Model Averaging, which can be difficult to tune. The authors identify that the root cause isn't the synchronization itself, but the load imbalance. DBS addresses this by changing how much work is assigned to each machine rather than changing the synchronization protocol.

Methodology

The proposed DBS algorithm functions as a closed-loop feedback system that operates in three main phases:

  1. Performance Evaluation: At the end of each training epoch, the system calculates a performance score ($p_i$) for each worker, defined as the ratio of the data it processed to the time it took. This allows the system to detect which workers are "strong" and which are "weak."
  2. Dynamic Batch Size Adjustment: Using these scores, the algorithm calculates a new batch size for the next epoch. If a worker is faster, it is assigned a larger batch size so that all workers are projected to finish their work at exactly the same time.
  3. Dynamic Dataset Partitioning: Since the total global batch size must remain constant to ensure stable training, the authors implement a "rounding twice" method. This ensures the total number of samples processed across the cluster stays the same, maintaining the statistical properties of the training process.
Comparison of fixed vs. dynamic batch size scheduling. (a) Fixed batch size leads to idle time for fast workers. (b) DBS rebalances workload to eliminate idle time.

Crucially, the authors provide a rigorous mathematical proof showing that even though batch sizes are changing, the algorithm still converges to the global minimum just like standard S-SGD.

Experimental Setup

The researchers evaluated their approach using the CIFAR-10 benchmark on ResNet101 (approximately 40 million parameters) to simulate a realistic, large-scale training scenario. Experiments were conducted on a Tesla V100 server where multiple processes simulated a distributed cluster of 4, 8, and 16 workers.

Key Results

  • Elimination of Idle Time: The "waiting time" ($t_w$) seen in standard S-SGD was almost entirely eliminated as worker training times converged.
  • Significant Speedups: On a 4-worker cluster, DBS reduced total training time by approximately 12%.
  • Robustness to Noise: In experiments where "disturbances" (irrelevant background tasks) were intentionally added to specific workers, standard S-SGD slowed down drastically. DBS quickly detected the slowdown, offloaded work from the affected node, and maintained high throughput.
Training time analysis over 50 epochs. The green shaded area represents time saved by DBS compared to standard S-SGD, as worker training times converge.
  • Accuracy Parity: As predicted by their theory, the final model accuracy for DBS was identical to standard S-SGD, proving that varying the batch size per worker does not harm the learning process.

Discussion and Future Work

DBS offers a "zero-cost" optimization by using information already available (time and data count) to optimize the schedule. However, the authors noted diminishing returns as cluster size grows because communication overhead starts to dominate the total training time.

Future iterations might benefit from "mini-epoch" or iteration-level adjustments to react more quickly to sudden performance drops in very large datasets. Additionally, combining DBS with gradient compression techniques could address network congestion in extremely large-scale distributed systems.

Summary updated

BibTeX
@misc{ye2020dbs,
  author = {Qing Ye and Yuhao Zhou and Mingjia Shi and Yanan Sun and Jiancheng Lv},
  title = {{DBS: Dynamic Batch Size For Distributed Deep Neural Network Training}},
  year = {2020},
  eprint = {2007.11831},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2007.11831},
}
Figure