Prevent unrecoverable gradient explosions in LLM training by periodically restoring weight matrix stable rank through SVD-based matrix sign operations, eliminating sudden training failures without computational burden.
Standardmäßig ist der Prompt ausgewählt, der zuerst die Quelle prüft. Sie können zu einem direkten Befehl wechseln oder eine lokale Kopie herunterladen.
Quelldateien prüfen
Lesen Sie SKILL.md und alle von SkillsMP angezeigten Begleitdateien, bevor Sie sich für eine Installation entscheiden.
Mit Codex oder Claude installieren Kopieren Sie diesen Prompt, fügen Sie ihn in Codex, Claude oder einen anderen Assistant ein und lassen Sie die Skill-Seite prüfen und installieren.
Ein direkter Befehl überspringt den Prüf-Prompt. Prüfen Sie die Quelle, bevor Sie ihn ausführen.
Prevent unrecoverable gradient explosions in LLM training by periodically restoring weight matrix stable rank through SVD-based matrix sign operations, eliminating sudden training failures without computational burden.
MSign: An Optimizer Preventing Training Instability via Stable Rank Restoration
Problem Context
LLM pretraining exhibits sudden, unrecoverable gradient explosions that waste significant computational resources. These failures lack obvious early warning and occur after thousands of training steps. Understanding their root cause requires analyzing weight matrix properties. Low stable rank (concentration of singular values) combined with high layer Jacobian alignment creates conditions for exponential gradient growth.
Core Concept
MSign identifies [stable rank collapse, Jacobian alignment, causal mechanisms] as precursors to training failures. The optimizer applies [periodic matrix sign operations, SVD-based restoration, lightweight updates] to restore stable rank by equalizing non-zero singular values to 1, breaking the chain that leads to gradient explosions.
Architecture Overview
Diagnosis: Monitor stable rank of weight matrices and Jacobian alignment between layers
When to use: Large-scale LLM training (1B+) prone to sudden gradient explosions. Most effective with dense, well-initialized models where failure is infrequent but catastrophic.
Hyperparameters:
rank_restore_interval: 50-200 steps
Every 100 typical
More frequent for unstable training
Less frequent for stable training to reduce overhead
blend_ratio: 0.05-0.15 (how much of the sign matrix to use)
Conservative 0.1 recommended
apply_to_attention_only: True for 2-3% throughput cost, False for 7% cost
Key empirical findings:
Prevents gradient explosions completely (100% success rate in tested scenarios)
Throughput reduction: <7% overhead
Works across dense and MoE models
Selective attention-layer application provides good cost-benefit
Common pitfalls:
blend_ratio too high → disrupts learned weights
rank_restore_interval too frequent → computational waste
Applying to all layers on large models → 10%+ overhead
Not combining with gradient clipping → less robust
Validation: Recommended to combine with gradient clipping (norm=1.0) and learning rate warmup for maximum stability.
Reference
Paper: https://arxiv.org/abs/2602.01734
Code: Available at author's repository
Theoretical analysis: Stable rank, Jacobian alignment, gradient explosion chains
Metrics: Training curves, failure-free iterations, convergence speed