Manuscript Offprint

arXiv:2611.00589

Guarded Compression of Adam Optimizer State with Shared-Gradient Bounds

Annan Zhang, Shengjie Song, Wenshuai Yao, Lihao Zhang, Tianmiao

ABSTRACT

Adam keeps two FP32 moments per parameter, twice the bytes of the FP32 weights, yet compressing them is risky: the update divides by the square root of the second moment, so small reconstruction errors can change the restored computation substantially. We study guarded moment compression, in which a coordinate's decoded moments are accepted only if they reproduce the native FP32 Adam update to within a tolerance τ\tau, in units of the learning rate, for every gradient in a clipped domain; all other coordinates are stored exactly. The natural certificate, which ranges each update separately over gradient intervals, fails: on one million trained OPT-125M coordinates it escapes 98.9% of coordinates and the payload grows to 126.6% of raw FP32. Our key observation is that both updates consume the same gradient and parameter. Bounding their difference directly, with FP32 rounding-error allowances and a fixed mixed linear–logarithmic gradient partition, cuts escapes to 0.53% and the payload to 28.3% at τ=0.01\tau = 0.01. Across 120 complete-checkpoint restores of OPT-125M and ResNet-18, with four trained seeds and three training fractions per model, guarded 8-bit log codes shrink moment payloads by 69.5% and 71.9% relative to FP32, 40.8% and 45.4% relative to equally guarded BF16, and 29.3% and 37.6% relative to equally guarded blockwise 8-bit, and every restored first update stays within tolerance. Encoding and restoration together take 2.3–2.6×2.3–2.6\times as long as guarded BF16 but less time than guarded blockwise 8-bit. Searching both moment codes jointly saves under 0.001% more bytes at 6% more codec time, so per-moment rounding suffices. The guarantee covers the first restored update under a pinned Torch operation model; we measure subsequent training empirically.

1 INTRODUCTION

Checkpoints are how long training runs survive failures, preemption and migration, and systems increasingly write them often (Mohan et al., 2021; Wang et al., 2023). For models trained with Adam (Kingma & Ba, 2015), the optimizer state dominates each checkpoint: two FP32 moments per parameter, twice the bytes of the FP32 weights. Every byte removed from the moments is removed from every checkpoint that is written, moved and stored.

Lossy formats are the obvious lever. BF16 moments halve the bytes, and blockwise 8-bit quantization (Dettmers et al., 2022) quarters them. A restored optimizer, however, does not consume moments; it consumes the update they produce, and Adam divides the first moment by the square root of the second. Where the second moment is small, a small relative error changes the update substantially. On one million coordinates of a trained OPT-125M checkpoint, plain blockwise 8-bit moments change the next update by more than 1% of

a learning-rate step on 2,469 coordinates for a fixed set of in-domain gradients, and by up to 12.9% (§4.3). A checkpoint codec should therefore constrain the update produced by the decoded moments, not the moments themselves.

We call this guarded compression. Decoded moments for a coordinate are accepted only if, for every gradient gg in the clipping domain ∣g∣≤C|g| \leq C, the native FP32 Adam update they produce differs from the original by at most τ\tau learning rates. Coordinates that fail are escaped, that is, stored as exact FP32 moments, so the contract holds for every coordinate, and every code, escape and metadata byte is counted.

The difficulty is certifying a continuum of gradients. The textbook tool is interval arithmetic (Moore et al., 2009): partition the domain, bound the range of each update over each interval, and bound the difference of the updates by the distance between the two ranges. This discards the fact that both updates consume the same gradient, the classic dependency problem. Near g=0g = 0 the update can sweep across most of its range within one interval, so the two ranges are wide even when the updates are nearly identical (Figure 1a). On the same million coordinates, this separate-range bound escapes 98.9% of coordinates, and the “compressed” moments occupy 126.6% of raw FP32, more than storing them

¹Peking University ²Beihang University. Correspondence to: Annan Zhang annan@pku.edu.cn.

Preliminary work. Under review by the Machine Learning and Systems (MLSys) Conference. Do not distribute.

a Separate ranges lose the shared gradient

Figure

b Bounding the difference: 126.6% → 28.3%

Figure

Figure 1. Bound the difference, not the outputs: the shared-gradient bound with a mixed partition shrinks the guarded payload from 126.6% to 28.3% of raw FP32, below equally guarded BF16 and blockwise 8-bit. (a) Illustration with representative moments (m=2×10−5m = 2 \times 10^{-5}, v=10−9v = 10^{-9}, bias corrections ≈1\approx 1) and decoded moments perturbed by +0.2% and -0.4%. Over the gradient interval II, both updates sweep a range far wider than τ\tau, so bounding them separately gives 122τ122\tau; the shared-gradient bound of Equation (9) gives 0.48τ0.48\tau, against a true maximum of 0.23τ0.23\tau (rounding allowances omitted). (b) Measured on one million trained OPT-125M coordinates at τ=0.01\tau = 0.01 with independent code selection. Every configuration spends the same 27.7% of raw FP32 bytes on codes and metadata; the bound decides how many coordinates escape, at 8 bytes each. Vertical lines mark equally guarded BF16 and blockwise 8-bit payloads on the same coordinates.

uncompressed. Refining the gradient partition does not help (Figure 1b).

Our key observation is that the source and restored updates share their inputs, so the bound belongs on their difference. Subtracting the two Adam quotients algebraically cancels the gradient from the numerator difference and the parameter from the update difference, leaving terms that scale with the moment reconstruction errors (§3.2). We add explicit rounding-error allowances for each native FP32 operation path and evaluate the bound over a fixed partition that mixes linear and base-2 logarithmic gradient magnitudes. Escapes fall from 988,820 to 5,324, and the payload falls to 28.3% of raw FP32: 45% smaller than BF16 and 29% smaller than blockwise 8-bit moments under the same guard.

This paper makes three contributions:

  • A shared-gradient enclosure for the difference between two native Adam updates, combined with FP32 rounding-error allowances under a pinned Torch operation contract (§3).

  • A guarded moment codec with per-coordinate acceptance on decoded values, exact escapes, a fully accounted serialized format and standalone readback verification, implemented with directed-rounding CUDA kernels and audited on an H100 (§3, §4.2).

  • An evaluation that separates mechanism, baselines and cost (§4): a controlled ablation; equally guarded BF16 and official bitsandbytes baselines; 120 complete-checkpoint restores of OPT-125M and ResNet-18 with 100-update continuation; and paired multi-process codec timing.

Across both models, guarded log codes reduce moment

payloads by 67–72% relative to FP32, and every first restored update passes its audit. Log codes also need 17–28% less combined codec time than guarded blockwise 8-bit, and their combined codec time is 2.3–2.6×2.3–2.6\times that of guarded BF16. The design is simple. Once the acceptance test is tight, rounding each moment independently captures essentially all of the savings; searching code pairs jointly adds less than 0.001% while costing about 6% more codec time.

The guarantee is precise: under the pinned operation model, every restored first update provably matches the native FP32 update to within τ\tau. Later updates consume gradients that differ between branches, and we measure them directly over 100-update continuations (§4.5, §6).

References (32)