L1 Versus L2 Regularization for a Sparse Ads Feature Space

Last updated: November 29, 2026

Quick Overview

A logistic regression for ad clicks has tens of millions of sparse hashed features. Explain how L1 and L2 regularization differ in effect, and which you would choose for this model.

Meta
Machine Learning
Machine Learning Engineer
Meta
November 29, 2026
Machine Learning Engineer
Technical Screen
Machine Learning
Easy

0

0

0 solved


A logistic regression for ad clicks has tens of millions of sparse hashed features. Explain how L1 and L2 regularization differ in effect, and which you would choose for this model.

Regularization fundamentals come up in Meta ML screens, often framed around large sparse models from the ads stack. The interviewer checks geometry intuition, the effect on sparsity, and practical choices like elastic net.

What the Interviewer Expects
  • Write the L1 and L2 penalized objectives
  • Explain why L1 produces exact zeros and L2 shrinks smoothly
  • Connect sparsity to memory and serving cost
  • Discuss behavior with correlated features
  • Mention elastic net and per-coordinate methods like FTRL
Key Topics to Cover
L1 regularization
L2 regularization
Sparsity
Elastic net
Logistic regression
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
  • How do you choose the regularization strength?
  • Why does L1 pick one of several correlated features arbitrarily?
  • How does FTRL-Proximal achieve sparsity in online learning?
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 ask whether model size matters at serving (it usually does with tens of millions of weights), whether features are highly correlated, and whether training is batch or online....

Approach

Both add a penalty to log loss: L1 adds λ∑∣wj∣\lambda\sum|w_j|, L2 adds λ∑wj2\lambda\sum w_j^2. L2's gradient 2λwj2\lambda w_j shrinks large weights strongly and small weights weakly, so weights approach zero ...


Submit Your Answer
Markdown supported