KatInterview

Building a Real-Time Ad Recommendation Engine

Machine LearningModel answer
HardModel answerMachine Learningrecommendation-systemsrankingads

Last updated

Design a machine learning system that delivers personalized advertisements to users at scale, covering infrastructure, modeling, and evaluation.

You're building an advertisement recommendation engine for a large social platform. The system must deliver relevant ads to hundreds of millions of users with strict latency requirements while balancing platform revenue, advertiser return on investment, and user satisfaction.

Your task is to design the complete machine learning system from end to end. Address the following:

  1. System architecture: How would you structure the pipeline from candidate selection through final ad delivery?
  2. Machine learning components: What models would you use at each stage, and how would you train them?
  3. Feature design: What signals would you incorporate, and how would you make them available at inference time?
  4. Evaluation strategy: What metrics matter offline and online? How would you run experiments?
  5. Cold-start problem: How would you handle new users with no history and newly launched ad campaigns?
  6. Practical challenges: Address issues like delayed conversions, position bias, and budget pacing.

Discuss trade-offs, quantify where possible, and explain how you'd validate that the system works correctly.

Hints

Hint 1

Break the problem into stages with different speed/accuracy trade-offs—you can't score millions of ads in real-time

Hint 2

Remember that ad systems involve auctions and pricing, not just ranking—predictions must be calibrated, not just well-ordered

Hint 3

Training data comes from your own serving decisions, creating feedback loops and biases that need explicit handling