MKOR: Momentum-Enabled Kronecker-Factor-Based Optimizer Using Rank-1 Updates

Mohammad Mozaffari, Sikan Li, Zhao Zhang, Maryam Mehri Dehnavi

TL;DR

Second-order optimizers promise faster neural network training by using curvature information, but they are notoriously slow and memory-hungry for large models. This paper introduces MKOR, a novel second-order optimizer that uses rank-1 updates to slash computational and communication costs, achieving up to a 2.57x speedup over state-of-the-art methods on BERT-Large.

The Bottleneck of Second-Order Optimization

In deep learning, standard first-order optimizers (like SGD, Adam, or LAMB) only look at the gradient (slope) of the loss function. Second-order methods (like Newton's method or KFAC) also look at the curvature (the Hessian or Fisher Information Matrix). This allows them to take smarter, more direct steps toward the solution and converge in far fewer iterations.

The catch? Calculating and inverting these massive curvature matrices scales cubically—either $\mathcal{O}(d^3)$ based on layer dimension, or $\mathcal{O}(b^3)$ based on batch size. For Large Language Models (LLMs) like Transformers, where layer dimensions are huge and batch sizes scale with sequence length, these methods become computationally paralyzed.

To cope, existing second-order methods update their curvature information very infrequently (using "stale" data) and require massive data synchronization across GPUs. They are also prone to numerical instability and exploding gradients. The authors set out to build a second-order optimizer that actually scales to LLMs without losing the rapid convergence benefits.

Introducing MKOR

The authors introduce MKOR, which fundamentally changes how the curvature matrix is inverted and synchronized.

MKOR Algorithm Overview
  • Rank-1 Approximation & Sherman-Morrison Inversion: Instead of doing a full, expensive matrix inversion, MKOR approximates the covariance matrices using rank-1 updates (averaging across samples). It then applies the Sherman-Morrison identity, a mathematical shortcut that allows them to update the inverse of the matrix directly. This drops the computational complexity from $\mathcal{O}(d^3)$ to $\mathcal{O}(d^2)$.
  • Linear Communication: Because MKOR only needs to synchronize rank-1 approximation vectors (rather than full matrices) across GPUs, communication costs drop from quadratic $\mathcal{O}(d^2)$ to linear $\mathcal{O}(d)$.
  • Half-Precision (FP16) Compatibility: Traditional second-order methods rely on complex matrix decompositions (like SVD) that fail under low-precision arithmetic. MKOR's simplified math avoids this, allowing the use of FP16 to further halve memory and communication overhead.
  • Norm-Based Stabilizer: To prevent the exploding gradients that plague second-order methods, MKOR monitors the matrix factors. If they grow too large, it automatically scales them back toward a standard SGD update to maintain stability.
  • Hybrid MKOR (MKOR-H): Second-order updates are highly effective early in training but lose their edge as the model nears convergence. MKOR-H monitors the loss reduction rate and dynamically falls back to a cheaper first-order optimizer in the late stages of training.

Key Insights

  • Over-parameterization is a feature, not a bug: In massive neural networks, the covariance matrices of activations and gradients naturally become low-rank as training progresses because neurons become dependent on one another. Therefore, MKOR's rank-1 approximation accurately reflects the network's underlying mathematical reality rather than just acting as a cheap hack.
  • Fresh approximations beat perfect, stale data: Because MKOR's updates are computationally cheap, it can update its curvature information 10 to 100 times more frequently than state-of-the-art competitors like KAISA/KFAC. Frequently updated, slightly approximated curvature data leads to better convergence than perfectly calculated data that goes "stale" over hundreds of steps.
  • Math eliminates the need for "damping": Competing methods require manual tuning of a "damping factor" to prevent dividing by zero during matrix inversion. MKOR's specific algebraic formulation guarantees positive-definite matrices, entirely eliminating this finicky hyperparameter and preventing numerical underflow.

Key Results

The authors evaluated MKOR across a variety of models and tasks, including pre-training (BERT-Large), question answering (SQuAD v1.1), text classification (GLUE, IMDB), and computer vision (ImageNet, CIFAR-100).

Performance Comparison on SQuAD v1.1
  • Massive LLM Speedups: On BERT-Large-Uncased (trained on 64 A100 GPUs), MKOR-H reduced end-to-end training time from ~8 hours (using LAMB) to just 3.1 hours—a 2.57x speedup.
  • Fewer Steps to Convergence: On the SQuAD v1.1 task, MKOR-H reached target accuracy in just 600 steps, compared to 1,536 steps for LAMB and 1,000 steps for KAISA.
  • State-of-the-Art on GLUE: MKOR achieved a new state-of-the-art average metric on the GLUE benchmark for BERT-Large, succeeding where other second-order methods (like KFAC) failed to even converge to the baseline.
  • Hyperparameter Robustness: MKOR proved vastly less sensitive to learning rate tuning than SGD, KAISA, or HyLo, converging reliably across a much wider range of learning rates without diverging.

Limitations and Future Work

  • Higher-Rank Extensions are Bottlenecked: The authors explored extending MKOR to use higher-rank approximations (e.g., rank-$r$ instead of rank-1). However, doing so requires Singular Value Decomposition (SVD), which re-introduces the exact $\mathcal{O}(d^3)$ computational bottleneck they successfully avoided.
  • Late-Stage Stagnation: The high convergence rate of pure second-order methods naturally stagnates after the first few epochs. While the authors successfully engineered around this using the MKOR-H hybrid switching mechanism, it highlights a fundamental limitation in the lifecycle of second-order optimization.

Summary updated

BibTeX
@inproceedings{mozaffari2023mkor,
  author = {Mohammad Mozaffari and Sikan Li and Zhao Zhang and Maryam Mehri Dehnavi},
  title = {{MKOR: Momentum-Enabled Kronecker-Factor-Based Optimizer Using Rank-1 Updates}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=jcnvDO96N5},
}
Figure