Fill in the full-FT memory contributions for a 7B model
Weights 14 GB, gradients 14 GB, Adam states 56 GB: about 84 GB baseline before activations, which is why full FT of a 7B model needs multiple data-center GPUs.
Picture each of the 7 billion knobs in the model. To train it with Adam, you keep four copies of every knob. One copy is the knob itself, one is the nudge you want to apply this step, and two are running averages Adam keeps to smooth the nudges. The knob and the nudge are stored compactly at 2 bytes each, but the two averages are stored at full 4-byte precision so the math stays stable. Add it up across all 7 billion knobs and you get roughly 84 gigabytes of memory, before you even feed in any data. That is why a model that sounds small still does not fit on one gaming GPU when you train it the full way.
Detailed answer & concept explanation~7 min readEverything 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. 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.
5 min: assign bytes per parameter to weights, grads, and the two Adam moments, multiply by 7e9, sum to 84 GB, then discuss why optimizer states dominate and how LoRA, 8-bit Adam, and ZeRO attack them.
| Component | Bytes/param | 7B footprint |
|---|---|---|
| Weights (bf16) | 2 | 14 GB |
| Gradients (bf16) | 2 | 14 GB |
| Adam moments (2 x fp32) | 8 | 56 GB |
| Baseline before activations | 12 | ~84 GB |
Real products, models, and research that use this idea.
- Training a Llama 3.1 8B with full FT and standard Adam overflows a single 80 GB H100, which is why teams reach for ZeRO sharding or LoRA in practice.
- DeepSpeed ZeRO-2 shards the 56 GB of Adam states across data-parallel ranks, the exact term this arithmetic shows dominates the budget.
- The bitsandbytes 8-bit Adam cuts moment storage roughly in half, attacking the 56 GB optimizer term directly rather than the weights.
- QLoRA quantizes the frozen base to 4-bit and trains only LoRA adapters, so the 56 GB full-Adam state term collapses to megabytes of adapter moments.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhy are Adam's moments kept in fp32 even when the weights are bf16?
QHow does adding an fp32 master copy of the weights change the 84 GB number?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Counting only the weights and forgetting that Adam keeps two extra fp32 moments per parameter. Those optimizer states are the largest single term, four times the weight footprint.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.