Enhancing LLM Training via Spectral Clipping
Organizations: CISPA Helmholtz Center for Information Security, Saarbrücken, Germany · Universität des Saarlandes, Saarbrücken, Germany · EPFL
Abstract
While spectral-based optimizers like Muon operate directly on the spectrum of updates, standard adaptive methods such as AdamW do not account for the spectral structure of weights and gradients, leaving them vulnerable to two empirical issues in large language model (LLM) training: (i) the optimizer updates can have large spectral norms, potentially destabilizing training and degrading generalization; (ii) stochastic gradient noise can exhibit sparse spectral spikes, with a few dominant singular values much larger than the rest. We propose SPECTRA, a general framework addressing these by (i) post-spectral clipping of updates to enforce spectral-norm constraints (ii) optional pre-spectral clipping of gradients to suppress spectral noise spikes. We prove that post-clipping constitutes a Composite Frank-Wolfe method with spectral-norm constraints and weight regularization. We further analyze how pre-clipping mitigates sparse spectral spikes. We propose efficient soft spectral clipping via Newton-Schulz iterations, avoiding expensive SVD. Experiments on LLM pretraining show SPECTRA uniformly improves validation loss for various optimizers, including AdamW, Signum, Mars, and AdEMAMix, with the best-performing variants achieving state-of-the-art results. Models trained with SPECTRA exhibit smaller weight norms, confirming the link between spectral clipping and regularization.
Figures & tables
| Optimizer | ARC-c | ARC-e | BoolQ | PIQA | HellaSwag | WinoGrande | OBQA | -OpenAI | Sciq | MMLU | Average | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Mars | 29.38 | |||||||||||
| D-Muon | 90.90 | |||||||||||
| Signum | ||||||||||||
| Spectra-Signum | 68.81 | 58.10 | 70.46 | 54.46 | 26.44 | 51.62 | ||||||
| AdamW | ||||||||||||
| Spectra-AdamW | 36.40 |
| Baseline (extended steps) | SPECTRA | ||||
| Optimizer | 16000 | +5% | +10% | +20% | 16000 |
| (16800) | (17600) | (19200) | |||
| AdamW | 2.608 | 2.605 | 2.600 | 2.590 | 2.582 |
| Signum | 2.600 | 2.594 | 2.589 | 2.580 | 2.573 |
| AdEMAMix | 2.591 | 2.585 | 2.580 | 2.571 | 2.574 |
| MARS | 2.598 | 2.592 | 2.587 | 2.579 | 2.573 |
| 1 | 5 | 10 | 20 | 50 | |
|---|---|---|---|---|---|
| Val Loss | 2.975 | 2.940 | 2.936 | 2.936 | 2.940 |
| NS Iters | 5 (bf16) | 10 (bf16) | 15 (float32) |
|---|---|---|---|
| Val Loss | 2.939 | 2.936 | 2.937 |
Appendix figures & tables36 assets
Supplementary material from the paper’s appendix.
Appendix
| Parameters | 124M | 160M | 780M | 820M |
|---|---|---|---|---|
| Embed dimension | 768 | 768 | 1280 | 2048 |
| # Attention heads | 12 | 12 | 20 | 16 |
| # Layers | 12 | 12 | 32 | 12 |
| Untied embed | False | True | True | True |
| 160M | 780M | 820M | |||||||
| Method | Total (ms) | Opt Step (%) | Overhead | Total (ms) | Opt Step (%) | Overhead | Total (ms) | Opt Step (%) | Overhead |
| AdamW | 200.7 | 1.0 | — | 6550 | 0.2 | — | 4412 | 0.2 | — |
| + Pre-Clip | 232.6 | 13.7 | +15.9% | 6640 | 1.4 | +1.4% | 4480 | 1.7 | +1.5% |
| + SPECTRA | 238.3 | 15.6 | +18.7% | 6654 | 1.7 | +1.6% | 4504 | 2.4 | +2.1% |
| Signum | 203.2 | 1.9 | — | 6536 | 0.3 | — | 4408 | 0.5 | — |
| + SPECTRA | 241.2 | 17.1 | +18.7% | 6667 | 1.9 | +2.0% | 4514 | 2.6 | +2.4% |
| Optimizer | State Buffers | Memory | Factor |
|---|---|---|---|
| AdamW | |||
| AdEMAMix | |||
| D-Muon 3 3 3 D-Muon uses momentum-only updates for 2D matrices (with rows ) and AdamW for others including embeddings/biases. | (2D), (1D) | ||
| Signum | (momentum) | ||
| SOAP 4 4 4 SOAP stores preconditioner matrices for any parameters with (default ). For typical LLM architectures with , preconditioner overhead is approximately . | |||
| MARS (AdamW) 5 5 5 MARS stores gradient history for variance reduction where represents the previous gradient. | (2D) |
| Method | Val Loss |
|---|---|
| Signum (lr= ) | 4.955 |
| Signum (lr= ) | 3.688 |
| SPECTRA-Signum (lr= ) | 3.439 |
| + pre-clip (constant ) | 3.431 |
| + pre-clip (cos decay, : ) | 3.425 |
| Optimizer | LR | Val Loss | Optimizer | LR | Val Loss |
|---|---|---|---|---|---|
| SOAP | Spectra-Signum | ||||
| D-Muon | |||||
| MARS | |||||
| AdEMAMix | Spectra-AdEMAMix | ||||
| Hyperparameter | 160M (wsd) | 160M (cos) | 780M (wsd) | 820M (wsd) |
|---|---|---|---|---|
| Learning Rate | 5e-4, 1e-3 , 2e-3 | 1e-3, 2e-3 , 3e-3 | 1e-3 | 1e-3 |
| Clipping Threshold | 5.0, 10.0 | 5.0 | 10.0 | 10.0 |
| Clipping Schedule | standard | standard | standard | standard |
| Others | Same as in Table F.9 |
| Method (lr) | 780M | 820M |
|---|---|---|
| SOAP ( ) | 2.586 | 2.606 |
| SOAP ( ) | 2.571 | 2.602 |
| SOAP ( ) | 2.574 | 2.603 |
| SPECTRA-Signum ( ) | 2.573 | 2.594 |
| Learning Rate | ||||||
|---|---|---|---|---|---|---|
| Schedule | Method | 1e-3 | 2e-3 | 3e-3 | 4e-3 | 5e-3 |
| wsd | AdamW-Post-Orth | 2.988 | 2.973 | 2.974 | – | – |
| wsd | Spectra-AdamW | – | – | – | – | |
| cos | AdamW-Post-Orth | 3.009 | 2.966 | 2.955 | 2.953 | 2.956 |
| cos | Spectra-AdamW | – | – | – | – | |
| Hyperparameter | 160M (wsd) | 160M (cos) | 780M (wsd) | 820M (wsd) |
|---|---|---|---|---|
| Batch Size | 256 | 256 | 1012 | 992 |
| Sequence Length | 512 | 512 | 1024 | 1024 |
| Warmup Steps | 2000 | 2000 | 2000 | 2000 |
| Weight Decay | 0.1 | 0.1 | 0.1 | 0.1 |
| Gradient Clipping | 0.5 | 0.5 | 0.1 | 0.1 |
| Momentum | 0.8 | 0.8 | 0.9 | 0.9 |
| Hyperparameter | 160M (wsd) | 160M (cos) | 780M (wsd) | 820M (wsd) |
|---|---|---|---|---|
| Batch Size | 256 | 256 | 1012 | 992 |
| Sequence Length | 512 | 512 | 1024 | 1024 |
| Warmup Steps | 2000 | 2000 | 2000 | 2000 |
| Weight Decay | 0.1 | 0.1 | 0.1 | 0.1 |
| Gradient Clipping | 0.5 | 0.5 | 0.1 | 0.1 |
| Momentum | 0.9 | 0.9 | 0.9 | 0.9 |
| Hyperparameter | 160M (wsd) | 160M (cos) | 780M (wsd) | 820M (wsd) |
|---|---|---|---|---|
| Learning Rate | 5e-4, 1e-3 , 2e-3 | 1e-3, 2e-3 , 3e-3 | 5e-4, 1e-3 | 1e-3 |
| Clipping Threshold | 5.0, 10.0 | 5.0 | 10.0 | 10.0 |
| Clipping Schedule | standard | standard | standard | standard |
| Others | Same as in Table F.10 |
| Hyperparameter | 160M (wsd) | 160M (cos) | 780M (wsd) | 820M (wsd) |
|---|---|---|---|---|
| Batch Size | 256 | 256 | 1012 | 992 |
| Sequence Length | 512 | 512 | 1024 | 1024 |
| Warmup Steps | 8000 | 8000 | 2000 | 2000 |
| Weight Decay | 0.1 | 0.1 | 0.1 | 0.1 |
| Gradient Clipping | 0.5 | 0.5 | 0.1 | 0.1 |
| Momentum | 0.95 | 0.95 | 0.95 | 0.95 |
| Hyperparameter | 160M (wsd) | 160M (cos) | 780M (wsd) | 820M (wsd) |
|---|---|---|---|---|
| Warmup Steps | 2000 | 2000 | 2000 | 2000 |
| Learning Rate | 5e-4, 1e-3 , 2e-3 | 1e-3, 2e-3 , 3e-3 | 1e-3 | 1e-3 |
| Clipping Threshold | 10.0 | 5.0 | 10.0 | 10.0 |
| Clipping Schedule | standard | standard | standard | standard |
| Others | Same as in Table F.12 |
| Hyperparameter | 160M (wsd) | 780M (wsd) | 820M (wsd) |
|---|---|---|---|
| Warmup Steps | 2000 | 2000 | 2000 |
| Learning Rate Mars | 3e-3 | 3e-3 | 3e-3 |
| Clipping Threshold | 10.0 | 10.0 | 10.0 |
| Clipping Schedule | standard | standard | standard |
| Others | Same as in Table F.16 |
| Hyperparameter | 160M (wsd) | 160M (cos) | 780M (wsd) | 820M (wsd) |
|---|---|---|---|---|
| Batch Size | 256 | 256 | 1012 | 992 |
| Sequence Length | 512 | 512 | 1024 | 1024 |
| Warmup Steps | 2000 | 2000 | 2000 | 2000 |
| Weight Decay | 0.1 | 0.1 | 0.1 | 0.1 |
| Gradient Clipping | 0.5 | 0.5 | 0.1 | 0.1 |
| Momentum | 0.95 | 0.95 | 0.95 | 0.95 |
| Hyperparameter | 160M (wsd) | 160M (cos) | 780M (wsd) | 820M (wsd) |
|---|---|---|---|---|
| Batch Size | 256 | 256 | 1012 | 992 |
| Sequence Length | 512 | 512 | 1024 | 1024 |
| Warmup Steps | 2000 | 2000 | 2000 | 2000 |
| Weight Decay | 0.1 | 0.1 | 0.1 | 0.1 |
| Gradient Clipping | 0.5 | 0.5 | 0.1 | 0.1 |
| Learning Rate AdamW | 5e-4, 1e-3 | 1e-3 | 1e-3 | 1e-3 |
| Hyperparameter | 160M (wsd) | 160M (cos) | 780M (wsd) | 820M (wsd) |
|---|---|---|---|---|
| Batch Size | 256 | 256 | 1012 | 992 |
| Sequence Length | 512 | 512 | 1024 | 1024 |
| Warmup Steps | 2000 | 2000 | 2000 | 2000 |
| Weight Decay | 0.1 | 0.1 | 0.1 | 0.1 |
| Gradient Clipping | 0.5 | 0.5 | 0.1 | 0.1 |
| Preconditioner dimension | 10000 | 10000 | 10000 | 10000 |