Deep learning basics — weight decay
Published in
2 min readSep 4, 2020
What is weight decay?
Weight decay is a regularization technique by adding a small penalty, usually the L2 norm of the weights (all the weights of the model), to the loss function.
loss = loss + weight decay parameter * L2 norm of the weights
Some people prefer to only apply weight decay to the weights and not the bias. PyTorch applies weight decay to both weights and bias.
Why do we use weight decay?
- To prevent overfitting.