Katkat

Design a People-You-May-Know Friend Recommendation System

MetaSoftware Engineer · Onsite

Last updated

A system design question on recommending people a user may know on a large social network, from candidate generation through ranking and serving. It tests graph-based candidate sourcing, batch versus real-time freshness, ranking signals and labels, filtering, privacy, cold start, and evaluation.

Design a friend recommendation feature ("people you may know") for a large social network. Each user sees a list of people they are not yet connected to but are likely to know and want to add. From the list, a user can send a friend request or dismiss a suggestion.

Clarifying Questions

  • How many users are there, and what are the average and maximum friend counts?
  • Is the relationship mutual (friends) or one-directional (follows)?
  • Which signals may be used: mutual friends, shared schools or workplaces, uploaded contacts, location? What privacy constraints apply to each?
  • How soon after a user adds a new friend should recommendations reflect it?
  • What is the success metric: requests sent, requests accepted, or longer-term interaction between the new friends?

Hints

Hint 1

Most candidates are nearby: Think about where in the social graph the people a user knows but has not added yet are most likely to be.

Hint 2

Separate finding from ordering: Scoring every user on the network for every viewer is impossible; decide what produces a manageable candidate set before any ranking happens.

Follow-up questions

  • How do you compute friends-of-friends for a user whose friends themselves have very large friend counts without an explosion of work?
  • A brand-new user has no friends yet. What do you show?
  • How do you avoid recommendations that reveal information the candidate or the viewer would not expect to be shared?
  • How would you evaluate a new ranking model offline and then online?