Explain Why L1 Produces Sparse Weights in a Sparse Ads Model
Last updated: November 29, 2026
Quick Overview
A logistic regression click model over billions of hashed query and ad cross features is too large to serve. Explain why L1 regularization drives many weights to exactly zero while L2 only shrinks them, and how you would use that here.
0
0
0 solved
A logistic regression click model over billions of hashed query and ad cross features is too large to serve. Explain why L1 regularization drives many weights to exactly zero while L2 only shrinks them, and how you would use that here.
Google's early ads and search models were huge sparse linear models, so memory per feature mattered as much as accuracy. A phone screener uses this to check that you understand regularization geometrically and can connect it to a serving constraint, not just recite formulas.
What the Interviewer Expects
- Write both penalized objectives clearly
- Explain sparsity through the subgradient of $|w|$ at zero or the diamond-shaped constraint region
- Contrast with L2, whose gradient vanishes near zero so weights shrink but rarely hit zero
- Connect sparsity to model size and serving memory
- Mention that plain SGD with L1 rarely lands on exact zeros, so FTRL-Proximal or truncated gradient is used
Key Topics to Cover
How to Approach This
- Understand the bias-variance trade-off. High training accuracy but low test accuracy signals overfitting.
- Choose evaluation metrics carefully based on the problem. Accuracy alone is often insufficient.
- Feature engineering is often more impactful than model selection.
- Know when to use tree-based models (tabular data) vs neural networks (unstructured data).
- Handle class imbalance with SMOTE, class weights, or appropriate loss functions.
Possible Follow-up Questions
- Why does plain SGD with an L1 term not give exact zeros, and how does FTRL-Proximal fix it?
- What happens with L1 when two features are highly correlated?
- When would you choose elastic net instead?
- How would you pick the L1 strength given a hard memory budget?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Explore ML Interview PrepSample Answer
Clarify
I would confirm the model is logistic regression on hashed sparse features, that the binding constraint is the number of nonzero weights we can keep in serving memory, and that we are willing to trade...
Approach
Compare the two objectives: versus . Then explain sparsity from the optimality condition, give the geometric pictur...