Faster SGD Using Sketched Conditioning

Alon Gonen, Shai Shalev-ShwartzarXiv 2015

Introduction

Stochastic Gradient Descent (SGD) remains the primary optimization tool for large-scale machine learning. However, its performance is highly sensitive to the geometry of the data. When features are highly correlated or vary significantly in scale—a condition known as "ill-conditioning"—SGD tends to oscillate or progress slowly toward the optimum.

Visualization of ill-conditioned data where features are highly correlated.

Traditional solutions like Newton's method use the Hessian matrix to "whiten" the data, but computing and inverting such matrices is prohibitively expensive ($O(n^3)$) for modern models with millions of parameters. While adaptive methods like AdaGrad use diagonal approximations, they often fail to account for the off-diagonal correlations that dominate real-world datasets.

Sketched Conditioned SGD (SCSGD)

To bridge the gap between simple diagonal methods and expensive second-order methods, the authors propose Sketched Conditioned SGD (SCSGD). The core idea is to transform the gradient update using a conditioning matrix $A^{-1}$ that approximates the square root of the data's correlation matrix $C = \frac{1}{m} \sum x_i x_i^\top$.

The Algorithm

The challenge lies in computing this conditioner efficiently. The authors utilize linear sketching to project the data onto a smaller random subspace of dimension $r$. This allows for the identification of the top $k$ eigenvectors and eigenvalues of the correlation matrix in $O(mnr)$ time.

The algorithm for computing the sketched conditioner.

The resulting conditioner $A$ is a hybrid: it uses a low-rank approximation for the dominant directions (where the most variance/correlation occurs) and a scaled identity matrix for the remaining "noise" directions. This structure ensures that applying the conditioner $A^{-1}$ to a gradient vector is computationally cheap ($O(nk)$), maintaining the efficiency of first-order methods.

Application to Deep Learning

In deep neural networks, the input to each layer changes as weights are updated. SCSGD handles this non-convex setting by maintaining a running average of the correlation matrix. To prevent training stalls, the sketched conditioner is updated periodically in a background thread, decoupling the preconditioning logic from the main optimization loop.

Key Results and Insights

The method was evaluated on MNIST and SVHN datasets using convolutional architectures.

  • Convergence Speed: SCSGD reached lower training and test errors significantly faster than vanilla SGD across various loss functions, including multiclass log-loss and classification error.
  • Spectral Decay: The effectiveness of sketching relies on the "fast spectral decay" property of real-world data, where a few principal components capture the majority of the information.
  • Efficiency: The sketched approximation provides nearly identical acceleration to the full-rank conditioner while being orders of magnitude faster to compute, making it practical for large-scale training.

Conclusion

SCSGD offers a mathematically grounded approach to preconditioning that captures essential data geometry without the cubic cost of second-order methods. By leveraging randomized sketching, it provides a practical and efficient middle ground for optimizing large-scale models on ill-conditioned data.

Summary updated

BibTeX
@misc{gonen2015faster,
  author = {Alon Gonen and Shai Shalev-Shwartz},
  title = {{Faster SGD Using Sketched Conditioning}},
  year = {2015},
  eprint = {1506.02649},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1506.02649},
}
Figure