Combining resampling and reweighting for faithful stochastic optimization

Jing An, Lexing YingarXiv 2021

Abstract

Many machine learning and data science tasks require solving non-convex optimization problems. When the loss function is a sum of multiple terms, a popular method is the stochastic gradient descent. Viewed as a process for sampling the loss function landscape, the stochastic gradient descent is known to prefer flat minima. Though this is desired for certain optimization problems such as in deep learning, it causes issues when the goal is to find the global minimum, especially if the global minimum resides in a sharp valley. Illustrated with a simple motivating example, we show that the fundamental reason is that the difference in the Lipschitz constants of multiple terms in the loss function causes stochastic gradient descent to experience different variances at different minima. In order to mitigate this effect and perform faithful optimization, we propose a combined resampling-reweighting scheme to balance the variance at local minima and extend to general loss functions. We explain from the numerical stability perspective how the proposed scheme is more likely to select the true global minimum, and the local convergence analysis perspective how it converges to a minimum faster when compared with the vanilla stochastic gradient descent. Experiments from robust statistics and computational chemistry are provided to demonstrate the theoretical findings.

Introduction

In non-convex optimization, the geometry of the loss landscape significantly influences the behavior of stochastic optimizers. A "flat" minimum occupies a wide, gentle region, whereas a "sharp" minimum is located in a narrow, steep crevice. While the preference of Stochastic Gradient Descent (SGD) for flat minima is often touted as a "feature" for generalization in deep learning, it becomes a "bug" in domains like robust statistics or computational chemistry. In these fields, the global minimum—the true solution—often resides in a sharp valley.

The core issue lies in the relationship between gradient noise and the local landscape. In vanilla SGD, the variance of the gradient estimates is tied to the Lipschitz constants of the individual loss terms. Sharp minima, characterized by high local gradients, induce massive "noise kicks" that eject the optimizer from the valley. Consequently, SGD exhibits a selection bias toward flat minima simply because it lacks the stability to remain in sharp ones.

The Resampling-Reweighting (RR) Scheme

To overcome this bias, we introduce a Resampling-Reweighting (RR) strategy designed to "level the playing field" of the loss landscape by balancing gradient variance. The scheme consists of two main components:

  1. Reweighting: Each individual loss term $l_i(\theta)$ is scaled by a weight $w_i \propto 1/\|\nabla l_i(\theta)\|_2$.
  2. Resampling: To maintain an unbiased expected gradient, terms are sampled with a probability $p_i \propto \|\nabla l_i(\theta)\|_2$.

By combining these steps, the expected gradient remains identical to that of vanilla SGD, but the variance is redistributed. This "variance-balancing" effect allows the optimizer to behave more deterministically in high-gradient (sharp) regions while remaining exploratory in low-gradient (flat) regions. Using Stochastic Differential Equations (SDEs), we prove that the RR scheme possesses a smaller covariance trace than SGD, leading to enhanced stability and faster local convergence.

Experimental Results

The RR scheme was evaluated across several benchmarks, including synthetic 1D/High-D landscapes, robust classification using the Welsch loss, and computational chemistry potentials like the Müller-Brown potential.

Faithful Selection in 1D Landscapes

A primary result is the "faithful" selection of the global minimum. In a 1D motivating example featuring a sharp global minimum and a flat local minimum, vanilla SGD consistently failed to stay in the sharp valley.

Comparison of the loss landscape (1) with the optimization trajectories of SGD (2) and RR (3). SGD jumps from the sharp global minimum to a flat local minimum, while RR remains stable in the global minimum.

As illustrated in the figure above, SGD (middle panel) initially enters the sharp minimum but is eventually kicked out by high variance, settling in the flat local minimum around $\theta = -1$. In contrast, the RR scheme (right panel) stays in the sharp global minimum 100% of the time, demonstrating its ability to perform faithful optimization.

Robustness and Convergence

In robust regression tests, RR demonstrated superior stability, remaining convergent at learning rates where vanilla SGD completely diverged. Furthermore, even when both methods identified the same minimum, RR reached it significantly faster and with fewer oscillations. In chemistry benchmarks like the Müller-Brown potential, RR successfully navigated complex energy surfaces to find global minima that frequently trapped vanilla SGD.

Conclusion and Future Work

The RR scheme provides a theoretical and practical framework for "faithful" optimization, ensuring that the optimizer's path is determined by the objective function rather than incidental variance. While the current implementation requires $O(n)$ gradient calculations for sampling, techniques like rejection sampling or infrequent weight updates offer promising paths for scaling. Future work will focus on these engineering challenges and extending the SDE analysis beyond Gaussian noise assumptions.

Summary updated

BibTeX
@misc{an2021combining,
  author = {Jing An and Lexing Ying},
  title = {{Combining resampling and reweighting for faithful stochastic optimization}},
  year = {2021},
  eprint = {2105.14694},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2105.14694},
}
Figure