Parameter and Memory Efficient Pretraining via Low-rank Riemannian Optimization

Zhanfeng Mo, Long-Kai Huang, Sinno Jialin PanICLR 2025

TL;DR

The Low-rank Riemannian Optimizer (LORO) enables efficient pretraining of Large Language Models (LLMs) from scratch by directly optimizing low-rank factors on a matrix manifold. By treating weight matrices as a single low-rank entity rather than two independent factors, LORO achieves better performance than full-size models while slashing memory usage by over 50% and doubling inference speed.

The Challenge of Low-Rank Pretraining

Pretraining LLMs is notoriously expensive, requiring massive GPU memory and compute. While techniques like LoRA (Low-Rank Adaptation) have revolutionized fine-tuning by training only a small product of two matrices ($BA$), applying this to pretraining from scratch usually fails.

The authors identify a fundamental flaw in existing approaches: standard optimizers update the factors $A$ and $B$ independently. This "separate optimization" ignores the intricate geometry of the low-rank manifold. It introduces redundant information and leads to "ill-conditioned" weights—where some singular values explode while others vanish—causing unstable training and poor final performance. Previous workarounds often fell back to periodically merging weights into a full-size matrix, defeating the purpose of memory efficiency during inference.

Methods: Low-rank Riemannian Optimizer (LORO)

The core innovation is LORO, which treats the weight matrix $W = BA$ as a point on a Riemannian manifold—the mathematical space of all rank-$r$ matrices.

Riemannian optimization on the low-rank manifold
  1. Joint Updates: Instead of updating $A$ and $B$ separately, LORO calculates a "Riemannian gradient." This ensures the product $BA$ moves along the steepest descent direction on the low-rank manifold.
  2. Low-Rank Friendly Math: Calculating a true Riemannian gradient usually requires expensive Singular Value Decompositions (SVD) on full-size matrices. LORO bypasses this by using clever linear algebra to perform the SVD on much smaller $2r \times 2r$ matrices.
  3. The "Lazy" Approximation: To keep computational overhead low, LORO uses an Exact Update (the full Riemannian step) only once every $K$ steps (e.g., every 500 steps). In between, it uses a computationally cheap Approximated Update that scales gradients by the ratio of rank to hidden dimension ($r/d$).
  4. No Full-Size Matrices: At no point does LORO need to instantiate or calculate gradients for the full $d \times d$ weight matrix, maintaining a small memory footprint throughout training and inference.

Key Insights

  • Geometry Matters: The failure of previous low-rank pretraining wasn't due to the low-rank constraint itself, but the path taken during optimization. Riemannian optimization provides a mathematically "correct" path that Euclidean optimizers miss.
  • Balancing Act: The exact LORO update implicitly balances the singular values of $A$ and $B$. This prevents the "spiky" loss curves seen in standard low-rank training and keeps the model stable.
  • Flatter Minima: Linear interpolation experiments show that LORO finds "flatter" minima than full-size training, which is generally associated with better generalization in deep learning.
  • Inference for Free: Because the model stays in its $BA$ factorized form, the resulting checkpoint is natively low-rank. This leads to a permanent $\sim 2\times$ speedup in inference without needing post-training compression.

Key Results

LORO was evaluated by pretraining LLaMA models (up to 1B parameters) on the C4 dataset. It consistently outperformed full-size baselines and other efficiency methods like GaLore and ReLoRA:

Perplexity vs. Memory-Efficiency for LLaMA-1B
  • Performance: A LLaMA 1B model trained with LORO achieved a 2% better perplexity than the full-size baseline.
  • Memory Efficiency: It reduced model memory by 54%.
  • Speed: It delivered a 1.8x speedup in training and a 2.2x speedup in inference.
  • Scalability: The benefits were consistent across model sizes, showing that LORO "unlocks" the potential of low-rank structures that were previously thought to be too restrictive for pretraining.

Limitations and Future Work

  • Scale: While 1B parameters is significant, the authors did not test on "frontier" scales (7B+ or 70B+) due to hardware constraints.
  • Hyperparameter Sensitivity: The frequency of the exact update ($K$) is a new hyperparameter that needs to be set. While $K=500$ worked well, the optimal value might vary for different architectures.
  • Beyond Text: The current work focuses on language models. Exploring LORO for vision and multimodal generative models is a promising next step.

Summary updated

BibTeX
@inproceedings{mo2025parameter,
  author = {Zhanfeng Mo and Long-Kai Huang and Sinno Jialin Pan},
  title = {{Parameter and Memory Efficient Pretraining via Low-rank Riemannian Optimization}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=i0zzO7Hslk},
}
Figure