Design an Online Four-Candidate Ranker
Choose one of four candidates per request and improve safely from delayed user feedback.
Problem statement
For this exercise, assume each request contains a user/context snapshot and exactly four eligible candidate IDs. The service must choose one candidate, return a decision ID, record what was shown and why, accept delayed binary feedback, and improve future choices without hiding exploration from evaluation.
A decision is immutable, one feedback outcome is counted per decision, retries are idempotent, and candidates outside the supplied four are never returned. The serving model and exploration policy are versioned.
Candidate generation, content moderation, user-interface rendering, payments, and creation of the four candidates are outside scope.
What to build
- Choose exactly one of the four supplied candidates and return a stable decision ID plus policy metadata.
- Accept one idempotent delayed binary feedback outcome for an existing decision.
- Build versioned training and evaluation data and release policies that balance reward, exploration, and safety.
At scale
- Assume 10,000 decision requests per second at peak and 100 million retained decisions per day.
- Return a choice within 100 ms at p95 with 99.9% availability.
- Feedback may arrive from seconds to seven days later, may be duplicated, and is absent for many decisions.
- A policy update may be hourly, but a bad release must be detectable and reversible within ten minutes.