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.

Google
Machine Learning
Machine Learning Engineer
Google
November 29, 2026
Machine Learning Engineer
Phone Screen
Machine Learning
Easy

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
L1 regularization
L2 regularization
Sparsity
FTRL-Proximal
Model size
How to Approach This
  1. Understand the bias-variance trade-off. High training accuracy but low test accuracy signals overfitting.
  2. Choose evaluation metrics carefully based on the problem. Accuracy alone is often insufficient.
  3. Feature engineering is often more impactful than model selection.
  4. Know when to use tree-based models (tabular data) vs neural networks (unstructured data).
  5. 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 Prep
Sample 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: L(w)+λ1∥w∥1L(w) + \lambda_1 \lVert w \rVert_1 versus L(w)+λ22∥w∥22L(w) + \frac{\lambda_2}{2} \lVert w \rVert_2^2. Then explain sparsity from the optimality condition, give the geometric pictur...


Submit Your Answer
Markdown supported