Skip to main content

Design: News Feed Ranking - Multi-Objective Optimization at Scale

Reading time: ~25 min | Interview relevance: High | Roles: MLE

The Real Interview Moment

"Design the news feed ranking system for a social media platform like Facebook or Twitter." You start describing a binary classifier that predicts clicks. The interviewer pushes: "You're optimizing for clicks. What happens to content quality? What about rage-bait posts that get tons of clicks but make users angry? How do you balance engagement with user well-being?"

Feed ranking is the ML system design question that tests multi-objective thinking. It's not enough to predict clicks - you need to optimize for a portfolio of objectives while avoiding harmful optimization side-effects.

What You Will Master

  • Multi-objective ranking: likes, comments, shares, time-spent, and quality
  • Real-time feature engineering for social feeds
  • Two-stage retrieval + ranking for social content
  • Diversity and freshness constraints
  • Responsible AI: avoiding engagement traps and filter bubbles
  • Creator-side optimization: fair exposure

The Complete Design

Step 1: Requirements (5 min)

Functional requirements:

  • Rank posts from friends, groups, and pages for 2B daily active users
  • Mix content types: text, images, videos, links, stories
  • Show ~50 posts per session from a pool of ~1000 candidate posts

Non-functional requirements:

  • Latency: <200ms to render feed
  • Freshness: New posts appear within minutes
  • Diversity: No single friend/topic dominates the feed
  • Safety: Misinformation and harmful content demoted

Step 2: Problem Formulation (5 min)

The key insight: feed ranking is a multi-objective problem.

ActionBusiness ValueModel
LikeLow engagement signalP(like) - binary classifier
CommentMedium engagementP(comment) - binary classifier
ShareHigh engagement + viralityP(share) - binary classifier
Time spentAttention signalE(time) - regression
Hide/reportNegative signalP(hide) - binary classifier

Combined score: Score = w1*P(like) + w2*P(comment) + w3*P(share) + w4*E(time) - w5*P(hide)

The weights (w1-w5) are tuned via A/B testing to optimize the north star metric (daily active users, time spent per day).

60-Second Answer

"I'd design this as a multi-objective ranking system. For each candidate post, I predict multiple engagement signals - P(like), P(comment), P(share), E(time spent), and P(negative feedback). These are combined with learned weights into a final score. The system uses a two-stage architecture: candidate generation retrieves ~1000 relevant posts from the social graph, then the ranking model scores them using user features, post features, and real-time context. A re-ranking layer adds diversity constraints and content policy enforcement. The weights in the multi-objective function are the key lever - they determine whether the feed optimizes for engagement, quality, or user well-being."

Step 3: Features & Data (8 min)

Feature Categories

CategoryFeaturesFreshness
UserDemographics, interest topics, engagement history, friend list, active hoursHourly
PostContent type, text embeddings, image features, author, post age, early engagement statsReal-time
AuthorContent quality score, posting frequency, follower count, engagement rateDaily
User-AuthorInteraction frequency, relationship strength, message historyDaily
ContextTime since last session, device, network speed, notification vs. organic openReal-time
Real-timeLikes/comments in last 10 min, trending score, friend engagement on this postStreaming

Training Data

  • Positive labels: User engaged (like, comment, share, watch > 50%)
  • Negative labels: Post was shown but user scrolled past (dwell time < 2 sec)
  • Label delay: Immediate for most actions
  • Volume: Billions of impressions per day
Common Trap

Optimizing purely for engagement metrics leads to rage-bait, clickbait, and misinformation - content that generates clicks but makes users unhappy. Include "negative engagement" signals: P(hide), P(report), survey-based quality scores (periodically ask users "Was this post worth your time?"). This shows the interviewer you think about responsible AI, not just metrics.

Step 4: Model (8 min)

Architecture: Multi-Task Learning

Feed Ranking Multi-Task Learning - Shared layers feeding 5 prediction towers: P(like), P(comment), P(share), E(time), P(hide)

Why multi-task learning?

  • Shared feature extraction is efficient (one forward pass, five predictions)
  • Tasks share information (posts that get likes also tend to get comments)
  • Can weight objectives independently at serving time without retraining

Model Comparison

ModelProsCons
Separate models per objectiveSimple, independent tuningN forward passes, no shared learning
Multi-task with shared bottomEfficient, shared learningNegative transfer if tasks conflict
MMoE (Multi-gate Mixture of Experts)Handles task conflicts, SOTAComplex architecture

Step 5: Serving (8 min)

News Feed Serving Pipeline - Candidate Generation → Multi-Objective Scoring → Re-Ranking → Feed

Candidate Generation Sources

SourceWhat It RetrievesPriority
Friends' postsRecent posts from connectionsHigh
GroupsPosts from joined groupsMedium
Pages/FollowsPosts from followed pagesMedium
RecommendedPosts from non-connections (explore)Low

Re-Ranking Layer

The re-ranking layer applies constraints after ML scoring:

  1. Diversity: No more than 2 consecutive posts from the same author
  2. Content type mixing: Alternate between text, image, and video posts
  3. Freshness: Boost recent posts, decay old ones
  4. Content policy: Demote borderline content (misinformation, hate speech)
  5. Ad insertion: Insert ads at positions 3, 8, 15... without disrupting experience

Step 6: Evaluation & Iteration (8 min)

Online Metrics

MetricWhat It MeasuresOptimization Direction
DAUDaily active usersIncrease
Time spentMinutes per sessionIncrease (with ceiling)
Content productionPosts created per userIncrease
Negative feedback rateHide/report per impressionDecrease
Meaningful social interactionsComments, shares, meaningful reactionsIncrease

The Weight-Tuning Process

  1. Start with equal weights for all objectives
  2. Run A/B tests varying one weight at a time
  3. Measure impact on north star metrics (DAU, meaningful interactions)
  4. Iterate - this is a continuous process, not a one-time setup

Practice Problems

Problem 1: Viral Misinformation

Direction

A false news article is going viral on your platform - 500K shares in 2 hours. Your engagement model ranks it highly because of the engagement. How does your system handle this?

Key Insight

This requires a separate content integrity pipeline that runs alongside the ranking model. Signals: rapid virality with unusual patterns, fact-checker flags, user reports. Action: reduce distribution (not just label - actually lower the ranking score). The key design point is that content integrity and engagement ranking must be independent systems - the engagement model should never override content policy decisions.

Problem 2: New User Feed

Direction

A user signs up and has zero friends. What does their feed look like?

Key Insight

Cold start for feed: (1) Onboarding - suggest friends and topics to follow. (2) Trending/popular content filtered by declared interests. (3) Editorially curated "best of" content. (4) As user adds friends and follows topics, gradually blend personalized content. Key metric during onboarding: D7 retention (do they come back after 7 days?).

Interview Cheat Sheet

Question PatternFrameworkKey Phrases
"Design a news feed"Multi-objective ranking"Predict multiple engagement signals, combine with learned weights"
"How do you balance engagement and quality?"Negative signals + guardrails"Include P(hide), P(report) as negative objectives, monitor meaningful social interactions"
"How do you handle diversity?"Re-ranking constraints"Post-scoring re-ranking with diversity, freshness, and content type mixing constraints"

Spaced Repetition Checkpoints

  • Day 0: Write the multi-objective scoring formula from memory. Explain each term.
  • Day 3: Explain multi-task learning vs. separate models. Draw the MMoE architecture.
  • Day 7: Design a feed ranking system for a professional network in 45 minutes.
  • Day 14: Discuss the engagement vs. quality trade-off. How do you measure "meaningful" interactions?
  • Day 21: Mock interview with follow-ups on content policy, misinformation, and creator fairness.

What's Next

© 2026 EngineersOfAI. All rights reserved.