Design The For You Candidate Retrieval And Ranking Pipeline

Last updated: November 29, 2026

Quick Overview

Design the recommendation pipeline that builds the For You timeline on X: retrieve about 1,500 candidate posts per request from in-network and out-of-network sources, rank them with a neural model predicting several engagement types, and apply filters and mixing, all within a tight latency budget.

X
ML System Design
Machine Learning Engineer
X
November 29, 2026
Machine Learning Engineer
System Design Round
ML System Design
Hard

0

0

0 solved


Design the recommendation pipeline that builds the For You timeline on X: retrieve about 1,500 candidate posts per request from in-network and out-of-network sources, rank them with a neural model predicting several engagement types, and apply filters and mixing, all within a tight latency budget.

X published its recommendation pipeline (candidate sources such as in-network ranking, SimClusters and embedding retrieval, a heavy neural ranker, then heuristics), so a strong candidate should be able to reason about each stage and its trade-offs. Interviewers look for multi-objective ranking, latency budgeting per stage, feature freshness, and how to avoid feedback loops and spam.

What the Interviewer Expects
  • Breaks the pipeline into retrieval, light ranking, heavy ranking, filtering and mixing
  • Names concrete candidate sources for in-network and out-of-network
  • Defines multi-task labels and how they are combined into one score
  • Budgets latency per stage
  • Discusses features, freshness and training-serving skew
  • Covers diversity, author fatigue and negative feedback
Key Topics to Cover
candidate generation
embedding retrieval
multi-task ranking
feature store
diversity
online experimentation
How to Approach This
  1. Start by mapping the business objective to a concrete ML objective and metric.
  2. Cover the full pipeline: data collection, feature engineering, model selection, training, serving.
  3. Discuss online vs offline evaluation. Plan an A/B test to validate real-world impact.
  4. Address the serving latency budget and whether batch or real-time inference is needed.
  5. Think about the data flywheel: how user feedback improves the model over time.
Possible Follow-up Questions
  • How do you pick the weights that combine predicted like, reply, repost and 'show less' into one score?
  • How would you evaluate a new candidate source offline before an A/B test?
  • A new user has no follows. What does retrieval do?
  • How do you keep the model from learning to promote rage bait?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice ML System Design Problems
Sample Answer
Requirements

Per request: return about 50 ranked items (posts, plus slots for ads and modules) with p99 under about 400 ms server-side. Optimize long-term satisfaction, approximated by engagement predictions and n...

High-Level Design
  1. Candidate sources in parallel (about 1,500 total): in-network posts from accounts the user follows, scored by a light model using a real-graph style interaction strength; out-of-network from commun...

Submit Your Answer
Markdown supported

Related Questions