Recommend Facebook Groups With Item-Item Collaborative Filtering
Last updated: November 29, 2026
Quick Overview
Given each user's set of joined Facebook Groups, write a function that recommends the top k groups a user has not joined, using item-item similarity on co-membership. Discuss how it would need to change at Meta scale.
Meta
November 29, 20260
0
0 solved
Given each user's set of joined Facebook Groups, write a function that recommends the top k groups a user has not joined, using item-item similarity on co-membership. Discuss how it would need to change at Meta scale.
A gentle ML coding question for generalist engineers joining recommendation-heavy teams like Groups or Pages. The interviewer looks for a clean similarity definition, candidate generation that avoids scoring every group, and awareness of popularity effects.
What the Interviewer Expects
- Define a similarity measure that normalizes for group size, such as cosine
- Generate candidates from neighbours instead of scoring every group
- Exclude groups the user already joined and break ties deterministically
- Discuss complexity and what breaks at billions of memberships
- Mention cold start for users with no groups
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
- Why normalize by group size instead of counting raw co-members?
- How would you precompute similarities offline for millions of groups?
- How would you blend this with a learned embedding model?
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
Input is {user: set(group_ids)}. Output is up to k group IDs the user has not joined, best first. I will treat membership as implicit binary feedback with no ratings. A user with no groups gets an e...
Approach
Item-item CF: two groups are similar if they share many members relative to their sizes. Cosine on binary membership vectors is . Raw overlap counts would m...