Foundations to Frontier
Tests
E. Deep Learning › E3 Optimizers (one page each)

Nadam

Nadam is Adam with Nesterov momentum: instead of stepping along the current averaged gradient, it steps along the momentum it is about to have, which gives the current gradient extra weight and lets the optimiser react a little sooner when the gradient changes direction. Dozat proposed it in 2016; it is a drop-in replacement for Adam. This page covers the update, how the look-ahead changes the numerator, its relation to Nesterov's method and when it helps. In the exercises you show that Nadam's numerator follows a sign change one step sooner, then compare Nadam and Adam at equal learning rates: on quadratics the difference was at most three steps, while on a small network Nadam was never slower and usually a little faster.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Adam with a look-ahead

Nesterov’s trick for momentum (E3-3) was to look where the momentum is about to take you before deciding the step. Nadam brings the same idea to Adam. Its step uses the momentum it will have after this update, in which the current gradient counts for more. When the gradient direction changes, Nadam notices a step earlier than Adam. Everything else (the per-parameter scaling, the defaults) is the same.

Optimizer lab: Nadam versus plain gradient descent
Nadam: final loss 7.3e-6 (target reached at step 52) · gradient descent: final loss 2.2e-9 (step 22)
Orange: the chosen optimizer; grey dashed: plain gradient descent with the same learning rate. Darker shading means higher loss. On the ill-conditioned bowl, raise κ and watch gradient descent zig-zag across the narrow direction; on the saddle it stalls near the flat start; on the plateau its gradients are tiny. Adaptive methods rescale each direction; momentum methods build speed along consistent directions. The target is 1% of the starting loss (for the saddle, a loss below −0.2; its minima are at −0.25).
Why engineers care

Nadam is a one-line swap for Adam that is available in every framework, often gives a small speed-up, and rarely hurts. It is a useful option when training is slow to respond, for example when tracking changes in an online model or fine-tuning a controller network.

📝 Quick check (Level 0)
0/3 answered
  1. 1. Nadam combines Adam with…
  2. 2. Compared with Adam, Nadam weights the current gradient…
  3. 3. Switching from Adam to Nadam usually needs…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

By hand

  • Adam’s numerator: m̂ = m/(1 − β₁ᵗ).
  • Nadam’s numerator (Dozat): β₁m/(1 − β₁ᵗ⁺¹) + (1 − β₁)g/(1 − β₁ᵗ). The first term is the momentum one step ahead; the second adds the current gradient’s share.
  • Example at t = 1 with β₁ = 0.9 and g = 2: m = 0.2, so the numerator is 0.9 × 0.2/0.19 + 0.2/0.1 ≈ 0.947 + 2 = 2.947, against Adam’s 2.
  • Weight on the current gradient late in training: 0.1 for Adam; 0.19 for Nadam (0.1 from the look-ahead term plus 0.9 × 0.1 through β₁m).
  • Constant gradient: both numerators tend to g, so the long-run step is the same.
  • Denominator: identical to Adam’s, √v̂ + ε.
📝 Quick check (Level 1)
0/3 answered
  1. 1. Late in training, Nadam's weight on the current gradient (β₁ = 0.9) is…
  2. 2. Under a constant gradient, Nadam's numerator tends to…
  3. 3. Nadam changes Adam's…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.

Nadam in code

Exercise 1.

  • Under a constant gradient, the two numerators agree.
  • When the gradient flips sign after 30 steps, Adam’s numerator turns negative after 7 steps and Nadam’s after 6. The look-ahead makes it one step faster to follow a change of direction.

Practice.

  • Use the same hyperparameters as Adam (η = 10⁻³, β₁ = 0.9, β₂ = 0.999).
  • PyTorch’s NAdam also applies Dozat’s momentum-decay schedule, μₜ = β₁(1 − ½·0.96^(t·ψ)) with ψ = 0.004, so its early momentum is slightly lower than Adam’s. The simple form used here leaves that out.
  • For decoupled weight decay, PyTorch supports decoupled_weight_decay=True (NAdamW).
torch.optim.NAdam(params, lr=2e-3, betas=(0.9, 0.999), momentum_decay=4e-3)
🐍 Exercise 1: Nadam's look-ahead numerator
Implement Adam's and Nadam's numerators and compare how quickly they follow a change in the gradient's sign.
📝 Quick check (Level 2)
0/3 answered
  1. 1. After a sign flip, Nadam's numerator follows…
  2. 2. PyTorch's NAdam additionally applies…
  3. 3. Nadam's default learning rate in PyTorch is…

Level 3: Advanced

★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.

Theory

From Nesterov to Nadam. Nesterov momentum can be rewritten so that the gradient is evaluated at the current point and the look-ahead is applied to the momentum: step along β·m_new + g instead of m_new (Sutskever et al., 2013). Dozat (2016) applied this rewriting to Adam’s first moment, giving β₁m̂ₜ₊₁-style terms plus the current gradient, with the bias corrections adjusted accordingly.

What it buys.

  • On a quadratic with constant curvature, the improvement is small in the adaptive (Adam) regime, because Adam’s per-coordinate normalisation already removes most of the ill-conditioning that Nesterov acceleration targets.
  • Its main effect is responsiveness: more weight on the current gradient means less lag when the landscape changes, which helps in non-stationary or curved regions, as in network training.

No new guarantees. Nadam inherits Adam’s convergence caveats (E3-9). It is an empirical refinement rather than a theoretically accelerated method.

📝 Quick check (Level 3)
0/3 answered
  1. 1. Nadam was proposed by…
  2. 2. On quadratics Nadam's gain over Adam is small because…
  3. 3. Nadam's convergence guarantees compared with Adam's are…

Level 4: Expert

★★★★★ Expert⏱ 25 minResearchers: original papers and open problems.

Is the look-ahead worth it?

History.

  • Y. Nesterov (1983) introduced accelerated gradients.
  • I. Sutskever et al. (2013) reformulated Nesterov momentum for deep learning.
  • T. Dozat (2016) introduced Nadam and found it faster than Adam on word-embedding and language-model tasks.
  • Nadam is available in Keras, TensorFlow and PyTorch.

Exercise 2. Adam and Nadam at learning rates 0.003, 0.01 and 0.03 on three problems, counting steps to a target:

  • a 20-dimensional quadratic with κ = 100 (loss below 10⁻³ of its start);
  • the same with gradient noise (below 5%);
  • a 2–32–32–3 tanh network on spirals with mini-batches of 64 (training loss below 0.1, checked every 10 steps).
problem method η = 0.003 η = 0.01 η = 0.03
quadratic Adam 2378 801 261
quadratic Nadam 2377 799 259
noisy quadratic Adam 782 233 74
noisy quadratic Nadam 782 232 72
network, seed 0 Adam 290 120 70
network, seed 0 Nadam 280 110 50
network, seed 1 Adam 270 100 60
network, seed 1 Nadam 260 90 50
network, seed 2 Adam 270 110 60
network, seed 2 Nadam 260 100 50
  • Nadam was never slower than Adam.
  • On the quadratics the difference was at most three steps. Adam’s normalisation leaves little for the look-ahead to fix.
  • On the network Nadam was consistently a little faster, usually by one 10-step check interval (3–29% fewer steps), in all three seeds and in two further seeds.
  • It is a cheap, safe refinement, worth trying when Adam is slow to respond, but not a large speed-up.
🐍 Exercise 2 (research): is the look-ahead worth it?
Compare Adam and Nadam at three learning rates on a quadratic, a noisy quadratic and a small network over three seeds, counting steps to a target loss.

Nadam in AI, robotics and aerospace

  • Drop-in for Adam in perception and control networks when faster response is wanted.
  • Online fine-tuning: the extra weight on the current gradient helps models adapt sooner after changes.
  • Recurrent and language models were Nadam’s original testbed (Dozat, 2016).

References

  1. T. Dozat (2016). “Incorporating Nesterov momentum into Adam.” ICLR Workshop.
  2. I. Sutskever, J. Martens, G. Dahl, G. Hinton (2013). “On the importance of initialization and momentum in deep learning.” Proc. ICML.
  3. D. P. Kingma, J. Ba (2015). “Adam: a method for stochastic optimization.” Proc. ICLR.