← Meta Interview InsightsMachine Learning Engineer

Meta·Machine Learning Engineer·Technical Phone Screen·Senior

SeniorPrefer not to say
Jun 2026Remote

Summary

Meta ML engineer round with two parts: a metrics design discussion about friend recommendations under data constraints, then a live coding exercise with AI assistance allowed. The AI-assisted format was a bit unusual but actually kind of interesting once I got into it.

Questions Asked (2)

Q1

You have a User class with only an id and a list of current friends. How would you design evaluation metrics for a friend recommendation algorithm, and which of those metrics are actually computable given only those two fields?

Product Analytics & MetricsTechnical Trade-offsA/B Testing & Experimentation
Author's notes

This was the part I found genuinely interesting.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the goal of the friend recommendation algorithm (e.g., increase user engagement, grow the social graph) and then outline a hierarchy of offline and online metrics. For each metric, assess computability given only user id and friend list, noting that most offline metrics require additional data like interactions or impressions, while some graph-based metrics are computable.

Pro tip: Emphasize that offline metrics are proxies and the ultimate validation requires online A/B tests, but even then, you need to define guardrail metrics to avoid optimizing for the wrong thing. Also, mention that with only id and friend list, you can compute graph-based metrics like common neighbors, but you cannot compute personalized ranking metrics without negative samples or user-item interactions.

1. Clarify the objective

Ask or state the business goal: is it to increase friend connections, improve engagement, or something else? This determines which metrics matter.

2. Define offline metrics

List potential offline metrics such as precision@k, recall@k, mean reciprocal rank, AUC, and graph-based metrics like common neighbors, Jaccard similarity, and link prediction accuracy.

3. Define online metrics

Outline online metrics like click-through rate on recommendations, acceptance rate of friend requests, number of new friendships formed, and long-term engagement metrics.

4. Assess computability

For each metric, determine if it can be computed with only user id and friend list. Offline ranking metrics require ground truth labels (e.g., future friendships) and negative samples, which are not available. Graph-based metrics like common neighbors, Jaccard similarity, and Adamic-Adar are computable.

5. Recommend evaluation strategy

Propose using computable graph metrics for offline evaluation and designing online A/B tests for final validation, while collecting additional data to enable richer offline metrics.

Key Points to Mention

  • Offline metrics: precision@k, recall@k, MAP, MRR, AUC require labeled data (future friendships) and negative sampling, which are not available with only id and friend list.
  • Graph-based metrics: common neighbors, Jaccard similarity, Adamic-Adar index, and link prediction accuracy can be computed using the friend graph.
  • Online metrics: CTR, acceptance rate, number of new friendships, and engagement metrics are measurable in production but require instrumentation.
  • Computability: With only id and friend list, you can compute graph-based metrics but not personalized ranking metrics without additional data.
  • Trade-offs: Offline metrics are fast and cheap but may not correlate with online performance; online metrics are costly but directly measure impact.
  • A/B testing: The gold standard for evaluation, but requires careful design to avoid network effects and ensure statistical power.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

Implement a mutualFriendsScore function that takes two User objects and returns a score based on mutual friends. Write it in a new file with unit tests, and you may use AI assistance during the implementation.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

The AI-assistance angle threw me off more than the actual coding.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the definition of 'score' and the User data structure, then propose an efficient algorithm using hash sets to compute mutual friends. Implement the function with unit tests covering edge cases, and discuss trade-offs like time/space complexity and how AI assistance was used responsibly.

Pro tip: Mention that you would verify AI-generated code with tests and consider scalability for large friend lists, showing engineering rigor. Also, proactively discuss how the score could be normalized or weighted for ML applications.

1. Clarify Requirements

Ask questions to understand the expected score formula (e.g., count, Jaccard similarity), the User object structure, and any constraints on friend list sizes.

2. Design Algorithm

Propose using hash sets for O(min(n,m)) time complexity to find intersection, and explain why this is optimal. Discuss alternative approaches and trade-offs.

3. Implement with AI Assistance

Write the function in a new file, using AI to generate initial code or tests, but review and modify as needed. Ensure code is clean and well-documented.

4. Write Unit Tests

Create tests for normal cases, empty friend lists, no mutual friends, and large inputs. Use a testing framework like pytest or unittest.

5. Discuss Trade-offs and Extensions

Talk about time/space complexity, potential optimizations for distributed systems, and how the score might be used in ML models (e.g., feature engineering).

Key Points to Mention

  • Time and space complexity of the solution (O(n+m) time, O(min(n,m)) space).
  • Choice of data structure (hash set vs. sorted lists) and its impact on performance.
  • Edge cases: empty friend lists, identical users, no mutual friends.
  • Unit testing best practices: isolation, mocking, and coverage.
  • Responsible use of AI: verifying generated code, avoiding plagiarism, and understanding the code.
  • Potential ML applications: using mutual friends as a feature in recommendation or link prediction models.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.