Abstract: Many stochastic optimization algorithms work by estimating the gradient of the cost function on the fly by sampling datapoints uniformly at random from a training set. However, the estimator might have a large variance, which inadvertently slows down the convergence rate of the algorithms. One way to reduce this variance is to sample the datapoints from a carefully selected non-uniform distribution. In this work, we propose a novel non-uniform sampling approach that uses the multi-armed bandit framework. Theoretically, we show that our algorithm asymptotically approximates the optimal variance within a factor of 3. Empirically, we show that using this datapoint-selection technique results in a significant reduction in the convergence time and variance of several stochastic optimization algorithms such as SGD, SVRG and SAGA. This approach for sampling datapoints is general, and can be used in conjunction with any algorithm that uses an unbiased gradient estimation.
Introduction
Most modern machine learning models are trained using Stochastic Gradient Descent (SGD). In each step, SGD picks a small batch of data points at random—usually uniformly—to estimate the gradient. However, uniform sampling is often inefficient. Datasets frequently contain "informative" points with large gradients and "redundant" points with negligible ones. Sampling a high-gradient point by chance introduces high variance, making the optimization process noisy and slow.
While "Importance Sampling" addresses this by picking points with higher gradients more frequently, it typically requires prior knowledge of every data point's properties (like Lipschitz constants). Such pre-processing is often computationally prohibitive for large-scale datasets. This paper introduces Multi-Armed Bandit Sampling (MABS), an adaptive method that learns the optimal non-uniform sampling distribution during training without prior knowledge.
The MABS Methodology
The authors recast the sampling problem as an Adversarial Multi-Armed Bandit problem. In this framework, each data point in the training set is treated as an "arm." MABS employs a strategy based on the EXP3 algorithm, maintaining a weight for every data point.
When a data point is sampled and its gradient is calculated, the magnitude of that gradient serves as feedback. A large gradient increases the point's weight, making it more likely to be selected in subsequent iterations. To prevent the algorithm from prematurely converging on a small subset of points, the learned distribution is mixed with a uniform distribution (controlled by a parameter $\eta$), ensuring sufficient exploration. Crucially, by utilizing a tree-based data structure for weight management, the overhead of selection and updates is kept to $O(\log n)$, which is negligible relative to the model training computations.
Experimental Evaluation
The effectiveness of MABS was evaluated on several benchmarks, including synthetic ridge regression tasks and real-world binary classification datasets like ijcnn1 and w8a (approx. 50,000 points each).
Key Insights and Results
A core theoretical contribution is the realization that the formula for gradient variance mirrors a cost function in a bandit problem. This allows the authors to prove that MABS asymptotically approaches the optimal sampling distribution within a factor of 3.
Empirically, MABS provides several advantages:
- Faster Convergence: On the
w8adataset, MABS reached lower loss levels significantly faster than uniform sampling across multiple algorithms, including SGD, SAGA, and Prox-SVRG. - Enhanced Stability: MABS significantly improves robustness to hyperparameter choices. In stress tests on the
w8adataset, standard SGD and Importance Sampling diverged when the learning rate ($\gamma$) exceeded 0.5. In contrast, SGD with MABS remained stable and converged even with a learning rate as high as 5.0. - Minimal Overhead: In high-dimensional tests ($d=4000$), MABS added only about 10% to total clock time compared to uniform SGD, whereas standard Importance Sampling was 40% slower due to upfront calculation requirements.
Conclusion
MABS is not a new optimizer but a versatile sampling wrapper. It can be integrated into various algorithms to improve convergence and stability. While the current work provides strong theoretical bounds and empirical evidence, future research could explore tightening these bounds or investigating MABS's performance in non-convex landscapes, such as deep neural networks, and with streaming data.
Summary updated