Course contentsShow
← System Design
Lesson 1668 of 1,91940. Real-World System: Social Media FeedFree lesson

Machine Learning for Feed Ranking

How ML models predict user engagement and personalize feed ranking based on historical behavior and content features.

Machine Learning for Feed Ranking

What you'll learn: How ML models predict user engagement to personalize feed ranking based on past behavior and content attributes.

The Core Challenge

A social media feed can't show everything—it needs to predict which posts you will find most engaging. Machine learning models solve this by learning patterns from millions of users' past interactions (likes, comments, shares, time spent) and applying those patterns to rank new content specifically for you.

How ML Models Work in Feed Ranking

Think of the ML model as a talent scout who's watched you interact with thousands of posts. It notices: you always stop for cat videos, you skip political rants, you engage with posts from close friends. When new posts arrive, the scout scores each one: "This cat video from Sarah? 95% chance they'll love it. That political article? 12% chance."

Key Components

Training data comes from historical engagement:

  • User clicked post → positive signal
  • User scrolled past → negative signal
  • User spent 30 seconds reading → strong positive signal

Features fed into the model include:

  • User features: your past likes, follows, typical engagement time
  • Content features: post type (video/text), topic category, recency
  • Relationship features: how often you interact with this author

The model outputs a single engagement probability score (0-1) for each post. Higher scores = higher ranking in your feed.

Real-Time Application

When you open the app, the ranking service fetches candidate posts, runs them through the trained model in milliseconds, and returns a sorted feed. The model continuously retrains (daily or hourly) as new engagement data flows in, adapting to evolving interests.

Key Takeaway: ML models transform raw engagement history into personalized feed rankings by learning what content features predict your interaction patterns, then scoring new posts in real-time.