Adaptive Importance Sampling for Finite-Sum Optimization and Sampling with Decreasing Step-Sizes

Ayoub El Hanchi, David A. StephensNeurIPS 2020

Overview

Researchers from McGill University have introduced Avare, a new algorithm that adaptively adjusts importance sampling to speed up stochastic gradient descent (SGD) and Langevin dynamics (SGLD). By minimizing "dynamic regret" rather than just static performance, Avare significantly reduces gradient variance in finite-sum problems, leading to faster convergence on complex optimization and sampling tasks.

The Problem: Finite-Sum Optimization

In modern machine learning, we often deal with "finite-sum" problems—such as training a model on a dataset of $N$ examples where $N$ is massive. To make this tractable, we use stochastic methods like SGD, which estimate the total gradient by looking at a small random subset (a mini-batch) of the data.

The standard approach is uniform sampling, where every data point has an equal chance of being picked. However, not all data points are equally informative. Some gradients have larger norms and contribute more to the variance of our estimate. If we could sample these "important" points more frequently, we could reduce noise and converge faster.

The catch is that finding the perfect importance sampling distribution requires calculating the gradient for every single data point at every single step, defeating the purpose of using stochastic methods. Previous attempts to solve this used "bandit" frameworks to minimize static regret (comparing against the best fixed distribution). This paper argues that because the model is constantly moving, we should instead minimize dynamic regret (comparing against the best distribution at each specific step).

Methods: The Avare Algorithm

The authors propose Avare (Adaptive Variance Minimization), which relies on three key components:

  1. Surrogate Cost Functions: Instead of calculating fresh gradients for every point, Avare keeps a "memory" of the last seen gradient for each data point (similar to the SAGA algorithm). It uses these "stale" gradients to estimate which points are currently most important.
  2. The $\epsilon$-Restricted Simplex: To prevent the algorithm from becoming too greedy and ignoring certain data points entirely—which could lead to high variance if those points suddenly become important—Avare forces every point to have at least a tiny minimum probability ($\epsilon$) of being sampled.
  3. A Novel Mini-Batch Estimator: The paper introduces a new way to combine importance sampling with "sampling without replacement." Usually, importance sampling is done with replacement to keep the math simple, but sampling without replacement is more efficient in practice. Their new estimator is mathematically unbiased while capturing the benefits of both worlds.

Key Insights and Ideas

  • Dynamic Regret is the Right Metric: In optimization, the optimal sampling distribution changes as the model parameters $\theta$ evolve. By proving bounds on dynamic regret ($O(T^{2/3})$ for SGD and $O(T^{5/6})$ for SGLD), the authors show that Avare can keep up with the moving target of the true gradient landscape.
  • The Variance Ratio Predictor: Why does importance sampling help some datasets more than others? The authors argue that the standard metric (ratio of smoothness constants) is misleading. Instead, they show that the real predictor of success is the ratio of the variance of uniform sampling at the optimum to the optimal variance at the optimum. If your model can fit the data nearly perfectly, many gradients go to zero at the optimum, making importance sampling incredibly powerful.
  • Computational Efficiency: Avare is designed to be computationally lean. Using an "order statistic tree" data structure, they can update their sampling distribution in $O(\log N)$ or $O(\log^2 N)$ time, making it practical for large-scale problems.

Key Results

Avare achieves significantly lower dynamic regret and faster convergence on synthetic data compared to baseline methods.
  • Lower Regret: In synthetic tests, Avare achieved significantly lower dynamic regret than existing bandit-based samplers like Mabs or Vrb.
  • Faster Convergence: On datasets like MNIST and IJCNN1, Avare reached lower loss values much faster than uniform sampling.
  • Vanishing Relative Error: The "relative error" of Avare’s sampling distribution (how far it is from the theoretical ideal) decays toward zero much faster than competing methods.
  • Dataset Nuances: On CIFAR10, the gains were less noticeable. The authors used their "variance ratio" insight to explain this: for that specific model/dataset combination, the gradients at the optimum were more uniform, meaning there was less room for importance sampling to provide a boost.

Limitations and Future Work

  • Bounded Gradients: The theoretical proofs rely on the assumption that gradients are uniformly bounded. This is a common but strong assumption that does not always hold for deep neural networks.
  • Step-Size Constraints: The current theory focuses on decreasing step-sizes ($O(1/t)$). While the authors propose an extension for constant step-sizes in the appendix, more theoretical work is needed.
  • Large-Scale Deep Learning: While tested on CIFAR10, the method hasn't yet been applied to massive architectures like Transformers or very deep ResNets, where the memory cost of storing $N$ gradient norms might become a bottleneck.

Summary updated

BibTeX
@inproceedings{hanchi2020adaptive,
  author = {Ayoub El Hanchi and David A. Stephens},
  title = {{Adaptive Importance Sampling for Finite-Sum Optimization and Sampling with Decreasing Step-Sizes}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2020},
}
Figure