How L1 Regularization Forces Coefficients to Zero While Ridge Regression Keeps Them All
While both techniques prevent machine learning models from overfitting, Lasso regression uniquely performs feature selection by mathematically eliminating less important variables entirely.
By Mateo Ramos
Share this story
In short
- Ridge regression shrinks all coefficients proportionally but keeps every variable in the final model.
- Lasso regression applies an absolute-value penalty that forces less important coefficients to exactly zero.
- This zeroing effect makes Lasso an automatic feature selector, ideal for high-dimensional datasets.
Ridge regression prevents a model from memorizing noise by shrinking the influence of every variable proportionally. If a dataset has 10,000 predictors, Ridge returns a model with 10,000 slightly muted predictors. Lasso regression differs in one fundamental respect: it shrinks the influence of variables by a constant amount, which forces the least important ones exactly to zero. Introduced in 1996 by Stanford University statistician Robert Tibshirani, the method was designed to solve the interpretability problem of massive datasets.[3][6]
The mechanism behind this difference lies in the shape of the mathematical penalty each method applies to the model's coefficients. Ridge regression, formalized in 1970, penalizes the sum of the squared coefficients. This creates a smooth, circular constraint region in the geometric space of the data. The optimal solution—where the model's error meets this constraint—almost always lands on the curve of the circle, meaning all variables retain some non-zero value.[3][7]
Lasso applies a different mathematical constraint. As researchers at the Columbia University Mailman School of Public Health note, "LASSO is a regression analysis method that performs both variable selection and regularization in order to enhance the prediction accuracy and interpretability." It achieves this by penalizing the sum of the absolute values of the coefficients. Geometrically, this creates a diamond-shaped constraint region with sharp corners.[2][4]
When the model seeks the optimal solution under an L1 penalty, the mathematical intersection overwhelmingly occurs at one of these sharp corners, which sit exactly on the axes of the geometric space. Landing on an axis means the coefficient for that specific variable is exactly zero, effectively dropping it from the equation. A Ridge model's circular boundary lacks these corners, making an axis intersection statistically improbable.[3][5][7]
This property transforms Lasso from a simple regularization tool into an automatic feature selector. In fields like bioinformatics, researchers often feed models 20,000 gene expression levels to predict a single disease outcome. A Ridge model would assign a tiny weight to every gene, leaving researchers to guess which ones actually matter. A Lasso model will drop 19,950 irrelevant genes entirely, leaving a sparse, interpretable model containing only the 50 most predictive markers.[2][4][6]
However, the L1 penalty carries specific limitations when dealing with highly correlated variables. If three variables move in perfect lockstep—such as a patient's weight in pounds, weight in kilograms, and body mass index—Ridge regression will divide the predictive weight evenly among all three, assigning each a coefficient of roughly 0.33. Lasso, by contrast, will arbitrarily select one of the correlated variables to retain with a weight of 1.0, and drive the coefficients of the other two to zero.[3][6][7]
This arbitrary selection makes Lasso unstable for causal inference when multicollinearity is high. If a model drops a variable, it does not necessarily mean that variable has no real-world effect; it may simply mean another variable in the dataset captured the same information first. Consequently, in 2005, statisticians introduced Elastic Net, a hybrid approach that combines the L1 and L2 penalties to achieve both feature selection and stability among correlated predictors.[1][2][4][5]
The computational efficiency of a sparse model cannot be overstated in production environments. A model that requires 10,000 inputs to make a prediction consumes significantly more memory and processing power than a model that requires only 50. By driving coefficients to zero during the training phase, Lasso ensures that the final deployed model is lightweight and fast. Ridge regression generally provides better overall predictive accuracy when most variables have a small but genuine effect, but Lasso excels when the underlying reality is sparse.[3][4]
How we did this
- Method
- A geometric and algebraic synthesis of the constraint spaces created by L1 and L2 penalties, mapping how the sharp corners of the absolute-value boundary force axis intersections compared to the smooth circular boundary of squared penalties.
- What we found
- The mathematical guarantee of feature selection in Lasso is entirely an artifact of its geometric shape in high-dimensional space; the sharp corners of the L1 constraint region ensure that the optimal error contour intersects an axis (driving a coefficient to exactly zero) in almost all cases where the unpenalized estimate falls outside the constraint boundary.
- What we worked from
- L1 penalty geometric constraint (diamond shape): Sum of absolute coefficients ≤ t — GeeksforGeeks
- L2 penalty geometric constraint (circular shape): Sum of squared coefficients ≤ t — Stanford University
- Limits of this analysis
- This geometric synthesis assumes standardized predictors and does not fully account for the arbitrary variable selection that occurs when predictors are perfectly collinear.
Jargon, explained
- Regularization
- A technique used to prevent machine learning models from overfitting by adding a penalty to the model's complexity.
- Overfitting
- When a model learns the statistical noise in its training data rather than the underlying pattern, causing it to perform poorly on new data.
- Multicollinearity
- A situation where multiple variables in a dataset are highly correlated, making it difficult for a model to determine which one is actually driving the outcome.
- Sparsity
- A property of a model where most of its coefficients are exactly zero, meaning it relies on only a small subset of the available variables.
Competing readings
The Case for Ridge Regression
Prioritizing overall predictive accuracy over model simplicity.
Proponents of Ridge regression argue that in complex, real-world systems, almost every variable has at least a microscopic effect on the outcome. By shrinking coefficients rather than eliminating them, Ridge preserves these subtle signals. This approach consistently yields lower overall prediction errors in datasets where the true underlying relationship is dense rather than sparse. The trade-off is a mathematically heavy model that requires all inputs to function, making it harder for humans to audit.
The Case for Lasso Regression
Prioritizing interpretability and computational efficiency through sparsity.
Advocates for L1 regularization emphasize that a model is only useful if its decisions can be understood and deployed efficiently. In fields like genomics or high-frequency trading, processing tens of thousands of variables is computationally expensive and prone to overfitting. By forcing the vast majority of coefficients to zero, Lasso identifies the critical drivers of an outcome. This allows researchers to isolate specific biomarkers or financial indicators, transforming a black-box algorithm into a transparent, actionable set of rules.
The Elastic Net Compromise
Combining both penalties to overcome Lasso's instability with correlated data.
Statisticians who routinely deal with highly correlated data point out that Lasso's feature selection can be dangerously arbitrary. If two variables carry identical information, Lasso will randomly drop one, which can mislead researchers trying to infer causality. Elastic Net practitioners solve this by applying both the L1 and L2 penalties simultaneously. This hybrid approach retains the sparsity of Lasso while adopting the grouping effect of Ridge, ensuring that correlated variables are either selected or dropped together.
- Predictive Accuracy Advocates
- Argue that minimizing overall prediction error is paramount, favoring Ridge regression to retain all available signal.
- Interpretability Advocates
- Prioritize sparse models where humans can understand exactly which variables drive the prediction, favoring Lasso.
- Hybrid Practitioners
- Argue that combining both penalties via Elastic Net solves Lasso's instability with correlated variables while maintaining sparsity.
Perspectives this story doesn't cover
- Computational hardware engineers optimizing chip architecture for sparse matrices
Sources
[1]Penn State UniversityPredictive Accuracy Advocates5.4 - The Lasso
Read on Penn State University →
[2]Columbia University Mailman School of Public HealthInterpretability AdvocatesLeast Absolute Shrinkage and Selection Operator (LASSO)
Read on Columbia University Mailman School of Public Health →
[3]Stanford UniversityInterpretability AdvocatesThe Elements of Statistical Learning: Data Mining, Inference, and Prediction (Second Edition)
Read on Stanford University →
[4]IBMHybrid PractitionersWhat is lasso regression?
Read on IBM →
[5]GeeksforGeeksHybrid PractitionersWhat is Lasso Regression
Read on GeeksforGeeks →
[6]R-bloggersPredictive Accuracy AdvocatesUnderstanding Lasso and Ridge Regression
Read on R-bloggers →
[7]GeeksforGeeksHybrid PractitionersRidge Regression vs Lasso Regression
Read on GeeksforGeeks →
[8]Factlen Editorial TeamSynthesis by Factlen editorial team
Read on Factlen Editorial Team →
More in Data & Analysis
See all →Macroeconomic Outlook
Global Economic Forecasts Diverge for 2026 as AI and Emerging Markets Drive Growth
5 sources
Workforce Shift
41-Country Study Finds AI Adoption Increases Senior Workforce 6.7% While Junior Employment Falls 3%
7 sources
Regression Diagnostics
How a Near-Zero Eigenvalue in the Design Matrix Reveals Multicollinearity in Regression
6 sources
Statistical Modeling
Calculating the F-Statistic by Dividing Explained Variance by Residual Noise
5 sources
Comments
Every angle. Every day.
Get Data & Analysis stories with full source coverage and perspective breakdowns, free every day.




