Prevent User Leakage With Grouped Cross-Validation for YouTube Watch Time
Last updated: November 29, 2026
Quick Overview
A model predicts watch time for (user, video) pairs on YouTube. Explain why standard k-fold cross-validation overestimates its quality, and how grouped k-fold changes the estimate and what it is actually measuring.
0
0
0 solved
A model predicts watch time for (user, video) pairs on YouTube. Explain why standard k-fold cross-validation overestimates its quality, and how grouped k-fold changes the estimate and what it is actually measuring.
YouTube datasets have many rows per user and per video, so naive validation folds share entities with training folds. The interviewer wants you to reason about what population the model will serve and choose groups accordingly.
What the Interviewer Expects
- Explains that rows from the same user are correlated and share user-level signal
- Shows how memorizing user IDs or user-level features inflates validation scores
- Proposes GroupKFold by user (or video, depending on the deployment question)
- Discusses which grouping matches cold-start versus warm users
- Notes that time and group constraints can be combined
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
- Should you group by user or by video if the goal is ranking newly uploaded videos?
- How do you combine grouping with a time-based split?
- What happens to fold balance if a few users have millions of rows?
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 entities repeat in the data (users, videos, channels), whether the model uses ID embeddings, and what deployment question we care about: predicting for existing users on new videos, new users...
Approach
Standard k-fold assumes rows are independent. With 500 rows per user, each validation fold contains users whose other rows trained the model. If the model has a user ID embedding or a feature like "us...