KatInterview

Designing a Ranking and Exploration Pipeline for Fresh Ad Campaigns

Machine LearningModel answer
MediumModel answerMachine Learningcold-startads-rankingthompson-sampling

Last updated

Design an ML system that ranks and safely explores ads under one week old with little click or conversion history, while keeping auction pricing, user experience and advertiser pacing intact.

Context

You work on the ads ranking stack of a large visual discovery app. Every day, many thousands of new ad campaigns go live. During their first week these ads have almost no click or conversion history, so a standard auction ranker that orders ads by eCPM = bid * pCTR * pCVR has unreliable inputs for them. The result is one of two failure modes: new ads are starved of impressions and never get a chance to prove themselves, or weak ads are over-shown, hurting users and burning advertiser budget.

Design an end-to-end system that ranks and explores cold ads, meaning ads younger than 7 days or with fewer than about 1,000 impressions.

What the system must do

  • Priors from content and context: produce initial CTR and CVR estimates for ads with zero or very little data, using creative embeddings, ad text, advertiser history, campaign metadata, and user and request context.
  • Safe exploration: decide how to give promising new ads extra exposure (for example with a contextual bandit or an uncertainty-based boost) while limiting harm from negative user feedback and wasted advertiser spend.
  • Calibrated predictions: output pCTR and pCVR that are well calibrated, so that exploration does not distort prices or revenue in the auction.
  • Graduation to the mature ranker: define how an ad moves from the cold-start path to the main high-volume ranker as evidence accumulates.
  • Delayed conversions: handle conversion labels that arrive 1 to 7 days after the click, both in model training and in any online statistics.

Scale and service constraints

  • Peak load of 100,000 ranking requests per second.
  • 50 million candidate ads, of which 10% to 15% are cold.
  • P99 ranking latency below 40 ms.
  • A newly created ad must be servable within 5 minutes; priors and bandit state must refresh in near real time.

Topics to cover

  1. Overall architecture: retrieval, scoring, exploration, and streaming data flow.
  2. Modeling: feature representation (such as two-tower or graph-based priors) and how you quantify uncertainty.
  3. Marketplace integrity: keeping a GSP or VCG-style auction fair while adding exploration.
  4. Evaluation: offline simulation and metrics, plus online experiment design, without hurting revenue or CTR.

Hints

Hint 1

Start by sizing the problem: how many cold ads exist, how many candidates are scored per request, and how the 40 ms budget splits across retrieval, ranking and auction. This tells you how cheap the per-candidate cold logic must be.

Hint 2

Separate the question of who wins from the question of what they pay. Exploration can adjust the ranking score, but pricing should rely only on calibrated eCPM values.

Hint 3

Represent each ad's CTR and CVR as a Beta posterior whose starting strength comes from the prior model's confidence, then sample from it (Thompson sampling). For conversions, count unresolved clicks as fractional trials using the delay distribution.

Hint 4

Do not graduate ads with a hard cutoff. Blend cold and mature predictions in logit space with a weight driven by how much evidence has accumulated, and log propensities so you can evaluate off-policy later.