MLCrack

    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.