The brief
Predict the chance a user clicks an ad, accurately enough to price it in a real-time auction. Your design should meet these requirements:
- About 1 billion people see ads in a social feed; each ad request scores hundreds of eligible ads within tens of milliseconds.
- The predicted click probability is multiplied by the advertiser's bid in an auction, so it must match real click rates, not only rank ads well.
- New ads and campaigns start every minute and must get sensible predictions from their first impressions.
Scale to design for
A social platform with about 1 billion daily users and roughly 100 billion ad impressions a day. Each ad request has a few thousand eligible ads after targeting and budget filters; a model must score several hundred of them within about 30 ms, inside an ad request budget of around 100 ms. Click-through rates are around 1%. The predicted click probability multiplies the advertiser's bid in a second-price-style auction, so it must be calibrated. Millions of ads are active and new campaigns start constantly.
State these assumptions out loud in the interview, then let them drive your choices: they decide what needs caching, sharding or asynchronous processing.
Before you start
You'll get more out of this round if you're comfortable with:
- Binary classification and log loss
- Calibration
- Feature hashing and embeddings
- Online A/B tests
Questions an interviewer may ask
Expect follow-ups like these once your high-level design is on the board. Have an answer, and a reason, for each:
- Why does calibration matter if the ranking is already good?
- You downsample negatives to 10%: what happens to the predicted probabilities and how do you fix it?
- A brand-new campaign launches: what does the model predict for its ads?
- How often do you retrain and how do you know a fresh model is safe to push?
- How do you fit hundreds of candidates into 30 ms?
Common mistakes to avoid
- Optimising AUC only and ignoring calibration
- Downsampling negatives without recalibrating
- Raw CTR counters with no smoothing so a new ad with one click looks perfect
- Features computed with data from after the impression
- Retraining weekly in a domain that shifts hourly
- Training on bot clicks
- Scoring every eligible ad with the heavy model
Concepts this round covers
- Calibrated probabilities
- Sparse features at scale
- Fresh models for new ads
- Ads
What a complete answer covers
A clear label and training set built from impressions, sparse and real-time features, a baseline then deep model, calibration, a serving path inside the auction's latency budget, frequent retraining, and offline and online metrics.
There is no single correct design. A strong answer meets the requirements at the stated scale and explains the trade-offs behind each choice. New to the format? Read how to prepare for a system design interview.