[Paper Review] Shampoo: Preconditioned Stochastic Tensor Optimization
Shampoo is a novel preconditioned stochastic optimization algorithm for tensor-structured parameters in deep learning, maintaining separate preconditioners per tensor dimension to enable efficient second-order optimization. It achieves significantly faster convergence than SGD, Adam, and AdaGrad in practice, with per-step runtime comparable to simpler optimizers due to structured matrix operations and efficient implementation in TensorFlow.
Preconditioned gradient methods are among the most general and powerful tools in optimization. However, preconditioning requires storing and manipulating prohibitively large matrices. We describe and analyze a new structure-aware preconditioning algorithm, called Shampoo, for stochastic optimization over tensor spaces. Shampoo maintains a set of preconditioning matrices, each of which operates on a single dimension, contracting over the remaining dimensions. We establish convergence guarantees in the stochastic convex setting, the proof of which builds upon matrix trace inequalities. Our experiments with state-of-the-art deep learning models show that Shampoo is capable of converging considerably faster than commonly used optimizers. Although it involves a more complex update rule, Shampoo's runtime per step is comparable to that of simple gradient methods such as SGD, AdaGrad, and Adam.
Motivation & Objective
- To address the scalability limitations of full-matrix preconditioning in high-dimensional machine learning problems.
- To develop a practical preconditioning method that exploits tensor structure in model parameters, such as in matrices and 4D convolutional filters.
- To enable efficient second-order optimization in deep learning by maintaining dimension-specific preconditioners instead of full Hessian approximations.
- To establish theoretical convergence guarantees in the stochastic convex optimization setting using matrix trace inequalities.
- To demonstrate empirical superiority in convergence speed over standard optimizers like Adam and SGD, despite a more complex update rule.
Proposed method
- Shampoo maintains a set of preconditioner matrices, one per tensor dimension, which are updated online using the second-order statistics of accumulated gradients.
- The algorithm applies a symmetric matrix square root operation to each preconditioner matrix, using the geometric mean of left and right preconditioners to scale the gradient.
- For a matrix parameter $ W \in \mathbb{R}^{m \times n} $, the update rule is $ W_{t+1} = W_t - \eta L_t^{-1/4} G_t R_t^{-1/4} $, where $ G_t $ is the gradient and $ L_t, R_t $ are preconditioners.
- The preconditioners $ L_t $ and $ R_t $ are updated as $ L_t = L_{t-1} + G_t G_t^\top $ and $ R_t = R_{t-1} + G_t^\top G_t $, tracking the outer product of gradients.
- The method generalizes to higher-order tensors by applying the same principle across all tensor modes, preserving the tensor structure throughout optimization.
- Shampoo is implemented efficiently in TensorFlow using standard tensor operations, enabling minimal code changes and compatibility with existing deep learning frameworks.
Experimental results
Research questions
- RQ1Can a preconditioned optimization method be designed to scale efficiently to high-dimensional, structured parameter spaces such as tensors in deep learning?
- RQ2Does a preconditioning strategy that maintains separate matrices per tensor dimension achieve faster convergence than first-order methods like Adam and SGD?
- RQ3Can such a method maintain low per-step computational cost despite using second-order information?
- RQ4What theoretical convergence guarantees can be established for this structured preconditioning approach in the stochastic convex setting?
- RQ5How does the algorithm perform in practice on large-scale deep learning models across different architectures and datasets?
Key findings
- Shampoo converges significantly faster than Adam, SGD, and AdaGrad on CIFAR-10 and CIFAR-100 using ResNet and Inception architectures, achieving lower training loss in fewer epochs.
- On the LM1B language modeling benchmark, Shampoo achieved lower test perplexity than Adam and AdaGrad, with faster convergence in terms of steps.
- Despite a more complex update rule involving matrix inverse square roots, Shampoo's runtime per step was comparable to SGD and Adam, with only a small performance penalty on a Tesla K40 GPU.
- In some cases, such as ResNet-55 on CIFAR-100, Shampoo was even faster per step than Adam, with 1.249 steps per second compared to Adam’s 1.203.
- The use of delayed preconditioner updates and momentum improved amortized runtime without sacrificing accuracy, enabling practical deployment.
- The algorithm achieved state-of-the-art convergence speed in all tested models, demonstrating the effectiveness of structure-aware preconditioning in deep learning optimization.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.