Skip to content
Query Feedz
  • News
  • Business
    • Digital Marketing
      • Marketing & Sales
      • SEO
      • Content Marketing
      • AEO and GEO
    • Startups
      • Founder Stories
      • Funding & VC
      • Product & Growth
    • Money
      • Investing
      • Markets & Economy
      • Saving & Budgeting
  • AI & Technology
    • Technology
      • Consumer Tech
      • CRM
      • Cyber Security
      • Software Engineering
      • WordPress
      • Hardware
    • Artificial IntelligenceAI Glossary
      • LLMs
      • Machine Learning
      • AI Fundamentals
      • Generative AI
      • Deep Learning
    • AI Use Cases
      • Automation
      • Content
      • Customer Support
      • Finance
      • Marketing
      • View All
  • Tools & Software
  • Account
    • Submit Guest Post
    • Submit a tool
    • My listing
  • Contact
QueryFeedz
  • News
  • Business
    • Digital Marketing
      • Marketing & Sales
      • SEO
      • Content Marketing
      • AEO and GEO
    • Startups
      • Founder Stories
      • Funding & VC
      • Product & Growth
    • Money
      • Investing
      • Markets & Economy
      • Saving & Budgeting
  • AI & Technology
    • Technology
      • Consumer Tech
      • CRM
      • Cyber Security
      • Software Engineering
      • WordPress
      • Hardware
    • Artificial IntelligenceAI Glossary
      • LLMs
      • Machine Learning
      • AI Fundamentals
      • Generative AI
      • Deep Learning
    • AI Use Cases
      • Automation
      • Content
      • Customer Support
      • Finance
      • Marketing
      • View All
  • Tools & Software
  • Account
    • Submit Guest Post
    • Submit a tool
    • My listing
  • Contact
QueryFeedz
  1. Home /
  2. AI Glossaries /
  3. Machine Learning /
  4. What is L2 Regularization?
Machine Learning

What is L2 Regularization?

Updated October 2, 2026 Read 3 min

L2 regularization adds a penalty equal to the sum of the squared weights, shrinking all weights smoothly towards zero without eliminating any. It is known as ridge regression in linear models and weight decay in neural networks.

Contents 13
  1. 01Key takeaways
  2. 02L2 explained in simple terms
  3. 03How it works
  4. 04A worked example
  5. 05Why large weights are a problem
  6. 06L2 in neural networks: weight decay
  7. 07L1 vs L2
  8. 08Choosing λ
  9. 09When L2 is the right choice
  10. 10Limitations
  11. 11Common Use Cases
  12. 12Frequently Asked Questions
  13. 13Related Terms

L2 regularization adds a penalty equal to the sum of the squared weights, shrinking them smoothly towards zero without setting any to exactly zero. In linear models it is called ridge regression; in neural networks it is usually called weight decay. It is the most widely used form of regularization in deep learning.

Key takeaways

  • Penalty = λ × sum of weights squared.
  • It shrinks all weights proportionally; none become exactly zero.
  • It handles correlated features gracefully by spreading weight across them.
  • In neural networks it appears as weight decay, standard in AdamW.
  • It reduces variance at the cost of a small increase in bias.

L2 explained in simple terms

Packing for a trip where you pay by total weight squared: a few heavy items cost far more than many light ones. You therefore spread the load, bringing lighter versions of everything rather than dropping items entirely. L2 pushes models towards many small weights instead of a few large ones, which tends to generalise better.

How it works

Training minimises:

total loss = prediction error + λ × Σwᵢ²

Because the penalty’s gradient is proportional to the weight itself, large weights are pushed down hard and small weights barely at all. Weights therefore shrink towards zero asymptotically but never arrive, which is why L2 does not perform feature selection.

A worked example

Two candidate solutions fit the training data almost equally well:

ModelWeightsΣw²Penalty at λ = 0.01
A2, −1, 34 + 1 + 9 = 140.14
B25, −30, 18625 + 900 + 324 = 1,84918.49

Model B’s enormous opposing weights are a classic sign of fitting noise, often triggered by correlated features. L2 makes B’s total loss far worse, so training prefers A. The result is a smoother, more stable model.

Why large weights are a problem

Large weights make a model’s output highly sensitive to small input changes. A tiny measurement difference can swing the prediction. Keeping weights small produces smoother decision boundaries, which usually generalise better to new data and are more robust to noise.

L2 in neural networks: weight decay

In deep learning, L2 appears as weight decay, typically with values between 0.01 and 0.1 for large models and smaller for small ones. An important detail: with adaptive optimisers such as Adam, adding L2 to the loss does not behave as intended because the adaptive scaling distorts it. AdamW, proposed in 2017, decouples weight decay from the gradient update and fixes this. AdamW is now the standard optimiser for training large models.

L1 vs L2

PropertyL1L2
PenaltySum of absolute weightsSum of squared weights
Effect on weightsSome become exactly zeroAll shrink, none vanish
Feature selectionYesNo
Correlated featuresPicks oneShares weight between them
Solution stabilityLowerHigher
Neural network useRareStandard as weight decay
Closed-form solutionNoYes, for linear regression

Choosing λ

λEffect
0No regularisation; risk of overfitting
Small (0.0001–0.01)Light smoothing; common for neural networks
Moderate (0.01–1)Noticeable shrinkage
Large (10+)Underfitting; weights crushed towards zero

Tune it on validation data using a logarithmic range, and scale features first so the penalty applies evenly.

When L2 is the right choice

  • Features are correlated, which is common in real tabular data.
  • All features plausibly contribute something.
  • You are training neural networks, where it is the default.
  • You want stable results across retraining.
  • Multicollinearity makes unregularised linear regression unstable.

Limitations

  • No feature selection, so the model keeps every input.
  • Requires scaled features.
  • Too much λ causes underfitting.
  • Does not remove the need for other regularisation such as dropout or early stopping.

Common Use Cases

01

Neural network training

Apply weight decay to improve generalisation.

02

Linear models with multicollinearity

Stabilise coefficients when features correlate.

03

Small datasets

Reduce variance when data is limited.

04

Production stability

Keep predictions consistent across retraining.

05

Noisy data

Smooth decision boundaries against measurement noise.

06

Combined regularisation

Pair with dropout and early stopping in deep models.

Frequently Asked Questions

A penalty equal to the sum of squared weights that shrinks all weights smoothly towards zero.

Linear regression with an L2 penalty, used to stabilise coefficients and reduce overfitting.

They are closely related. In adaptive optimisers they differ, which is why AdamW decouples weight decay.

Its gradient shrinks as the weight shrinks, so weights approach zero asymptotically without reaching it.

Use L2 when all features may contribute or are correlated; use L1 when you want sparsity and feature selection.

Related Terms

  • L1 Regularization
  • Regularization
  • Model Variance
  • Overfitting
  • Learning Rate
  • Gradient Descent

Related AI Terms

What is Hyperparameter Tuning?Hyperparameter tuning is the process of systematically searching for the configuration values that make a model perform best…What is Early Stopping in Machine Learning?Early stopping is a regularisation technique that halts training when validation performance stops improving, preventing the model from…What is L1 Regularization?L1 regularization, known as lasso in linear models, adds a penalty equal to the sum of the absolute…What is Cross-Validation in Machine Learning?Cross-validation is a technique that repeatedly splits data into training and validation parts, rotating which part is held…What is Stochastic Gradient Descent (SGD)?Stochastic gradient descent (SGD) updates a model's weights using one example or a small batch at a time…What is the Bias-Variance Tradeoff?The bias-variance tradeoff describes how a model's error splits into bias from overly simple assumptions and variance from…

Contents

  1. 01Key takeaways
  2. 02L2 explained in simple terms
  3. 03How it works
  4. 04A worked example
  5. 05Why large weights are a problem
  6. 06L2 in neural networks: weight decay
  7. 07L1 vs L2
  8. 08Choosing λ
  9. 09When L2 is the right choice
  10. 10Limitations
  11. 11Common Use Cases
  12. 12Frequently Asked Questions
  13. 13Related Terms

AI Topic

  • Machine Learning

Related Terms

  • What is Hyperparameter Tuning?
  • What is Early Stopping in Machine Learning?
  • What is L1 Regularization?
  • What is Cross-Validation in Machine Learning?
  • What is Stochastic Gradient Descent (SGD)?
  • What is the Bias-Variance Tradeoff?

Quick Navigation

  • Common Use Cases
  • Frequently Asked Questions
  • Related Terms
  • Back to top

Details

Updated
October 2, 2026
Read
3 min
  • Forum
  • Submit a tool
  • Submit Guest Post
  • List Your Startup
  • Privacy Policy
  • Editorial Policy
  • Account
  • Contact
  • AI Productivity
  • AI Video
  • AI Coding
  • AI Chatbots
  • Sales
  • AI Business
  • View All Tools

Subscribe our Newsletter

Get weekly exclusive content - No spam.

Copyright © 2026 -  Query Feedz

Manage Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
  • Manage options
  • Manage services
  • Manage {vendor_count} vendors
  • Read more about these purposes
View preferences
  • {title}
  • {title}
  • {title}