MSign: An Optimizer Preventing Training Instability in Large Language Models via Stable Rank Restoration
Lianhai Ren, Yucheng Ding, Xiao Liu, Qianxiao Li, Peng Cheng, Yeyun Gong
TL;DR
This work identifies a fundamental instability mechanism in large-scale transformer pretraining: simultaneous stable rank collapse and increasing inter-layer Jacobian alignment cause exponential gradient growth as depth increases. It theoretically connects low stable rank and Jacobian alignment to large total Jacobian norms and gradient magnitudes, establishing a causal failure pathway. To break this feedback loop, the authors propose MSign, a matrix-sign-based optimizer that periodically restores weight stable rank by projecting weight matrices to partial isometries while preserving the Frobenius norm, with targeted application to attention projections and a modest overhead. Empirical validation across 5M–3B parameter models (dense and MoE) demonstrates that MSign prevents training failures with less than 7% overhead, maintaining stable rank and bounded gradients; ablations show attention-layer targeting is essential and provide guidance on default application period, delivering practical stability improvements for scalable LLM pretraining.
Abstract
Training instability remains a critical challenge in large language model (LLM) pretraining, often manifesting as sudden gradient explosions that waste significant computational resources. We study training failures in a 5M-parameter NanoGPT model scaled via $μ$P, identifying two key phenomena preceding collapse: (1) rapid decline in weight matrix stable rank (ratio of squared Frobenius norm to squared spectral norm), and (2) increasing alignment between adjacent layer Jacobians. We prove theoretically that these two conditions jointly cause exponential gradient norm growth with network depth. To break this instability mechanism, we propose MSign, a new optimizer that periodically applies matrix sign operations to restore stable rank. Experiments on models from 5M to 3B parameters demonstrate that MSign effectively prevents training failures with a computational overhead of less than 7.0%.
