Project 04 · Reference 1.0.0

Packed
AdamW

Two persistent Adam moments stored in one 32-bit word per FP32 learned parameter. The model and the current optimizer update remain FP32.

Moment state
8 → 4 bytes / parameter
Reference model
11,637,760 parameters
Release
v1.0.0 · CC0

Concept

Compress the history, not the update

AdamW carries a moving average of gradients and a moving average of squared gradients for every learned parameter. Ordinary FP32 AdamW therefore keeps eight persistent optimizer bytes alongside each four-byte FP32 weight.

Packed AdamW asks whether those histories need the full FP32 fraction between updates. It stores both in custom 16-bit floating-point lanes and expands them only inside the optimizer update tile. Weights, gradients, activations, bias correction, weight decay, and the current parameter update remain FP32.

Persistent state format

One parameter, one word

Custom finite software encodings—not native NVIDIA E4 instruction formats.

m

First moment

Signed, finite, round-to-nearest ties-to-even, with exact zero and finite saturation.

r

Root second moment

Nonnegative RMS with no sign bit, so the lane spends that bit on another fraction position.

u32

Checkpoint form

The packed word remains uint32 in checkpoints; decoded FP32 shadow moments are never serialized.

The square-root technique

Store RMS instead of the raw second moment

AdamW normally carries the uncorrected second moment, v, and later takes its square root for the adaptive denominator. Packed AdamW instead stores r = sqrt(v). On the next update it decodes r and reconstructs the prior estimate as v = r × r.

The transformation is useful for representation, not because it removes Adam's square root. RMS occupies a friendlier numerical range than the raw squared-gradient history. It is also always nonnegative, so its 16-bit lane needs no sign bit. That recovered bit becomes a twelfth fraction bit, giving the RMS lane more local precision while retaining the dynamic range of a four-bit exponent.

Squaring a decoded RMS is not algebraically identical to quantizing the raw second moment. It introduces its own representation error, and finite bounds that worked in the demonstrated run may not fit other tasks. The reference records underflow, saturation, and nonfinite events rather than silently changing formats.

Update ordering

Decode, update, then repack

01

Decode prior state

Load the FP32 parameter and gradient, then decode the signed first moment and nonnegative RMS from one uint32 word.

02

Reconstruct the second moment

Square the decoded RMS to recover the prior second-moment estimate, then calculate the next first and second moments in FP32.

03

Update in FP32

Apply bias correction, decoupled weight decay, and the current adaptive parameter update before either new moment is quantized.

04

Pack the next history

Take the square root of the new uncorrected second moment and pack it with the new first moment for the following update.

Memory accounting

Half the moments, not half the training footprint

Persistent or narrow itemFP32 AdamWPacked AdamW
FP32 weights4P bytes4P bytes
FP32 gradients4P bytes4P bytes
Persistent moments8P bytes4P bytes
Narrow subtotal16P bytes12P bytes
Ideal optimizer traffic28P bytes20P bytes

50%less persistent moment state

25%less in the weights + gradients + moments subtotal

4 GBmoment-state capacity saved per billion parameters

Activations, attention intermediates, logits, temporary buffers, allocator reserves, and framework memory are outside this ledger. One live sample showed about an 18% allocation difference; it was not a proven peak-memory measurement.

Matched experiment

One model, one seed, three state formats

11,637,760 parameters · 203,920 updates · identical FP32 training arithmetic

Persistent stateValidation BPBWall timeMoment bytes / parameter
FP32 first + raw second1.382809163,604.599 s8
FP16 first + RMS1.406452913,515.610 s4
E4M11 first + E4M12 RMS1.386874033,502.284 s4

+0.00406487 BPBcustom E4 final gap from FP32 · approximately +0.294%

−2.92% wall timeobserved end-to-end in this small sequential run