← Questions

Design a bandit recommender that learns from feedback

0
GoogleAI/ML designLast asked Jul 2025

An AI/ML design interview question asked in Google's system design round, last asked Jul 2025. It tests recommendation systems, bandits and online learning.

At each interaction the system must pick one of four candidate items to show a user, immediately sees whether the user responded (a click, a like), and should update itself so future picks get better. Design this online-learning, bandit-style recommender: the model, the features, how feedback is handled, the exploration-exploitation strategy, and how you evaluate it offline and online.

Requirements

  • Functional: given a user, context and four candidates, choose one in real time; log the choice, the probability with which it was chosen and the feedback; update the model continuously.
  • Non-functional: decisions in a few milliseconds; learning that adapts within minutes to new items and shifting tastes; protection against feedback loops; safe rollout of new policies.

Clarifying questions

  • Are the four candidates fixed, or a different set each time from an upstream retriever?
  • What is the reward: a click, a purchase, time spent? Is it immediate or delayed?
  • How much traffic, and how many users and items?
  • Is there user and item context to use (making it a contextual bandit)?
  • Are there business constraints, such as a minimum share for new items?

What a strong answer covers

  • Framing: a contextual bandit with 4 arms per decision; the reward and why it should reflect long-term value, not only clicks.
  • Strategies compared: epsilon-greedy (simple, explores blindly), UCB (optimism with confidence bounds), Thompson sampling (sample from the posterior; good in practice), and LinUCB or a Bayesian linear or logistic model over context features; a neural model with approximate posteriors at larger scale.
  • Features: user history and context, item features, and cross features; cold-start items covered by item features and a prior.
  • Feedback handling: logging the propensity of each choice, delayed and missing feedback, position or presentation bias, deduplicating events, and online updates (incremental or mini-batch).
  • Offline evaluation from logged data: inverse propensity scoring and doubly robust estimators, which need the logged propensities; replay methods.
  • Online evaluation: A/B tests against the current policy, cumulative reward and regret, guardrail metrics (diversity, complaints), and a ramp-up plan.
  • Production: a low-latency scorer with model parameters in memory, a streaming update pipeline, model versioning, and monitoring of exploration rate and reward drift.

Follow-ups

  • Rewards arrive a day later (a purchase). How does the update change?
  • One item gets lucky early and dominates. How do you detect and fix the feedback loop?
  • Show a slate of all four items in ranked order instead of one. What changes in the model and the evaluation?

Where it's asked

  • Google · System design · Last asked Jul 202545 min · Whiteboard for the diagram, a doc for requirements and capacity math

What it tests

recommendation systems · bandits · online learning

Your canvas
Draw your answer hereBoxes, arrows and notes, saved for you to come back to.Sign in to start drawing