EasyDeepLearn

Write Adam's full update rule.

medium

Answer

  • mt  =  β1    mt1  +  (1β1)    gtm_{t}\; = \;{\beta}_{1}\; \cdot \;m_{t} - 1\; + \;(1 - {\beta}_{1})\; \cdot \;g_{t} (first moment); vt  =  β2    vt1  +  (1β2)    gt2v_{t}\; = \;{\beta}_{2}\; \cdot \;v_{t} - 1\; + \;(1 - {\beta}_{2})\; \cdot \;g_{t}^{2} (second moment).
  • Bias-corrected: mhat  =  mt  /  (1    β1t)m_{\mathrm{hat}}\; = \;m_{t}\; / \;(1\; - \;{\beta}_{1}^{t}), vhat  =  vt  /  (1    β2t)v_{\mathrm{hat}}\; = \;v_{t}\; / \;(1\; - \;{\beta}_{2}^{t}).
  • Update: θ ← θ    η    mhat  /  (sqrt(vhat)  +  ε){\theta}\; - \;{\eta}\; \cdot \;m_{\mathrm{hat}}\; / \;(\mathrm{sqrt}(v_{\mathrm{hat}})\; + \;{\varepsilon}).
  • Defaults: β1=0.9{\beta}_{1} = 0.9, β2=0.999{\beta}_{2} = 0.999, ε=1e-8.
  • Combines momentum and per-param LR — robust default optimizer.
Check yourself — multiple choice
  • Adam uses only the second moment
  • Adam maintains EMAs of g (m) and g2g^{2} (v), applies bias correction, updates θ - η·m̂/√v̂
  • Adam is deterministic
  • Adam removes momentum

Adam: EMA of g and g2g^{2}, bias-corrected → per-param LR + momentum.

#optimizers

Practise Deep Learning

214 interview questions in this topic.

Related questions