Measure Recall at K for a YouTube Candidate Generation Stage
Last updated: November 29, 2026
Quick Overview
YouTube's recommendation stack retrieves a few hundred candidates per user before a heavier ranker scores them. Define recall@k for this retrieval stage, implement it, and explain why it is the right offline metric for this stage.
0
0
0 solved
YouTube's recommendation stack retrieves a few hundred candidates per user before a heavier ranker scores them. Define recall@k for this retrieval stage, implement it, and explain why it is the right offline metric for this stage.
Google's recommendation interviews often probe whether you evaluate each stage of a multi-stage system on its own job. The interviewer checks that you know retrieval should be judged on coverage of good items, not on ordering, and that you can code the metric cleanly.
What the Interviewer Expects
- States that candidate generation is judged on whether relevant items make it into the set, not their order
- Defines recall@k with a clear choice of ground truth (held-out future watches)
- Handles users with no relevant items and the min(|rel|, k) normalization
- Implements the metric correctly in a few lines
- Mentions per-user averaging versus pooled counts
Key Topics to Cover
How to Approach This
- Understand the bias-variance trade-off. High training accuracy but low test accuracy signals overfitting.
- Choose evaluation metrics carefully based on the problem. Accuracy alone is often insufficient.
- Feature engineering is often more impactful than model selection.
- Know when to use tree-based models (tabular data) vs neural networks (unstructured data).
- Handle class imbalance with SMOTE, class weights, or appropriate loss functions.
Possible Follow-up Questions
- What ground truth would you use: clicks, long watches, or likes?
- How do you evaluate a new retrieval source that only contributes 50 candidates?
- Why might recall@500 go up while the final ranked feed gets worse?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Explore ML Interview PrepSample Answer
Clarify
Ask what k is (the number of candidates passed to the ranker), what counts as relevant (for example a watch longer than 50 percent of the video in the day after the snapshot), and whether we average p...
Approach
The ranker can only promote what retrieval returns, so the retrieval stage's job is coverage. Recall@k for a user is the fraction of their relevant future items that appear in the top k retrieved. Bec...