explaingit

xai-org/x-algorithm

16,601RustAudience · researcherComplexity · 5/5Setup · hard

TLDR

The open-sourced recommendation algorithm that decides what posts appear in the For You feed on X, combining posts from accounts you follow with AI-ranked content discovered across the full platform.

Mindmap

mindmap
  root((X Algorithm))
    Pipeline Stages
      Candidate retrieval
      Data hydration
      Filtering
      Scoring
    Content Sources
      Thunder in-network
      Phoenix out-of-network
    Ranking Model
      Grok transformer
      Engagement prediction
      Author diversity
    Audience
      Researchers
      ML engineers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Study how a large-scale social media feed recommendation system works, from candidate retrieval to final ranking.

USE CASE 2

Use the architecture as a reference when designing a content ranking or personalization pipeline for your own platform.

USE CASE 3

Understand how engagement signals like likes, replies, and reposts are combined into a single relevance score.

Tech stack

RustGrok TransformerMachine Learning

Getting it running

Difficulty · hard Time to first run · 1day+

This is a reference architecture, not a turnkey system. Running it requires large-scale ML infrastructure and proprietary training data.

License terms were not specified in the available README.

In plain English

This repository contains the core recommendation system that powers the For You feed on X (the social network formerly known as Twitter). When you open the app and see posts from accounts you do not follow alongside ones you do, that curation is produced by the pipeline documented and partially open-sourced here. The system gathers posts from two places. The first source, called Thunder, pulls content from accounts you actively follow. The second, called Phoenix Retrieval, searches a much larger global pool of posts using machine learning to find content you might find interesting even if you do not follow those accounts. Both pools are then combined and passed through several processing stages. Before ranking, the system enriches each candidate post with extra data: author details, media information, and your own engagement history, meaning what you have liked, replied to, reposted, or clicked on in the past. A filtering step then removes items that should never appear: duplicates, older posts already shown, content from accounts you have blocked or muted, and posts containing keywords you have silenced. The ranking itself is handled by a component called Phoenix, which runs a transformer model adapted from the Grok-1 architecture. This model predicts the probability that you will take each type of action on a given post, including liking, replying, reposting, or clicking. These predicted probabilities are multiplied by fixed weights and summed to produce a single score for each post. An additional step deliberately reduces the scores of posts from the same author when too many appear together, keeping the feed from being dominated by one person. The entire pipeline is coordinated by an orchestration layer called Home Mixer. The code is written in Rust and released publicly as an open-source reference showing how the feed actually works. The README also notes that the team has eliminated hand-crafted rules and heuristics, letting the Grok-based transformer handle relevance decisions entirely.

Copy-paste prompts

Prompt 1
Explain how the X For You feed algorithm pipeline works step by step, from candidate retrieval through Thunder and Phoenix to final ranking.
Prompt 2
Based on the x-algorithm architecture, how does the Phoenix scorer use a Grok transformer to predict engagement probability for each post?
Prompt 3
How does the author diversity step in the x-algorithm prevent one account from dominating the For You feed?
Prompt 4
I want to build a recommendation feed for my app. Which parts of the x-algorithm pipeline should I model my architecture after?
Open on GitHub → Explain another repo

← xai-org on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.