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
Machine Learning
Software Engineer
Meta
November 29, 2026
Software Engineer
Phone Screen
Machine Learning
Easy

0

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
collaborative filtering
cosine similarity
candidate generation
Facebook Groups
How to Approach This
  1. Understand the bias-variance trade-off. High training accuracy but low test accuracy signals overfitting.
  2. Choose evaluation metrics carefully based on the problem. Accuracy alone is often insufficient.
  3. Feature engineering is often more impactful than model selection.
  4. Know when to use tree-based models (tabular data) vs neural networks (unstructured data).
  5. 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 Prep
Sample 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 ∣Ma∩Mb∣∣Ma∣ ∣Mb∣\frac{|M_a \cap M_b|}{\sqrt{|M_a|\,|M_b|}}. Raw overlap counts would m...


Submit Your Answer
Markdown supported