What is weight decay in neural network training?

Quick Overview

Explain what weight decay does during neural network training and how it relates to L2 regularization. Tests understanding of the update rule, why Adam and AdamW behave differently, the interaction with normalization layers, and practical settings such as decay strength and excluded parameters.

What is weight decay in neural network training?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: easy

Interview Round: Other

What is weight decay in neural network training? ```hint Write the update Write one gradient-descent step for a loss with an added penalty $\tfrac{\lambda}{2}\lVert w\rVert^2$, then ask whether the same thing happens when the optimizer rescales each gradient, as Adam does. ``` ### What a Strong Answer Covers - The update rule and what it does to the weights at each step - How weight decay relates to L2 regularization under plain SGD and under adaptive optimizers, and what AdamW changes - Why smaller weights reduce overfitting, and how normalization layers change that picture - Practical settings: typical strengths and which parameters to leave out ### Follow-up Questions - In PyTorch, what is the difference between `Adam(weight_decay=0.01)` and `AdamW(weight_decay=0.01)`? - A convolution is followed by BatchNorm, so scaling its weights leaves the output unchanged. What does weight decay do to that layer? - If you double the learning rate in AdamW, what happens to the per-step decay, and should you retune it? - Why are biases and normalization parameters usually excluded from decay?

Overview: Explain what weight decay does during neural network training and how it relates to L2 regularization. Tests understanding of the update rule, why Adam and AdamW behave differently, the interaction with normalization layers, and practical settings such as decay strength and excluded parameters.

General logo
General
Nov 25, 2026
easyMachine Learning EngineerOtherMachine Learning
0
0

What is weight decay in neural network training?

What a Strong Answer Covers Guidance

  • The update rule and what it does to the weights at each step
  • How weight decay relates to L2 regularization under plain SGD and under adaptive optimizers, and what AdamW changes
  • Why smaller weights reduce overfitting, and how normalization layers change that picture
  • Practical settings: typical strengths and which parameters to leave out

Follow-up Questions Guidance

  • In PyTorch, what is the difference between Adam(weight_decay=0.01) and AdamW(weight_decay=0.01) ?
  • A convolution is followed by BatchNorm, so scaling its weights leaves the output unchanged. What does weight decay do to that layer?
  • If you double the learning rate in AdamW, what happens to the per-step decay, and should you retune it?
  • Why are biases and normalization parameters usually excluded from decay?