Fine-Tuning, and When Not ToLesson 12 of 84

Module 2 · How training actually works

Optimisers, and what their state costs

In this lesson

  • 9 min read
  • 5 reading sections
  • Knowledge check
  • Lesson 3 of 9 in this chapter

This chapter’s goalTrace one optimisation step from a batch of tokens to a changed weight, and predict which way loss, memory and stability move when you change the learning rate, the batch size, the precision or the number of epochs.

This chapter’s media

The film explains chapter ideas. The audiobook narrates the complete teaching text.

FormatEnglishहिंदी
Chapter filmNot availableNot available
Full audiobookNot availableNot available

A little at a time

Explore an idea, try it, then check what stays.

Step 1 of 6Free · no account needed
Lesson steps

Why not plain gradient descent

The simplest update is w -= lr * grad. It works, badly, on deep networks: different parameters have gradients of wildly different magnitudes, so any single learning rate is too large for some and too small for others.

Adam fixes this per parameter, by keeping two running averages:

  • m, an exponential moving average of the gradient itself: momentum. It smooths the noise from batch to batch.
  • v, an exponential moving average of the gradient squared: a running estimate of that parameter’s typical magnitude.

The update divides by the square root of v, so a parameter whose gradients are consistently tiny still takes a meaningful step, and one whose gradients are consistently huge takes a small one. This is what makes transformer training work at all with one global learning rate.

Text
m = β₁·m + (1-β₁)·g
v = β₂·v + (1-β₂)·g²
w = w - lr · m̂ / (√v̂ + ε)

Your place and first choices stay on this browser. Classroom credit is recorded separately.

Every lesson here is open. Your progress is recorded once you pass the Running Models Yourself exam.

Stuck on something?Ask Rafael, your AI tutor

How to cite: Addaly (2026) ‘Optimisers, and what their state costs’, in Fine-Tuning, and When Not To. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/fine-tuning/optimisers-and-their-memory (Accessed: 29 November 2026).