Abstract
In deep learning, minibatching is traditionally viewed as a necessity for first-order methods like Stochastic Gradient Descent (SGD) to introduce noise and improve generalization. Second-order optimizers (SOOs), which utilize Hessian information, are often assumed to require large batches for stable curvature estimation. This study challenges that assumption, demonstrating through a 2-factor Analysis of Variance (ANOVA) that SOOs like L-BFGS and Fletcher-Reeves (FR) significantly benefit from minibatching. Experiments on CIFAR-10 with ResNet18 reveal that SOOs achieve better generalization and lower performance variance than SGD at small batch sizes, suggesting they can reduce hyperparameter tuning effort.
Introduction
Training deep neural networks is a complex optimization task. While first-order methods like SGD are the industry standard, second-order methods (SOOs) theoretically offer more efficient convergence by accounting for the loss landscape's curvature. However, SOOs are frequently dismissed due to perceived memory overhead and the belief that they require large, stable batches. This paper investigates whether the "stochasticity" of small batches aids SOOs in the same way it helps SGD generalize.
Methodology
The researchers employed a rigorous statistical framework, using a 2-factor ANOVA to analyze the impact of Optimizer Type (SGD, L-BFGS, FR) and Batch Size (ranging from 100 to 50,000) on model performance. The experiments utilized the ResNet18 architecture on the CIFAR-10 dataset. This approach allowed for the measurement of not just individual effects but also the interaction between optimizer choice and batch size.
Key Results and Discussion
The Full-Batch Trap and Generalization
A primary finding is that full-batch training consistently leads to the poorest performance across all tested optimizers. This confirms that the noise introduced by minibatching acts as a universal regularizer. As shown in Figure 1, there is a clear negative correlation between batch size and peak accuracy for all three methods, with correlation coefficients (R) ranging from -0.49 to -0.83.
Reliability and Variance at Small Batches
Contrary to the intuition that SOOs are "finicky," L-BFGS demonstrated significantly lower variance in peak accuracy compared to SGD at a batch size of 100. While SGD can reach high peaks, its performance is more erratic. L-BFGS provides a more consistent and reliable result, which is crucial for practical applications where hyperparameter tuning resources are limited.
Amortized Efficiency
While a single iteration of a second-order method like L-BFGS may be computationally more expensive (approximately 1.7x to 5x slower than SGD), its robustness to hyperparameter settings offers "amortized" time savings. The reduced need for extensive grid searches for learning rates and other parameters can make SOOs faster in a complete development cycle.
Conclusion
This research highlights that batch size is not merely a hardware constraint but a critical hyperparameter for second-order optimization. By embracing minibatching, SOOs can achieve superior generalization and stability. Future work should explore these effects on larger architectures and datasets to determine if these benefits scale to foundation models.
This summary is based on research presented at the ICML 2023 SODS Workshop.
Summary updated