Learning on Web Dev Open is free for all.

Interview Prep · ML System DesignDesign click-through rate prediction
← ML System Design

Design click-through rate prediction

Hard45 minFree, no account

The one problem where a well-ranked but badly calibrated model costs real money.


The question

Design CTR prediction for an ad auction: given a user, a context and a candidate ad, predict the probability of a click.

The bid is predicted CTR × advertiser bid, so the number itself is used, not just the ordering.

Functional
  • Score hundreds of candidate ads per request.
  • Output a calibrated probability, not a score.
  • Support new ads with no history.
Non-functional
  • 10ms budget for the whole scoring step.
  • Base CTR is roughly 0.1–2%.
  • Models updated frequently; ads change constantly.
45:00Commit to an answer before you open the solution. Reading it first teaches you to recognise good answers, which is not the skill being tested.

Stuck?

0 of 3 hints taken

The worked solution

written by a person · not a grade

Score yourself

0 of 5 marked
  • Identified calibration as the requirement and named the metrics30
  • Handled downsampling with the calibration correction20
  • A workable high-cardinality strategy without leakage25
  • Smoothing and exploration for new ads15
  • Handled position bias between training and serving10

We run no AI here and nothing on this page grades you. The score is yours, and the useful number is the one you get on the same problem a month from now, cold.

kept in this browser only