Adam Optimizer › Adam Hyperparameters

Michael BrenndoerferApril 24, 20253 min read
Language AI HandbookAll chapters
Part 10 of 67Neural Network Foundations
Chapter 68Adam Optimizer › Adam Hyperparameters
Reading section 9 of 18 · Adam Hyperparameters · 3 minSection 9 of 18 · 3 min

Book contents

Section 9 of 18 · 3 min read

Adam Optimizer › Adam HyperparametersOne section · Sections in this chapter9 / 18 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

Adam has four hyperparameters: α\alpha, β1\beta_1, β2\beta_2, and ϵ\epsilon. Understanding what each controls helps you diagnose training problems.

Learning Rate α\alpha

The learning rate remains the most important hyperparameter. Adam's default of α=10−3\alpha = 10^{-3} works for a surprisingly wide range of tasks, but you should expect to tune it. Rules of thumb:

  • Start with α=10−3\alpha = 10^{-3} for new problems
  • If training loss explodes or diverges immediately: reduce by 10x
  • If training is too slow after 10% of planned epochs: increase by 3-10x
  • Use a learning rate finder (warm-up scan) to identify the range of valid learning rates

One important difference from SGD: Adam's effective per-parameter learning rate is α/(v^t+ϵ)\alpha / (\sqrt{\hat{v}_t} + \epsilon). When you change the global α\alpha, you are scaling all per-parameter learning rates proportionally. The adaptive normalization means Adam is generally less sensitive to the precise choice of α\alpha than SGD is, but the relative magnitudes still matter.

β1\beta_1: First Moment Decay

β1\beta_1 controls how much past gradients influence the current update direction. With β1=0.9\beta_1 = 0.9 (default), the effective momentum window is approximately 1/(1−0.9)=101 / (1 - 0.9) = 10 steps. This means Adam averages gradient direction over the last ~10 steps.

Lowering β1\beta_1 makes Adam respond more quickly to recent gradient changes, which can help in non-stationary settings but increases noise. The default 0.9 is almost never worth changing. Some practitioners use β1=0\beta_1 = 0 (effectively no momentum) for specific research experiments to isolate the adaptive learning rate effect, but this is rarely beneficial in practice.

β2\beta_2: Second Moment Decay

β2\beta_2 controls how long Adam remembers past gradient magnitudes. With β2=0.999\beta_2 = 0.999 (default), the effective window is 1/(1−0.999)=10001 / (1 - 0.999) = 1000 steps. The second moment tracks a much longer history than the first moment.

This asymmetry is intentional: you want the denominator to be a stable estimate of the gradient's typical magnitude, not one that jumps around with each new batch. However, β2=0.999\beta_2 = 0.999 can be slow to adapt if the gradient scale changes dramatically during training (for example, when learning rate warm-up causes a large jump in gradient norms). In such cases, β2=0.99\beta_2 = 0.99 or even 0.980.98 can respond faster.

In transformer training, β2=0.98\beta_2 = 0.98 has been found to work better than the default 0.999 in some settings (the original "Attention Is All You Need" paper used β2=0.98\beta_2 = 0.98).

ϵ\epsilon: Numerical Stability

As discussed above, ϵ=10−8\epsilon = 10^{-8} is the default. For float16 training, ϵ=10−6\epsilon = 10^{-6} or 10−510^{-5} is often more stable.