Understanding Quantization of Optimizer States in LLM Pre-training: Dynamics of State Staleness and Effectiveness of State Resets
Organizations: New York University
Abstract
Quantizing optimizer states is becoming an important ingredient of memory-efficient large-scale pre-training, but the resulting optimizer dynamics remain only partially understood. We study low-precision exponential moving average (EMA) optimizer states and show how quantization can cause many nominal updates to round back to the same stored value, making the state effectively stale and slowing adaptation beyond what the nominal decay would suggest. We then develop a simple predictive model of stalling that estimates one-step stalling probabilities and characterizes how stalling builds up over time after the initialization. This perspective provides a mechanistic explanation for why optimizer-state resets help in low precision: once a quantized EMA becomes effectively stale, resetting it can temporarily restore responsiveness. Motivated by this picture, we derive a simple theory-guided method for choosing useful reset periods, showing that in low precision the key question is not only whether resets help, but when they should be applied. Experiments in controlled simulations and LLM pre-training show that suitable reset schedules recover the performance lost to low-precision state storage while substantially reducing optimizer-state memory.
Figures & tables
| Format | |||
|---|---|---|---|
| BF16 | |||
| FP8 (E4M3) | |||
| FP4 (E2M2) |
| Format | BF16 | FP8 | FP4 |
|---|---|---|---|
| BF16 | FP8 | FP4 | |
|---|---|---|---|
| Configuration | 60M | 100M | 350M |
|---|---|---|---|
| BF16 AdamW | 3.52 | 3.27 | 2.99 |
| BF16 AdamW + SR + Resets | 3.45 | 3.21 | 2.92 |
| FP8 AdamW | 3.53 | 3.33 | 3.02 |
| FP8 AdamW + SR + Resets | 3.44 | 3.22 | 2.92 |
| FP4 AdamW | 3.52 | 3.32 | 3.03 |
| FP4 AdamW + SR + Resets | 3.48 | 3.26 | 2.97 |
| Configuration | FP32 | BF16 | FP8 | FP4 |
|---|---|---|---|---|
| NR only | 3.155 | 3.181 | 3.193 | 3.199 |
| SR only | – | 3.156 | 3.160 | 3.182 |
| Resets only | 3.161 | 3.158 | 3.159 | 3.166 |
| SR + Resets | – | 3.155 | 3.155 | 3.160 |
| Memory savings | 0% | 50% | 75% | 87.5% |
| Reset Strategy | Validation Loss |
|---|---|
| Symmetric Resets | 3.223 |
| Asymmetric Resets | 3.212 |
| Adaptive Resets | 3.225 |
| Configuration | BF16 | FP8 |
|---|---|---|
| SOAP | 3.22 | 4.15 |
| SOAP + SR + Resets | 3.19 | 3.23 |
Appendix figures & tables15 assets
Supplementary material from the paper’s appendix.
Appendix
| Model | Size | Format | Round. | Meas. | Pred. |
|---|---|---|---|---|---|
| LLaMA | 60M | BF16 | NR | .969 | .946 |
| LLaMA | 60M | BF16 | SR | .812 | .825 |
| LLaMA | 60M | FP8 | NR | .999 | 1.000 |
| LLaMA | 60M | FP8 | SR | .986 | .989 |
| LLaMA | 100M | BF16 | NR | .967 | .946 |
| LLaMA | 100M | BF16 | SR | .814 | .825 |
| Model | Size | Format | Round. | Meas. | Pred. |
|---|---|---|---|---|---|
| GPT-NeoX | 160M | BF16 | NR | .971 | .946 |
| GPT-NeoX | 160M | BF16 | SR | .817 | .825 |
| GPT-NeoX | 160M | FP8 | NR | .999 | 1.000 |
| GPT-NeoX | 160M | FP8 | SR | .989 | .989 |
| GPT-NeoX | 410M | BF16 | NR | .971 | .946 |
| GPT-NeoX | 410M | BF16 | SR | .820 | .825 |
| Format | KS | Stall-mass error | Mean mantissa | Relative ULP error |
|---|---|---|---|---|
| BF16 | 0.016 | 0.0001 | 1.318 | 0.193 |
| FP8 | 0.011 | 0.0006 | 1.413 | 0.213 |
| FP4 | 0.018 | 0.0031 | 1.427 | 0.307 |
| BF16 | FP8 | FP4 | |
|---|---|---|---|
| / | / | / | |
| / | / | / | |
| / | / | / | |
| / – | / | / |
| for tolerance level | Empirical | ||||
|---|---|---|---|---|---|
| Format | window | ||||
| BF16 | – | ||||
| FP8 | – | ||||
| FP4 | – | ||||
| Params | Hidden | Intermediate | Heads | Layers | Steps | Tokens | LR |
|---|---|---|---|---|---|---|---|
| 60M | 512 | 1376 | 8 | 8 | 10K | 1.3B | 0.001 |
| 100M | 640 | 1708 | 10 | 12 | 20K | 2.6B | 0.001 |
| 350M | 1024 | 2736 | 16 | 24 | 60K | 7.8B | 0.0004 |
| States | AdamW | AdamW+SR+resets |
|---|---|---|
| BF16 | 2.91 | 2.77 |
| FP8 | 2.89 | 2.78 |
| States | AdamW | AdamW+SR+resets |
|---|---|---|
| BF16 | 3.162 | 3.044 |
| FP8 | 3.223 | 3.098 |
| States | Method | HellaSwag | PIQA | ARC-E | ARC-C | WinoGrande | Avg. |
|---|---|---|---|---|---|---|---|
| BF16 | AdamW | 31.4 | 61.6 | 30.9 | 25.3 | 49.0 | |
| BF16 | AdamW+SR+resets | 33.1 | 63.6 | 32.4 | 25.5 | 50.0 | |
| FP8 | AdamW | 30.7 | 62.2 | 30.0 | 25.0 | 48.8 | |
| FP8 | AdamW+SR+resets | 32.5 | 63.9 | 31.9 | 25.6 | 50.7 | |
| FP4 | AdamW | 31.4 | 62.8 | 29.9 | 24.0 | 48.2 | |
| FP4 | AdamW+SR+resets | 32.8 | 63.4 | 31.7 | 25.1 | 49.8 |
| Budget | Method | State configuration | Loss |
|---|---|---|---|
| BF16 | AdamW | BF16 | 3.27 |
| AdamW+SR+resets | BF16 | 3.21 | |
| Adam-mini | FP32 | 3.24 | |
| Adam-mini+resets | FP32 | 3.24 | |
| FP8 | 8-bit AdamW | Dettmers blockwise INT8 | 3.24 |
| 8-bit AdamW+SR+resets | Dettmers blockwise INT8 | 3.21 |
| Implementation | Resets | Sec./step | Tokens/sec | State memory (GiB) |
|---|---|---|---|---|
| FP32 native | No | 3.888 | 25,718 | 0.746 |
| BF16 native | No | 3.862 | 25,895 | 0.373 |
| BF16 native | 3.859 | 25,915 | 0.373 | |
| BF16 simulated Quant/Dequant | No | 4.120 | 24,268 | 0.373 |
| BF16 simulated Quant/Dequant + simulated SR | No | 4.130 | 24,209 | 0.373 |
| BF16 simulated Quant/Dequant + simulated SR | 4.068 | 24,581 | 0.373 |