L2 Regularization
Reduce extreme weights while retaining useful signals across many features.
L2 Regularization explained visually
Use a load-bearing bridge to compare smooth L2 shrinkage with sparse L1 behavior.
What you will learn
Recognize overfitting and improve generalization with dropout, regularization, and augmentation.
Penalize squared weights
L2 makes large weights especially expensive by adding their squared values to the objective.
Shrink smoothly
Unlike L1, L2 normally reduces weights without forcing many connections exactly to zero.
Distribute influence
Several useful features can remain active while no single weight becomes unnecessarily dominant.
Find a balance
Validation results help choose a lambda that limits noise without causing underfitting.
Quick check: test your understanding
How does L2 treat large weights?
It penalizes them strongly through their squared values.
Does L2 normally create many zero weights?
No; it usually shrinks weights smoothly.
How is lambda selected?
By comparing validation performance.
Accessible referenceLesson 21 transcript220 words · Matches the published narration and captionsOpen transcript
Suppose a bridge distributes its load across many supports instead of placing extreme pressure on one beam. L2 regularization encourages a model to distribute influence in a similar way.
L2 adds a penalty based on the squared values of the weights. Because squaring makes large weights especially expensive, optimization tends to shrink extreme values.
Unlike L1, L2 usually does not force many weights exactly to zero. It keeps the features available while reducing their individual influence. This makes L2 useful when many features contain some helpful information.
Return to the house-price example. Floor area, neighborhood, age, and condition may all matter. L2 can retain each signal while preventing one coefficient from becoming unnecessarily dominant.
Lambda again controls the regularization strength. With no penalty, a flexible model may fit noise. With excessive penalty, the weights become too small and the model cannot capture the real pattern. Validation results help locate a useful balance.
L1 and L2 therefore create different behavior. L1 often creates sparse models and can remove connections. L2 produces smoother shrinkage and usually retains them. Neither method automatically wins every problem.
Both methods aim to improve performance beyond the training set by limiting fragile weight patterns. Our final lesson adds variety from another direction. Instead of changing the weights directly, data augmentation creates useful variations of the training examples.