Adam optimizer state per parameter: fill in the moment buffers and bytes
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Two fp32 buffers per parameter: m for the first moment and v for the second, four bytes each, eight bytes of optimizer state per trainable parameter.
Imagine a coach watching every player on a roster across many games. For each player, the coach keeps two notepads. The first notepad records the running average of how much the player moved in each game, in which direction. The second notepad records the running average of how big those moves were, ignoring direction. Both notepads stay open between games so the coach always has a smoothed picture per player. Adam works the same way for parameters. There is one notepad per parameter for the first moment of the correction signal and one for the second moment of that same signal. Each notepad holds a number that takes four bytes of memory. Two notepads at four bytes each adds up to eight bytes of optimizer bookkeeping per parameter.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
4 min: two moments m and v + why both are fp32 + 8-bytes per parameter calculation + total memory implications at 7B and 70B + how 8-bit Adam, paged Adam, ZeRO-1, and LoRA each shrink the number.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Forgetting that optimizer state is fp32 even in a mixed-precision run. Adam's moments stay in fp32 for numerical stability while the model itself runs in bf16.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.