AdamW: Why not put L2 in a gradient when weight decline

L2 is directly related to the multiplication weight decay under certain conditions of the normal gradient decline; Adds the L2 item to the gradient and the independent decay parameter is no longer the same price after the gradient has been scaled.

• Step by stepCollate in 2 self-measured2 First-hand sources
Start Body
Learning objectives and first steps2 objectives . 1 first fix

Try to do it after reading

  • Explain AdamW: why weight decay does not amount to a mechanism and premise for inserting L2 into a gradient
  • Positioning the mechanism ' s fault limits with fixed examples

Suggested first

  • Since Adaptation Gradient and Regularization

Issues and mechanisms

L2 is directly related to the multiplication weight decay under certain conditions of the normal gradient decline; Adds the L2 item to the gradient and the independent decay parameter is no longer the same price after the gradient has been scaled. AdamW will reduce the decoupling of the decomposition and self-adaptation, making the meaning of the decomposition intensity clearer. The combination of the two can't be achieved simply because the names are positive.

Simplifiedly, the decoupling update contains the old parameters that contract according to the learning rate and the decay factor, minus the orientation of the adjustment gradient. If the L2 entry enters the gradient first, it will also be subject to passive measure and denominator scaling effects. The decline of the arguments of bias, reclassification and so forth also needs to be defined by the training formula, and the error in the grouping of parameters may lead to experimental differences coming from groups rather than algorithms.

A concrete example

Synthetic parameter 10, learning rate 0.1, decay 0.01, the individual decay component changes the parameter to 9.99, and the data gradient is updated. If the self-adaptation denominator is ten, then the L2 gradient of 0.1 is divided by ten and then multiplied by the learning rate, which results in only a contraction of 0.001, whereas the decoupling component is 0.01, which is different. The difference is explained here by the fixed denominator, not the full Adam dynamic run.

Borders and checks

A comparison of the optimisers should be based on a fixed learning rate plan, batches, effective targets and parameter groups, avoiding general advantages and disadvantages from un-recruited baselines. Restoring training also requires the preservation of momentum, square statistics and steps; New optimizers are used only after the weight is restored, and not the same trajectory continues. Views the actual optimiser default values more reliable than guesses by name.

A method of verification

The reduction can be tested separately when the data gradient is zero, the expected contraction can be calculated by parameter values, learning rates and coefficients, and a fixed gradient test self-adaptation component can be added. If certain objects in the parameter group are excluded from decay, the zero gradient test shall remain unchanged. The restorer should also compare the first step of updating and running continuously, and not only the status dictionary exists. For self-adaptation methods, changes in momentum and steps affect updates and cannot simplify all mechanisms with one parameter difference.

Check understanding

Does a change in learning rate affect the decay of AdamW?

In the common updated definition, the decay is multiplied by the learning rate. Learning rate plans and decay factors should be recorded together.

Is it certain that the uniform decay for all parameters is correct?

Not necessarily. Task formulas may use different groups for bias or reclassification parameters, and must clarify rules and check actual lists, and cannot rely on vague defaults.

Sources and reconciliations

Definitions, methods and interfaces are available.

  1. Decoupled Weight Decay Regularization
  2. Stanford CS336 — Language Modeling from Scratch, Spring 2025

Figures and calculations are reorganized according to this chapter. Mathematical measurements, framework operations and real business effects are described separately in the body of the text.

← Back to the knowledge directory
Ask Max Ask about this site
Ask Max ↗

Opening the assistant…

Paper figure

Photo comments

LEAVE A NOTE

About this photograph

Connecting to the discussion board…

    Comments become public after moderation. You can delete your own comments from this browser.
    No email is required. Clearing cookies prevents this browser from claiming earlier comments.

    MAX WANG / INDEX

    Find something

    Enter a keyword, or explore the directory below.