Abstract
Modern deep neural networks often require distributed training with many workers due to their large size. As worker numbers increase, communication overheads become the main bottleneck in data-parallel minibatch stochastic gradient methods with per-iteration gradient synchronization. Local gradient methods like Local SGD reduce communication by only syncing after several local steps. Despite understanding their convergence in i.i.d. and heterogeneous settings and knowing the importance of batch sizes for efficiency and generalization, optimal local batch sizes are difficult to determine. We introduce adaptive batch size strategies for local gradient methods that increase batch sizes adaptively to reduce minibatch gradient variance. We provide convergence guarantees under homogeneous data conditions and support our claims with image classification experiments, demonstrating the effectiveness of our strategies in training and generalization.
Introduction
Distributed training is the backbone of modern AI, but it faces a persistent trade-off: frequent synchronization creates massive communication bottlenecks, while using massive batches from the start can hurt a model's ability to generalize. Standard Minibatch SGD requires workers to synchronize gradients after every step, whereas Local SGD allows workers to train locally for $H$ steps before synchronizing.
Choosing the right batch size for Local SGD is challenging. Small batches are excellent for generalization as they help find "flat" minima, but they underutilize hardware. Large batches are hardware-efficient but often lead to "sharp" minima and poor test performance. This paper proposes a way to navigate this "sweet spot" dynamically by adaptively growing batch sizes during training.
Methods
The authors extend the concept of Adaptive Sampling to the distributed, local-update setting. The core mechanism is a local norm test performed at specific intervals. The algorithm evaluates the variance of the stochastic gradients; if the variance is too high relative to the norm of the gradient (indicating that noise is drowning out the signal), the algorithm triggers a batch size increase.
To make this practical in frameworks like PyTorch, the authors use the variance of the local batch gradients across different workers as a proxy for individual sample variance. This allows the strategy to scale to large models without a significant computational penalty. Theoretically, the paper provides rigorous convergence guarantees for smooth convex, strongly convex, and non-convex objectives under homogeneous data conditions.
Results and Discussion
The adaptive strategy was validated across image classification (ResNet-50 on CIFAR-10, ResNet-101 on ImageNet) and language modeling (MicroLlama on C4).
As shown in the experimental results, the adaptive strategy consistently outperformed constant batch size baselines in both accuracy and efficiency. For example, on CIFAR-10 with 16 local steps ($H=16$), the adaptive approach reached 76.50% accuracy, notably higher than the 75.32% achieved by a constant batch size of 4096. For language modeling, the adaptive strategy achieved a lower validation loss (4.55) compared to its constant batch size counterpart (4.82) for $H=32$.
These results demonstrate that "growing" into a large batch is more effective than starting with one. By starting with smaller local batches, the model benefits from the noise that helps it escape sharp minima early in training. As it settles into a stable region, the batch size grows to finish the job efficiently, reducing gradient variance.
Limitations and Future Work
While promising, the authors note that current theoretical proofs assume homogeneous data, which may not hold in Federated Learning environments where data is non-i.i.d. Additionally, the method introduces a hyperparameter $\eta$ that controls the sensitivity of batch size growth. Future work may explore alternative tests, such as an "inner product test," to offer even more refined control over memory efficiency. For researchers looking to maximize GPU cluster performance without sacrificing quality, this adaptive approach offers a mathematically grounded path forward.
Summary updated