X "For You" Algorithm Explained

X made their "For You" algorithm open-source.

I suspect that a lot of us will throw the codebase into an LLM and ask it to summarize the highlights. So to save everyone time and tokens, below is a Opus 4.5 generated summary of the algorithm.

Everything that follows is AI generated.


X's For You feed algorithm uses a Grok-based transformer model (Phoenix) to predict the likelihood that you'll engage with a post in 19 different ways. Each type of engagement is a "signal" that tells us how relevant or interesting a post is to you.

The algorithm doesn't just predict one score—it predicts 19 separate probabilities, one for each type of engagement:

  • Positive engagements (liking, replying, sharing, etc.)
  • Negative signals (blocking, muting, reporting, etc.)
  • Passive signals (clicking, dwelling, expanding media, etc.)

These 19 predictions are then combined using a weighted formula to produce a final relevance score for each post. Posts with higher scores appear higher in your feed.

The final score for each post is calculated as:

Final Score = Σ (weight_i × P(action_i))

Where:

  • P(action_i) = Probability you'll take action i (predicted by the Phoenix transformer)
  • weight_i = Importance weight for that action (proprietary)
  • Σ = Sum across all 19 engagement types

Example:

Score = (FAVORITE_WEIGHT × P(favorite))
      + (REPLY_WEIGHT × P(reply))
      + (RETWEET_WEIGHT × P(repost))
      + (CLICK_WEIGHT × P(click))
      + ...
      + (BLOCK_AUTHOR_WEIGHT × P(block))  ← negative weight
      + (REPORT_WEIGHT × P(report))        ← negative weight

Positive actions like favorites and retweets have positive weights (boost the score), while negative actions like blocks and reports have negative weights (lower the score).

The attributes are organized into four tiers based on engagement type and depth. While the exact numerical weights are proprietary, this organization reflects the logical importance hierarchy used in social media ranking.


The Highest-Intent Actions

These are the primary actions that require deliberate user effort and clearly indicate content quality. These are universally the strongest signals across all social media platforms.

  • What it is: Clicking the heart/like button on a post
  • Why it matters: Shows clear approval and positive sentiment. This is the most common form of engagement and a strong signal of content relevance.
  • Signal type: Positive - Very Strong
  • Easy explanation: How likely are you to like this post?
  • Code reference: favorite_score in weighted_scorer.rs

  • What it is: Writing and posting a comment in response to the post
  • Why it matters: Requires significant effort and time investment. Replies indicate the content sparked enough interest to warrant a thoughtful response.
  • Signal type: Positive - Very Strong
  • Easy explanation: How likely are you to reply to this post?
  • Code reference: reply_score in weighted_scorer.rs

  • What it is: Sharing the post to your own followers
  • Why it matters: You're putting your reputation on the line by sharing this content with your audience. This is one of the strongest endorsements possible.
  • Signal type: Positive - Very Strong
  • Easy explanation: How likely are you to repost this to your followers?
  • Code reference: retweet_score in weighted_scorer.rs
  • Note: Called "repost" in the model output but "retweet" in the scoring code

  • What it is: Reposting with your own commentary added
  • Why it matters: Even more effortful than a standard repost—you're adding your own perspective. Shows deep engagement with the content.
  • Signal type: Positive - Very Strong
  • Easy explanation: How likely are you to quote this post with your own commentary?
  • Code reference: quote_score in weighted_scorer.rs

Interest Indicators with Lower Commitment

These actions show interest but require less effort than core engagements. They're valuable supporting signals that help the algorithm understand what catches your attention.

  • What it is: Clicking on a link, URL, or card within the post
  • Why it matters: Shows the content was interesting enough to investigate further. Indicates curiosity and engagement.
  • Signal type: Positive - Moderate
  • Easy explanation: How likely are you to click on a link in this post?
  • Code reference: click_score in weighted_scorer.rs

  • What it is: Clicking on the author's profile picture or username
  • Why it matters: Signals interest in the author, not just the content. Often leads to discovering more content or following.
  • Signal type: Positive - Moderate
  • Easy explanation: How likely are you to visit the author's profile?
  • Code reference: profile_click_score in weighted_scorer.rs

  • What it is: Clicking to view an image in full size
  • Why it matters: Shows the visual content was engaging enough to view in detail.
  • Signal type: Positive - Moderate
  • Easy explanation: How likely are you to expand and view this photo?
  • Code reference: photo_expand_score in weighted_scorer.rs

  • What it is: Watching a video for a meaningful duration (high-quality view)
  • Why it matters: Video engagement is valuable because it requires sustained attention. This measures whether you actually watched (not just scrolled past).
  • Signal type: Positive - Moderate to Strong
  • Easy explanation: How likely are you to watch this video?
  • Code reference: vqv_score in weighted_scorer.rs
  • Special note: Only applied to videos longer than a minimum duration threshold (see weighted_scorer.rs
    )

  • What it is: Spending time with the post visible on your screen
  • Why it matters: Passive signal of attention. If you dwell on a post, you're probably reading it carefully or thinking about it.
  • Signal type: Positive - Moderate
  • Easy explanation: How likely are you to pause and spend time looking at this post?
  • Code reference: dwell_score in weighted_scorer.rs

  • What it is: The actual amount of time (in seconds/milliseconds) you spend with the post in view
  • Why it matters: A continuous metric (not binary) that measures sustained attention. Longer dwell times indicate deeper engagement.
  • Signal type: Positive - Moderate
  • Easy explanation: How long will you spend reading or viewing this post?
  • Code reference: dwell_time in weighted_scorer.rs
  • Note: This is a regression target (predicts duration) rather than a binary classification

  • What it is: Clicking on a quote tweet to see the original post being quoted
  • Why it matters: Shows interest in the conversation context and willingness to explore related content.
  • Signal type: Positive - Moderate
  • Easy explanation: How likely are you to click through to see the quoted post?
  • Code reference: quoted_click_score in weighted_scorer.rs

Conversion-Oriented Engagement

These actions go beyond the platform or create new relationships. They're less frequent but often indicate exceptional content quality.

  • What it is: Sharing the post through the generic share button
  • Why it matters: Indicates the content is valuable enough to share outside your normal X activity. Often shared via other platforms or methods.
  • Signal type: Positive - Very Strong
  • Easy explanation: How likely are you to share this post?
  • Code reference: share_score in weighted_scorer.rs

  • What it is: Sending the post directly to someone in a private message
  • Why it matters: Personal recommendation to a specific person. This is one of the strongest signals—you're explicitly telling someone "you need to see this."
  • Signal type: Positive - Very Strong
  • Easy explanation: How likely are you to send this post to someone in a direct message?
  • Code reference: share_via_dm_score in weighted_scorer.rs
  • What it is: Copying the post's link to share elsewhere
  • Why it matters: Taking the post off-platform. Often shared to other apps, messaging platforms, or saved for later.
  • Signal type: Positive - Very Strong
  • Easy explanation: How likely are you to copy this post's link to share elsewhere?
  • Code reference: share_via_copy_link_score in weighted_scorer.rs

  • What it is: Following the post's author after seeing their content
  • Why it matters: The ultimate conversion—you liked the content so much you want to see more from this creator. This creates a lasting relationship.
  • Signal type: Positive - Very Strong
  • Easy explanation: How likely are you to follow this author?
  • Code reference: follow_author_score in weighted_scorer.rs

Explicit Negative Feedback

These are actions that explicitly tell the algorithm "I don't want to see this." They carry negative weights in the scoring formula to suppress similar content in the future.

  • What it is: Selecting "Not Interested" from the post menu
  • Why it matters: Direct feedback that this content isn't relevant to you. Less severe than blocking but still a clear negative signal.
  • Signal type: Negative - Moderate
  • Easy explanation: How likely are you to mark this post as not interesting?
  • Code reference: not_interested_score in weighted_scorer.rs

  • What it is: Muting the post's author to stop seeing their content
  • Why it matters: Strong negative signal—you don't want to see content from this creator anymore. Not as severe as blocking but indicates content fatigue or annoyance.
  • Signal type: Negative - Strong
  • Easy explanation: How likely are you to mute this author?
  • Code reference: mute_author_score in weighted_scorer.rs

  • What it is: Blocking the post's author completely
  • Why it matters: The strongest negative action. Indicates the content or author is seriously objectionable or unwanted.
  • Signal type: Negative - Very Strong
  • Easy explanation: How likely are you to block this author?
  • Code reference: block_author_score in weighted_scorer.rs

  • What it is: Reporting the post for violating platform rules
  • Why it matters: Extreme negative signal indicating content is harmful, spam, or violates guidelines. This is the ultimate negative feedback.
  • Signal type: Negative - Very Strong
  • Easy explanation: How likely are you to report this post?
  • Code reference: report_score in weighted_scorer.rs

Here's how posts flow through the system:

  1. Candidate Retrieval

    • In-Network: Posts from accounts you follow (Thunder)
    • Out-of-Network: ML-discovered posts from global corpus (Phoenix Retrieval)
  2. ML Prediction (Phoenix Transformer)

    • Input: Your engagement history + candidate posts
    • Output: 19 probability predictions for each post
  3. Weighted Scoring

    • Each probability is multiplied by its importance weight
    • All weighted probabilities are summed into a final score
    • Score normalization is applied (see weighted_scorer.rs
      )
  4. Additional Adjustments

    • Author Diversity: Scores are attenuated if you've seen many posts from the same author
    • Out-of-Network Penalty: Additional adjustments for content from accounts you don't follow
  5. Final Ranking

    • Posts are sorted by final score
    • Top K posts are selected for your feed

This document describes the 19 engagement attributes and how they're used in the scoring formula. However, the following details are proprietary and not included in the open-source release:

  • Exact weight values: The specific FAVORITE_WEIGHT, REPLY_WEIGHT, etc. constants are in the params module which is not open-sourced
  • Weight optimization process: How the weights were tuned or learned
  • Weight relationships: The relative magnitudes between different weights
  • Threshold values: Specific values for minimum video duration, score offsets, etc.

What IS open-sourced:

  • The 19 attributes being predicted
  • The scoring formula structure (Score = Σ weight × probability)
  • The entire Phoenix transformer architecture
  • The complete candidate pipeline and filtering logic
  • All hydration, retrieval, and ranking code

The weighted scoring logic is implemented in:

  • Main scorer: home-mixer/scorers/weighted_scorer.rs
  • Phoenix model: phoenix/recsys_model.py (Grok-based transformer)
  • Model runner: phoenix/runners.py
    (ACTIONS list)
  • Scores struct: home-mixer/candidate_pipeline/candidate.rs

fn apply(score: Option<f64>, weight: f64) -> f64 {
    score.unwrap_or(0.0) * weight
}

Each prediction (0.0 to 1.0 probability) is multiplied by its weight. Missing predictions default to 0.0.

VQV is only applied if the post contains a video longer than a minimum duration:

fn vqv_weight_eligibility(candidate: &PostCandidate) -> f64 {
    if candidate.video_duration_ms.is_some_and(|ms| ms > MIN_VIDEO_DURATION_MS) {
        VQV_WEIGHT
    } else {
        0.0
    }
}

After combining all weighted scores, a normalization function handles negative values:

fn offset_score(combined_score: f64) -> f64 {
    if WEIGHTS_SUM == 0.0 {
        combined_score.max(0.0)
    } else if combined_score < 0.0 {
        (combined_score + NEGATIVE_WEIGHTS_SUM) / WEIGHTS_SUM * NEGATIVE_SCORES_OFFSET
    } else {
        combined_score + NEGATIVE_SCORES_OFFSET
    }
}

This ensures:

  • Negative scores (from negative actions) are properly scaled
  • All scores are offset to be non-negative for downstream processing

#AttributeTypeEngagement DepthWeight TypeCode Reference
1FavoriteCoreHigh-IntentPositiveweighted_scorer.rs
2ReplyCoreHigh-IntentPositiveweighted_scorer.rs
3RepostCoreHigh-IntentPositiveweighted_scorer.rs
4Quote TweetCoreHigh-IntentPositiveweighted_scorer.rs
5ClickSecondaryInterestPositiveweighted_scorer.rs
6Profile ClickSecondaryInterestPositiveweighted_scorer.rs
7Photo ExpandSecondaryInterestPositiveweighted_scorer.rs
8Video Quality ViewSecondaryInterestPositiveweighted_scorer.rs
9DwellSecondaryPassivePositiveweighted_scorer.rs
10Continuous Dwell TimeSecondaryPassivePositiveweighted_scorer.rs
11Quoted ClickSecondaryInterestPositiveweighted_scorer.rs
12ShareHigh-ValueConversionPositiveweighted_scorer.rs
13Share via DMHigh-ValueConversionPositiveweighted_scorer.rs
14Share via Copy LinkHigh-ValueConversionPositiveweighted_scorer.rs
15Follow AuthorHigh-ValueConversionPositiveweighted_scorer.rs
16Not InterestedNegativeFeedbackNegativeweighted_scorer.rs
17Mute AuthorNegativeFeedbackNegativeweighted_scorer.rs
18Block AuthorNegativeFeedbackNegativeweighted_scorer.rs
19ReportNegativeFeedbackNegativeweighted_scorer.rs

  1. 19 separate predictions are made for each post, covering positive, negative, and passive engagement types

  2. Weighted combination turns these 19 probabilities into a single relevance score

  3. Core engagements (likes, replies, reposts, quotes) are universally strong signals

  4. Conversion actions (shares, follows) indicate exceptional content quality

  5. Negative signals (blocks, mutes, reports) actively suppress unwanted content

  6. Passive signals (clicks, dwells) provide supporting evidence of interest

  7. No hand-engineered features—the Grok-based transformer learns all relevance patterns from your engagement history

  8. Exact weights are proprietary, but the full architecture, model, and scoring logic are open-source

Understanding these 19 attributes helps explain why certain posts appear in your feed and how the algorithm interprets different types of engagement.

Spotted a mistake? Edit article