Skip to content
Glacius
OptimizationConcept reference

Adam updates

Adam scales each corrected first moment by the square root of its corrected second moment plus the stated ε.

On this page 8 sections
  1. Overview
  2. Understand the idea
  3. For a vector, use each coordinate’s own corrected moments
  4. The numerator is the corrected first moment, which includes history
  5. For a neural-network weight vector, each coordinate has its own two moments
  6. Key takeaway
  7. Sources & further reading
  8. Concept connections

01Understand the idea#

Adam is an optimizer that combines gradient memory with a separate update scale for each parameter. Its corrected first moment is a signed average of gradients; its corrected second moment summarizes squared gradient size. Together they determine a proposed update.

The hats on m^\hat m and v^\hat v mean the initialization correction has already been applied. In this lesson those corrected values are supplied. You will combine them, the learning rate, and epsilon to find the new parameter, without rebuilding the earlier moment history.

Adam combines a corrected first moment with coordinatewise scaling from a corrected second moment. Here both corrected moments are already supplied:

θj=θjηm^jv^j+ϵ\theta_j\prime=\theta_j-\eta\frac{\hat m_j}{\sqrt{\hat v_j}+\epsilon}

With θ=5, m̂=4, v̂=9, η=0.2 and ε=1, the divisor is 4. The step is 0.2, so θ′=4.8.

At θ=5, corrected moments m=4,v=9, rate .2 and epsilon 1 give denominator sqrt(9)+1=4. The displacement is −.2×4/4=−.2 and the new parameter is 4.8. Horizontal distances are numerical.At θ=5, corrected moments m=4,v=9, rate .2 and epsilon 1 give denominator sqrt(9)+1=4. The displacement is −.2×4/4=−.2 and the new parameter is 4.8. Horizontal distances are numerical.
Figure 1At θ=5, corrected moments m=4,v=9, rate .2 and epsilon 1 give denominator sqrt(9)+1=4. The displacement is −.2×4/4=−.2 and the new parameter is 4.8. Horizontal distances are numerical.
Link to this figure ↗Download SVGDownload PNG

For θ=5\theta=5, m^=4\hat m=4, v^=9\hat v=9, η=0.2\eta=0.2, and ϵ=1\epsilon=1, compute the denominator first: 9+1=4\sqrt9+1=4. The normalized moment is 4/4=14/4=1, the step is 0.2(1)=0.20.2(1)=0.2, and the new parameter is 50.2=4.85-0.2=4.8. Epsilon is deliberately large here to make its location visible.

Check your reasoning

Use θ=θηm^/(v^+ϵ)\theta\prime=\theta-\eta\hat m/(\sqrt{\hat v}+\epsilon). Corrected moments supplied: (θ,m̂,v̂,η,ε)=(3, 8, 9, 0.5, 1). Find θ′.

Show answer and explanation
2

Divisor 4; new parameter 2.

02For a vector, use each coordinate’s own corrected moments#

For a vector, use each coordinate’s own corrected moments. The first moment supplies a signed direction; the square-root second moment supplies scale.

These inputs have already been bias corrected. Do not divide them by a correction factor a second time.

Check your reasoning

Use θ=θηm^/(v^+ϵ)\theta\prime=\theta-\eta\hat m/(\sqrt{\hat v}+\epsilon). Corrected: θ=(5,2)(5, 2), m̂=(6,4)(6, -4), v̂=(4,1)(4, 1), η=0.5, ε=1. Find θ′.

  1. A(4,3)(4, 3)
  2. B(4,4)(4, 4)
  3. C(5,3)(5, 3)
Show answer and explanation
(4,3)(4, 3)

Steps (1,−1); θ′=(4,3).

03The numerator is the corrected first moment, which includes history#

The numerator is the corrected first moment, which includes history. Substituting the current gradient would produce a different update.

This lesson computes the stated step. The formula alone does not establish that Adam outperforms every other optimizer or guarantees convergence in every setting.

Check your reasoning

Use θ=θηm^/(v^+ϵ)\theta\prime=\theta-\eta\hat m/(\sqrt{\hat v}+\epsilon). Corrected (θ,m̂,v̂,η,ε)=(4, 2, 1, 0.5, 1); current g=6. Draft uses g as numerator. Correct θ′.

Show answer and explanation
3.5

Use m̂=2, not g=6: θ′=3.5.

04For a neural-network weight vector, each coordinate has its own two moments#

For a neural-network weight vector, each coordinate has its own two moments. A negative first moment can increase the corresponding weight because the update subtracts a negative number. Adam still has a learning rate and is not guaranteed to outperform every other optimizer on every task.

Key takeaway

Use the supplied corrected moments once, preserve ε outside the root, and update each coordinate.

  • Compute an Adam parameter update from supplied bias-corrected moment estimates.

Sources & further reading

  1. [1]
    Kingma & Ba Algorithm1 parameter updateKingma & Ba Algorithm1 parameter update · Article

Reference this concept

Link to this page, a section, or an individual figure.

Glacius. “Adam updates.” Math behind ML. /learn/o-adam