A Resizable Mini-batch Gradient Descent based on a Randomized Weighted Majority

Seong Jin Cho, Sunghun Kang, Chang D. YooarXiv 2017

Abstract

Determining the appropriate batch size for mini-batch gradient descent is always time consuming as it often relies on grid search. This paper considers a resizable mini-batch gradient descent (RMGD) algorithm based on a multi-armed bandit for achieving best performance in grid search by selecting an appropriate batch size at each epoch with a probability defined as a function of its previous success/failure. This probability encourages exploration of different batch size and then later exploitation of batch size with history of success. At each epoch, the RMGD samples a batch size from its probability distribution, then uses the selected batch size for mini-batch gradient descent. After obtaining the validation loss at each epoch, the probability distribution is updated to incorporate the effectiveness of the sampled batch size. The RMGD essentially assists the learning process to explore the possible domain of the batch size and exploit successful batch size. Experimental results show that the RMGD achieves performance better than the best performing single batch size. Furthermore, it, obviously, attains this performance in a shorter amount of time than grid search. It is surprising that the RMGD achieves better performance than grid search.

Introduction

In deep learning, the choice of mini-batch size is a critical hyperparameter that balances a difficult trade-off. Small batches introduce noise that can help the model escape local minima and generalize better, but they are computationally inefficient. Large batches are faster to compute on modern hardware but often lead to "sharp minima" and poorer generalization.

Traditionally, researchers find the "optimal" batch size using grid search—running the entire training process multiple times with different sizes (e.g., 32, 64, 128, 256) and picking the winner. This is incredibly time-consuming and computationally expensive. Furthermore, most existing "adaptive" batching algorithms are designed for convex optimization and fail when applied to the non-convex landscapes of deep neural networks.

The RMGD Algorithm

The authors propose RMGD (Resizable Mini-batch Gradient Descent), which frames batch size selection as a Multi-Armed Bandit (MAB) problem.

In this framework, a predefined set of possible batch sizes (e.g., {16, 32, 64, 128, 256, 512}) acts as the "arms" of the bandit. At the start of each epoch, the algorithm samples a batch size from a probability distribution. After training for one epoch with the chosen size, the algorithm checks the validation loss. If the loss decreased, it is a "success"; if it stayed the same or increased, it is a "failure." The probability distribution is updated using a Normalized Exponentiated Gradient rule, where sizes that lead to success get a higher probability of being picked in the next epoch.

Experimental Results

The researchers evaluated RMGD on two standard computer vision benchmarks: MNIST (using a simple CNN) and CIFAR10 (using the 'All-CNN-C' architecture).

Exploration vs. Exploitation

This approach creates a natural "exploration-exploitation" loop. Early in training, the model tries various sizes (exploration); as training progresses, it converges on the sizes that consistently drive the validation loss down (exploitation).

Key Insights

  • Dynamic is Better than Static: RMGD often achieves higher accuracy than the best single fixed batch size found via grid search. This suggests that the "optimal" batch size might actually change during the training process. On MNIST with Adam, RMGD achieved 99.342% accuracy, outperforming the best fixed batch size (99.328%).
  • Massive Efficiency Gains: RMGD essentially performs a "live" grid search. To find the best batch size via grid search on MNIST, a researcher would spend roughly 2,949 seconds. RMGD achieved better results in just 333 seconds—nearly a 9x speedup in total search/training time.
  • Robustness: The algorithm works effectively across different optimizers, including Adam, Adagrad, and Momentum SGD.

Conclusion

RMGD provides a theoretically grounded method to eliminate the overhead of batch size tuning. By treating batching as a bandit problem, the model learns to optimize its own training parameters on the fly, leading to both faster convergence and superior generalization compared to traditional static methods.

Summary updated

Abstract

Determining the appropriate batch size for mini-batch gradient descent is always time consuming as it often relies on grid search. This paper considers a resizable mini-batch gradient descent (RMGD) algorithm based on a multi-armed bandit for achieving best performance in grid search by selecting an appropriate batch size at each epoch with a probability defined as a function of its previous success/failure. This probability encourages exploration of different batch size and then later exploitation of batch size with history of success. At each epoch, the RMGD samples a batch size from its probability distribution, then uses the selected batch size for mini-batch gradient descent. After obtaining the validation loss at each epoch, the probability distribution is updated to incorporate the effectiveness of the sampled batch size. The RMGD essentially assists the learning process to explore the possible domain of the batch size and exploit successful batch size. Experimental results show that the RMGD achieves performance better than the best performing single batch size. Furthermore, it, obviously, attains this performance in a shorter amount of time than grid search. It is surprising that the RMGD achieves better performance than grid search.
BibTeX
@misc{cho2017resizable,
  author = {Seong Jin Cho and Sunghun Kang and Chang D. Yoo},
  title = {{A Resizable Mini-batch Gradient Descent based on a Randomized Weighted Majority}},
  year = {2017},
  eprint = {1711.06424},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1711.06424},
}
Figure