liveBook · Manning

Adam

As explained in How Large Language Models Work

Adam is an adaptive stochastic-gradient optimization algorithm that maintains estimates of gradient moments to adjust parameter updates.

Adam is an adaptive form of stochastic gradient descent. It keeps momentum from earlier updates, helping parameters move faster toward lower loss and sometimes pass a small local minimum. section 4.1.2

Adam trades training memory for potentially more effective optimization:

  • It can minimize the loss function faster and reduce the chance of getting stuck in a local minimum. section 4.1.2
  • It stores momentum information for each parameter, raising memory requirements to about three times those of plain SGD. section 4.1.2
  • That extra information can be discarded after training, but the larger training system is still required beforehand. section 4.1.2

A ball rolling down a loss curve

Imagine gradient descent as a ball moving downhill. Adam gives the ball momentum: repeated movement in one direction makes it roll faster and may carry it past a shallow dip instead of leaving it at a local minimum. section 4.1.2

Figure 4.5 The gradient descent algorithm takes steps to adjust parameters to find the optimal outcome with the least loss. Unfortunately, the algorithm gets stuck in a local minimum, an area of the graph that is not optimal because other parameter values correspond to areas with a lower loss.
figure

See how ordinary gradient descent can stop at a local minimum, clarifying the problem Adam’s momentum is intended to help address. section 4.1.2

How How Large Language Models Work covers it

How deep it goes
Explains momentum, local minima, and memory cost through analogy, but stops short of equations or update rules.
Examples
Uses a ball rolling down a loss curve and figures showing parameters, global minima, and local minima.
What it assumes
Builds from gradient descent and stochastic gradient descent before describing Adam’s added momentum.
What you can do after
Evaluate Adam’s optimization benefit against its substantially higher training-memory requirement.
How it connects
Connects Adam with stochastic gradient descent, gradient descent, loss functions, local minima, neural networks, and parameters.

Also explained in

Compare how 7 books explain adam →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of How Large Language Models Work. The section links point to the parts of the book it draws on.