Skip to content
mlmentorship

Why does Adam sometimes generalize worse than SGD?

Separate measured optimizer performance from coordinate-dependent sharpness, decay coupling and unequal tuning or resource budgets.

Published · 6 min read ·Core ·Mixed

Systems / infrastructure · active recall

Practice before you read

35 minutes. Quantify the workload, identify the bottleneck, choose an architecture, and design failure recovery.

Systems / infrastructure · closed-book attempt

Why does Adam sometimes generalize worse than SGD?

Quantify the workload, identify the bottleneck, choose an architecture, and design failure recovery.

Problem

Context. A workload appears to generalize differently under two optimizers; the coordinate-change fixture below probes one proposed sharpness explanation. Task. Design a fair comparison, separate observed performance from its explanation, and analyze whether reparameterization changes the predictor's outputs. Identify evidence that would support or reject a proposed mechanism. Constraints. Make data splits, initialization, tuning budgets, schedules, and regularization conventions explicit. Parameter-space curvature depends on coordinates; do not treat it alone as proof of different function-space behavior or generalization. A toy predictor outputs $w$, with loss $L(w)=(w-1)^2/2$. Reparameterize it as $w=10\phi$. Compare the equivalent minima $w=1$ and $\phi=0.1$. Does a sharper parameter-space curve imply different predictions?

35:00recommended time

Closing or reloading clears the scratchpad. Only score, weak rubric dimensions, attempt count, and retry date can be stored locally.

Reading depth

Compare Adam and SGD through controlled optimization and generalization experiments rather than assuming one optimizer universally wins.

Problem

Context. A workload appears to generalize differently under two optimizers; the coordinate-change fixture below probes one proposed sharpness explanation.

Task. Design a fair comparison, separate observed performance from its explanation, and analyze whether reparameterization changes the predictor’s outputs. Identify evidence that would support or reject a proposed mechanism.

Constraints. Make data splits, initialization, tuning budgets, schedules, and regularization conventions explicit. Parameter-space curvature depends on coordinates; do not treat it alone as proof of different function-space behavior or generalization.

A toy predictor outputs , with loss . Reparameterize it as . Compare the equivalent minima and . Does a sharper parameter-space curve imply different predictions?

The sharpness caveat

The basin gets sharper without changing the model's predictions

A stretched coordinate makes the same basin look sharperThese two parameter coordinates represent the same scalar prediction error. Curvature alone is not invariant to reparameterization.The same prediction has differentcoordinate labelsCoordinate a: prediction equals a01234Coordinate b: a = 2b00.511.52Same prediction a=2, b=1; same lossfour.Coordinate curvatures differ: twoversus eight.
Derivation
Exact quadratic profiles under w equals ten times phi Both plots use the same numerical horizontal perturbation scale and the same loss scale. The upper profile is one half delta w squared, with curvature one. The lower is fifty delta phi squared, with curvature one hundred, clipped to its plot. Both minima represent the same constant predictor one and have loss zero. Changing parameter coordinates changed curvature without changing predictions. PARAMETERIZATION A · BROAD PROFILE loss Δw: -0.5 to +0.5 curvature 1 w = 10φ same function and predictions PARAMETERIZATION B · NARROW PROFILE loss Δφ: -0.5 to +0.5 curvature 100 apparent sharpness changed; model behavior did not
Read it this way: coordinate curvature changes from one to one hundred. Both minima still predict one. These exact toy curves show coordinate dependence, not measured optimizer performance.
Check: Did predictions change when the plotted basin became sharper?
Read it this way: These two parameter coordinates represent the same scalar prediction error. Curvature alone is not invariant to reparameterization.
Does relabeling a=2b alter the represented scalar prediction?

Reparameterization caveat: Dinh et al. (2017). This scalar construction is calculated independently.

Calculate the curvature

In coordinates, . In coordinates, , so . The same predictor has the same performance on any fixed evaluation set. Raw coordinate sharpness alone therefore cannot establish worse generalization. This does not prove every normalized sharpness measure is useless.

Establish the comparison

Record data splits, architecture, augmentations, initialization, batch, precision, schedules, decay and the resource budget. Give both optimizer families a declared tuning opportunity. Select on validation evidence, then compare on independent evaluation with a planned repetition and uncertainty rule.

ClaimEvidence neededAlternative explanationDiscriminating check
One optimizer generalizes betterHeld-out results under the comparison contractUnequal tuning or augmentationMatch opportunity and repeat
The gap is caused by sharpnessA defined measure with coordinate controlsReparameterization changes curvatureTest equivalent predictors
AdamW fixes the entire gapWorkload-specific tuned comparisonsSchedule or decay changed tooSeparate those interventions

Change the comparison

1. Limit elapsed time

New task: choose a procedure under a one-hour training budget, not equal steps.

Picture and change: compare quality at the deadline and record steps, tokens and overhead. Match tuning opportunity as well as final-run time.

Check: hypothetical step times of and seconds permit versus steps, ignoring overhead. Quality after steps alone cannot decide the one-hour question.

Use when: time or compute limits the real decision.

2. Separate adaptive decay from independent shrinkage

New task: determine whether a comparison changes regularization as well as optimizer family.

Picture and change: a coupled penalty adds before adaptive scaling. Decoupled decay shrinks parameters independently of that scaling. Even holding a diagonal step scale fixed, the updates differ:

Check: with , , and , results are versus . In Adam, the coupled term also enters the accumulated moments.

Use when: isolating decay effects. Retune appropriate strengths before attributing the gap to moment normalization.

Unequal search can create the gap

One family receiving a large rate sweep while another receives one default does not isolate optimizer quality. AdamW changes the update, but does not guarantee better generalization everywhere.

Try interpreting equal training loss

Does equal training loss plus a sharper-looking minimum establish worse generalization?

Check your answer

No. Measure independent predictive performance and define the curvature measure and its coordinate dependence.

Workload and batch regime

Vision, language and large-batch workloads require specific comparison evidence. Neither optimizer family wins by definition, and Adam is not identical to AdamW. Decoupled weight decay changes adaptive regularization; its benchmark results are not universal rankings. LAMB adds layer-wise adaptation for large-batch training under a particular recipe. Its existence does not show that ordinary Adam or SGD always fails above a fixed batch size. Gradient-noise and implicit-bias explanations need defined assumptions and tests, not just a valley illustration.

Common follow-up

For an AdamW schedule, state the intended horizon, warmup, peak, final rate and selection procedure. Warmup-plus-cosine and stable-plus-final-decay are alternatives to test under matched budgets. Fixed warmup fractions and rate multipliers are not universal guarantees.

Related: Adam and AdamW, learning-rate selection and regularization.