Abstract
Stochastic Gradient Descent (SGD) is a cornerstone optimization method for large-scale machine learning tasks, including Support Vector Machines and Deep Neural Networks. To facilitate parallelization and improve efficiency, minibatch training is standard practice. However, the conventional approach of uniform sampling often results in high gradient variance, which slows convergence. This paper introduces a stratified sampling strategy that partitions the dataset into clusters with low within-cluster variance. By sampling from these strata, the proposed algorithm, SGD-ss, significantly reduces variance and accelerates the convergence rate. Experimental results on benchmark datasets validate the effectiveness of the method.
Introduction
Stochastic Gradient Descent (SGD) is the backbone of modern machine learning, yet it faces a fundamental challenge: noise. In standard minibatch SGD, a random subset of data is selected to estimate the overall gradient. Because these subsets are chosen uniformly at random, they are often unrepresentative of the full dataset—occasionally over-representing outliers or redundant data points by chance.
This randomness introduces high variance into gradient estimates. High variance causes the optimization path to fluctuate excessively, necessitating smaller learning rates and leading to slower convergence. While increasing minibatch size can mitigate this, standard approaches fail to exploit the underlying structure of the data to make minibatches more informative.
The SGD-ss Algorithm
The authors propose stratified sampling to construct more representative minibatches. The core objective is to divide the dataset into $k$ "strata" (clusters) such that data points within each cluster are similar, thereby reducing the variance of the samples drawn from them.
Feature Space as a Proxy
Ideally, one would cluster data points based on their current gradients. However, calculating gradients for every point at every iteration to re-cluster them is computationally prohibitive. To solve this, the authors observe that for many loss functions, the gradient is Lipschitz continuous with respect to the input features. This implies that if two data points are close in feature space, their gradients are likely to be similar. This allows for a one-time preprocessing step using a standard clustering algorithm (like $k$-means) based on features and class labels.
Optimal Allocation
Rather than sampling an equal number of points from every cluster, the authors derive an optimal allocation strategy. They calculate the specific number of samples to take from each cluster to minimize the total variance of the resulting gradient estimate. At each training step, the algorithm draws these calculated samples from the pre-defined clusters to form the minibatch.
Experimental Evaluation
The method was evaluated using L2-regularized multiclass logistic regression on five benchmark datasets from the LIBSVM repository:
- covtype.binary: Forest cover type (523k samples, 54 features).
- letter: Letter recognition (15k samples, 16 features).
- mnist: Handwritten digits (60k samples, 780 features).
- pendigits: Pen-based digit recognition (7.5k samples, 16 features).
- usps: Postal service digit recognition (7.3k samples, 256 features).
Key Insights and Results
1. Faster Convergence and Stability
Across all tested datasets, SGD-ss reached lower primal objective values in fewer epochs than standard uniform SGD. Furthermore, the test error rates for SGD-ss were significantly more stable, whereas uniform SGD exhibited notable fluctuations throughout the training process.
2. Empirical Variance Reduction
Measurements confirmed that the variance of the gradient estimators in SGD-ss was often an order of magnitude lower than in uniform sampling. By ensuring every minibatch is a "miniature version" of the entire dataset, the optimizer avoids being led astray by unrepresentative samples.
3. Theoretical Guarantees
The authors provide theoretical backing for the method, proving that for strongly convex and smooth functions, SGD-ss achieves an $O(1/T)$ convergence rate. They also demonstrate that under specific conditions where variance is reduced to zero, the algorithm can achieve linear convergence.
Limitations and Future Directions
While SGD-ss offers clear benefits, it introduces a preprocessing overhead. The time required for $k$-means clustering on massive datasets must be weighed against the speedup gained during optimization. Additionally, while the feature-space proxy works well for convex problems like logistic regression, its effectiveness in Deep Neural Networks—where the relationship between features and gradients evolves during training—remains an area for further exploration. Finally, the success of the method is inherently tied to the quality of the initial clustering; data that does not cluster well in feature space may see diminished returns in variance reduction.
Summary updated