← All questions
Training & Fine-tuningEasy· Optimizer Memory· Adam· SGD

Why does Adam make memory worse than SGD?

Using BF16, SGD requires 4 bytes per parameter to store parameters and gradients. Adam, however, requires storing the first moment (4 bytes, FP32), the second moment (4 bytes, FP32), and master weights (4 bytes, FP32). This adds 12 bytes to the base 4 bytes, totaling 16 bytes per parameter. This 4x blow-up is entirely attributable to the optimizer’s state requirements.

Code playground (Python)