Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Tune L1 vs L2 for Ads

Medium
Machine LearningAsked 1 times

Problem

Business Context

Meta Ads ranking models use high-dimensional behavioral and campaign features to predict whether a user will click an ad impression. A simple linear baseline is still valuable in production because it is fast, stable, and easy to debug, but it can overfit badly when feature space is wide and sparse. Your task is to compare L1 and L2 regularization in a click-through-rate classification setting and explain when each is preferable.

Dataset

You are given a training table built from one week of ad impression logs.

Feature GroupCountExamples
Dense numerical18historical_ctr, advertiser_spend_7d, user_session_depth, page_load_ms
One-hot categorical420device_type, country, placement, campaign_objective, app_surface
Sparse hashed text/context560query intent bucket, ad text n-gram hashes, landing page topic hashes
Temporal6hour_of_day, day_of_week, recency_since_last_click
  • Rows: 1.2M ad impressions
  • Features: 1,004 engineered features after encoding
  • Target: clicked = 1 if the impression received a click, else 0
  • Class balance: 6.4% positive, 93.6% negative
  • Missing data: ~8% missing in some advertiser quality features and ~3% missing in user activity recency fields

Success Criteria

A strong solution should:

  • improve generalization versus an unregularized logistic regression baseline,
  • compare L1 and L2 using cross-validated model selection,
  • explain the impact on sparsity, stability, and interpretability,
  • achieve log loss < 0.23 and AUC-ROC > 0.78 on the holdout set.

Constraints

  • Inference must stay under 10 ms per request for a linear model in Meta Ads serving.
  • The model should remain interpretable enough to inspect top weighted features.
  • Training should fit on a single production training job without expensive feature selection passes.

Deliverables

  1. Train logistic regression baselines with no regularization, L1, and L2 penalties.
  2. Use cross-validation to tune regularization strength and select the best model.
  3. Compare coefficient sparsity, validation performance, and holdout performance.
  4. Explain what regularization is and when L1 should be preferred over L2, and vice versa.
  5. Provide a production recommendation for Meta Ads ranking.
Practicing as: Machine Learning Engineer interview at Meta

Hi, I'll play your Meta interviewer for the Machine Learning Engineer role. Candidates describe these interviews as mostly positive and moderately difficult, so expect me to be friendly and conversational. Take your time with the question above and answer like we're in the room.

You are practicing as a guest. Sign up free to get your answer graded with AI feedback. Your draft stays right here.

Sign up freeI have an account
Sign up to unlock solutions
Meta Machine Learning Engineer Interview Questions
Next questions
Samsung AdsL1 vs L2 RegularizationMediumGENL1 vs L2 RegularizationMediumChoose L1 vs L2 for Noisy ClaimsEasy