RECOMMENDATION SYSTEMS · INTERVIEW QUESTION
How do you evaluate a recommendation system in production? What are the key offline and online metrics?
🔴 advanced · Evaluation & Cold Start
Hint: Think about the gap between offline and online metrics, and selection bias.
Answer
Offline metrics: Precision@K, Recall@K, NDCG (handles ranking quality), MAP, Hit Rate, AUC.
Interview reasoning
Issues: offline metrics don't account for position bias, novelty, or diversity.
Online metrics: CTR, conversion rate, user engagement time, retention, revenue. A/B testing is essential but expensive. Counterfactual evaluation (IPS, doubly robust estimators) can partially bridge offline-online gap.
Key considerations: diversity vs relevance tradeoff, novelty (don't just recommend popular items), coverage (% of catalog recommended), fairness across user groups.
Always measure long-term metrics (retention) not just short-term (clicks).
Offline metrics evaluate relevance under a sampled, logged distribution; online metrics evaluate user response to changed exposure. Temporal splits, realistic candidates and known sampling rules improve the offline test, but novelty, latency and policy effects still require experiments. Include durable outcomes and guardrails rather than interpreting a ranking metric as business value.
Worked example. NDCG may rise while checkout completion falls because promoted items are unavailable. For example, ranking ten out-of-stock products well against textual judgments helps offline relevance but supplies no purchasable result.
Validation
Report ranking metrics, candidate recall and user/item slices; confirm with randomized cohorts and latency/retention guardrails.
Common pitfalls
Offline-selected labels reflect incumbent exposure. Repeatedly tuning on one holdout overstates generalization and does not solve counterfactual bias.
Related questions
- What is the cold start problem in recommendation systems? How do you solve it?
- Explain matrix factorization for collaborative filtering. How does it handle the cold start problem?
- What is a recommendation system and how does it work?
- Explain the difference between user-based and item-based collaborative filtering.
- Explain two-tower models for recommendation. How are they used in production?