TL;DR
This paper offers a novel empirical perspective on how Stochastic Gradient Descent (SGD) navigates the complex loss landscapes of deep neural networks. By visualizing the training path, the authors reveal that SGD "bounces" along valley-like structures at a height above the true valley floor, a mechanism crucial for generalization by allowing it to bypass barriers and find flatter, more generalizable minima.
What Problem Does This Paper Address?
Deep neural networks (DNNs), despite being trained with algorithms like SGD on highly over-parameterized models, manage to achieve both low training loss and good generalization. This is counterintuitive, especially given their capacity to perfectly memorize random data. While previous work has suggested that flatter minima generalize better and that SGD finds them, the precise mechanisms by which SGD achieves this, particularly the distinct roles of hyperparameters like learning rate and batch size, remain somewhat obscure. This paper aims to shed light on these dynamics by empirically investigating SGD's trajectory through the loss landscape.
Methods
The core methodology involves visualizing the DNN loss surface along SGD's training trajectory. The authors achieve this by:
- Loss Interpolation: Between parameters from consecutive training iterations ($\theta_t$ and $\theta_{t+1}$), they interpolate the loss surface using convex combinations ($\theta = (1-\alpha)\theta_t + \alpha\theta_{t+1}$). This allows them to examine slices of the loss landscape that SGD traverses.
- Metric Tracking: Alongside the loss, they track:
- The cosine of the angle between consecutive gradients ($\cos(\mathbf{g}_{t-1}, \mathbf{g}_t)$) to understand the direction of movement.
- The Euclidean distance of the current parameters from the initialization ($\|\theta_t - \theta_0\|_2$) to gauge exploration.
- "Valley Floor" Analysis: They identify a "valley floor" as the minimum loss found during the interpolation between two consecutive parameter updates. The "height" of SGD's trajectory is then measured relative to this valley floor.
- Barrier Crossing Definition: A barrier is considered "crossed" if an interpolated point between two parameter updates has a higher loss than both the preceding and succeeding points.
Datasets
The paper uses the following datasets:
- MNIST
- CIFAR-10
- A subset of the tiny ImageNet dataset
Key Insights and Ideas
- SGD as a "Valley Bouncer": Instead of directly descending into valleys, SGD appears to "bounce" off the valley walls at a height above the true valley floor. This "bouncing at a height" mechanism is a key finding.
- Distinct Roles of Learning Rate and Batch Size:
- Learning Rate: Controls the height of the bounce above the valley floor. A larger learning rate maintains a higher trajectory, allowing SGD to "jump over" barriers on the valley floor.
- Batch Size: Controls the stochasticity (noise) of the gradient. Smaller batch sizes inject more noise, facilitating exploration and allowing SGD to move further away from its initialization.
- Barriers Exist, But SGD Avoids Them: The valley floor is not smooth and contains barriers. However, SGD, by maintaining a height above the floor, largely avoids getting stuck on these barriers. This is crucial for generalization.
- Exploration for Generalization: The ability to bypass barriers on the valley floor allows SGD to quickly move away from the initial, potentially suboptimal, region and find flatter minima, which are empirically linked to better generalization.
- Isotropic Noise is Detrimental: Adding artificial isotropic noise to full-batch gradients actually hinders optimization and generalization, suggesting that the structure of mini-batch noise is important, not just its presence.
Key Results
- Qualitative Observations: The paper presents extensive qualitative observations across various datasets and architectures (MLP, VGG-11, Resnet-56). The core findings about the "bouncing" behavior, distinct roles of LR and batch size, and barrier avoidance are consistently observed.
- Height Above Valley Floor: Table 2 and Table 3 show that as training progresses, the average height of SGD above the valley floor tends to decrease. Smaller learning rates also lead to a lower height, which is linked to poorer generalization.
- Barrier Crossing: Table 1 and Figure 9 indicate that SGD rarely crosses significant barriers during training. Even when barriers are encountered, their height is often not significant.
- Parameter Distance: SGD with smaller batch sizes shows a larger parameter distance from initialization compared to Gradient Descent (GD), indicating greater exploration.
- GD vs. SGD: GD, when compared to SGD, shows a more direct descent along the valley floor, which decreases smoothly. Its parameter distance from initialization is also smaller.
Limitations and Future Work
- Empirical Focus: The paper relies heavily on empirical observations and visualizations rather than formal theoretical proofs. While the findings are consistent across experiments, a deeper theoretical understanding of the observed dynamics would be valuable.
- Generalization of Findings: The authors acknowledge that their conclusions might differ for other activation functions (beyond ReLU) or batch normalization choices. They suggest that similar analyses can be performed for other settings.
- Learning Rate Schedules: While they explore learning rate schedules (CLR, trapezoid, step-wise annealing) and find that increasing learning rate during training can be beneficial, they leave an extensive study of optimal learning rate schedule design as future work.
- Role of Gradient Covariance: The paper touches upon the importance of the structure of mini-batch noise (gradient covariance) and its relationship with the Hessian, suggesting it aligns with sharper directions and helps find wider minima. However, a more in-depth theoretical exploration of this relationship is hinted at but not fully developed.
Summary updated