Momentum Stiefel Optimizer, with Applications to Suitably-Orthogonal Attention, and Optimal Transport

Lingkai Kong, Yuqing Wang, Molei Tao

Introduction

Researchers have developed a new momentum-based optimizer specifically designed for the Stiefel manifold (matrices with orthogonal columns). By combining a continuous-time variational framework with a clever "structure-preserving" discretization, they created an algorithm that is both mathematically rigorous and computationally efficient, outperforming existing methods in Vision Transformers and Optimal Transport tasks.

Many machine learning models benefit from orthogonality constraints—the requirement that certain weight matrices satisfy $X^\top X = I$. This is common in Recurrent Neural Networks (to prevent exploding/vanishing gradients), Vision Transformers, and dimensionality reduction.

The set of all such matrices forms a non-Euclidean space called the Stiefel manifold. Optimizing on this manifold is notoriously difficult. Standard Euclidean optimizers (like Adam or SGD) will "drift" off the manifold, breaking the orthogonality. Existing Riemannian optimizers try to fix this using "retractions" (mapping points back to the manifold) and "parallel transport" (moving momentum vectors across the curved surface). However, these operations are often computationally expensive or fail to preserve the "structure" of momentum accurately, leading to slower convergence or lower accuracy.

Methods

The authors propose a novel strategy that bridges the gap between continuous physics and discrete algorithms:

  1. Variational Formulation: They start by defining a Lagrangian for a damped mechanical system on the Stiefel manifold. This gives them a set of Ordinary Differential Equations (ODEs) that naturally describe how a point with "mass" (momentum) should move while staying perfectly on the manifold.
  2. Operator Splitting: To turn these continuous ODEs into a computer algorithm, they use a technique called operator splitting. They break the complex system into three simpler sub-problems ($\phi_1, \phi_2, \phi_3$) that can each be solved (or approximated) exactly.
  3. Structure-Preserving Discretization: The resulting discrete steps ensure that the position variable stays on the Stiefel manifold and the momentum variable stays in the correct "tangent space" without needing expensive extra projections for the momentum.
  4. Stiefel-Adam: They extend this logic to create a Stiefel-compatible version of the Adam optimizer, allowing for adaptive learning rates on curved manifolds.

Crucially, their method has a computational complexity of $O(nm^2)$, which is the same as simpler methods that lack momentum, making it very efficient for deep learning.

Datasets

The authors evaluated their optimizer across several distinct domains:

  • Optimal Transport: Used MNIST and a corpus of Shakespeare plays to test Projection Robust Wasserstein Distance (PRW).
  • Computer Vision: Trained Vision Transformers (ViT) from scratch on CIFAR-10 and CIFAR-100.
  • Synthetic Benchmarks: Used randomly generated matrices for leading eigenvalue problems to test convergence speed and manifold "perseverance" (how well the algorithm stays on the manifold).

Key Insights and Ideas

  • "Free" Momentum: Unlike previous methods that required a separate, costly operation to "transport" momentum vectors as the model updates, this optimizer's discretization handles momentum updates automatically as part of the position update.
  • Orthogonal Attention Heads: The paper reveals a fascinating insight for Vision Transformers: it is better to make each attention head orthogonal within itself rather than trying to make all heads orthogonal to each other. This "within-head" constraint significantly boosts accuracy.
  • Unified Hyperparameters: One practical headache in manifold optimization is that you often need different learning rates for the manifold parameters and the regular Euclidean parameters. This new optimizer allows researchers to use the same learning rate for both, greatly simplifying the tuning process.

Key Results

  • Vision Transformers: On CIFAR-10, a ViT trained with the Stiefel optimizer achieved a test error of 8.32%, significantly better than the standard SGD baseline (9.75%) and other Stiefel-specific optimizers like the Cayley-based method (12.90%).
  • Optimal Transport: In PRW tasks, the method found better local minima (higher transport distances) and converged faster than the previous state-of-the-art Riemannian Gradient with Adaptive Step-size (RAGAS).
PRW distance mean over iterations for MNIST and Shakespeare datasets
  • Numerical Stability: The algorithm showed superior "manifold perseverance," maintaining orthogonality down to machine precision ($10^{-15}$) even over thousands of iterations, whereas some competing methods began to drift.

Limitations and Future Work

  • Focus on $n > m$: The paper primarily focuses on the "tall" matrix case ($n > m$). While they discuss the square matrix case ($n = m$) in the appendix, the core innovations are tailored for non-square Stiefel manifolds.
  • Stochastic Theory: While the algorithm works excellently with stochastic gradients (common in deep learning), the formal convergence proofs provided in the paper are for the deterministic (full-gradient) case.
  • Higher-Order Schemes: The authors suggest that while their 1st-order integrator is efficient, future work could explore higher-order "symplectic" integrators to further improve accuracy in physics-informed machine learning applications.

Summary updated

BibTeX
@inproceedings{kong2023momentum,
  author = {Lingkai Kong and Yuqing Wang and Molei Tao},
  title = {{Momentum Stiefel Optimizer, with Applications to Suitably-Orthogonal Attention, and Optimal Transport}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=vCJ9-Ri-6xU},
}
Figure