How the X For You Algorithm Works
The X For You timeline is a recommendation system, not simply a chronological feed. It finds potential posts, filters them, predicts how a user may interact with them, ranks the candidates, and then selects posts for the timeline.
The current open-source X algorithm shows a pipeline built around candidate retrieval, filtering, scoring, ranking, and selection. The newer xAI/X repository describes two major sources: posts from accounts you follow through Thunder, and posts discovered outside your network through Phoenix Retrieval. Phoenix then uses a transformer-based model to predict different types of engagement. (GitHub)
In simple terms: X doesn't ask only, “What is new?” It asks, “Which available posts are most relevant to this particular person?”
The X For You Algorithm in One Diagram
Think of the system as a pipeline:
The open-source implementation describes these stages through its Home Mixer and candidate-pipeline architecture. (GitHub)
1. X First Needs Candidates
Before X can rank a post, it needs to find posts that could potentially appear in your feed. This is called candidate generation or candidate retrieval.
The current architecture has two major sources:
In-Network Content
These are posts from accounts you follow. The current system uses Thunder to provide recent posts from accounts in your network. Thunder maintains an in-memory store of recent posts and serves candidates from followed accounts. (GitHub)
Out-of-Network Content
This is where things become more interesting. The For You feed can recommend posts from accounts you don't follow. The current architecture uses Phoenix Retrieval to discover potentially relevant posts from a much larger corpus. Phoenix's retrieval system uses a two-tower model:
- A User Tower represents the user and their engagement history.
- A Candidate Tower represents posts.
A similarity calculation is then used to retrieve relevant candidates. (GitHub)
2. Your Activity Helps Build Context
The recommendation system needs information about the person for whom it is building the feed. The current open-source code describes query hydration that can retrieve user context such as engagement history and following information. The repository's latest updates also describe additional context including followed topics, mutual-follow information and served history. (GitHub)
The older X recommendation repository similarly documents a centralized user-signal-service for retrieving explicit signals such as likes and replies and implicit signals such as profile visits and post clicks. (GitHub)
So your activity isn't just about the last post you liked. Your interactions can become part of the context used to determine what content is relevant to you.
3. X Enriches the Candidate Posts
Once candidate posts have been found, the system can retrieve additional information about them. This process is called hydration.
The current candidate pipeline describes hydrators that can add information such as:
This information gives later stages more context about each candidate. (GitHub)
4. Filtering Happens Before Ranking
Not every candidate gets to compete in ranking. The current open-source pipeline includes filters that can remove candidates before scoring.
Examples documented in the repository include:
- Duplicate posts
- Posts that are too old
- Your own posts / Previously seen or served posts
- Muted keywords & Posts from blocked or muted authors
- Ineligible subscription content & Duplicate reposts
There are also post-selection filters for things such as deleted content, spam, violence/gore-related content and duplicate conversation branches. (GitHub)
Eligibility ≠ Ranking
A post that doesn't pass an applicable filter may never reach the ranking stage. A post that does reach ranking can then compete against other candidates. So if a post isn't appearing in a For You feed, “low ranking” isn't necessarily the explanation. It could have been removed at an earlier stage.
5. Phoenix Predicts Multiple Possible Actions
This is one of the most interesting parts of the current architecture. The ranking system isn't described as predicting one simple “viral score.” Phoenix predicts probabilities for multiple potential user actions.
The repository lists predictions including:
(GitHub)
6. Positive and Negative Signals Can Both Matter
A recommendation system needs to predict not only what you might enjoy, but also what you might dislike. For example, the current repository documents predictions for both positive interactions such as likes and reposts and negative actions such as Not Interested, Block, Mute and Report. (GitHub)
The documented weighted-scoring approach can be represented conceptually as:
In other words, different predicted actions can contribute differently to the final ranking score. This is important because engagement is not necessarily one-dimensional. A post generating a click is not necessarily equivalent to a post generating a repost, and a post likely to trigger negative feedback can be treated differently from one likely to generate positive engagement.
7. Ranking Determines Which Candidates Compete at the Top
After candidates have been scored, the system can rank them. The current candidate pipeline describes a Phoenix scorer followed by a weighted scorer. It also documents additional scoring logic, including author diversity and adjustments for out-of-network content. (GitHub)
This means the highest raw engagement prediction isn't necessarily the only consideration in constructing the final feed.
8. X Also Needs Feed Diversity
Imagine a feed containing ten posts from the same person. Even if every post has a strong predicted score, that isn't necessarily a good user experience. The current pipeline therefore includes an Author Diversity Scorer, which attenuates repeated author scores. (GitHub)
This is why the highest-scoring posts don't necessarily mean ten posts from the same author appear consecutively. The system still has to construct a useful feed.
9. The System Selects the Final Posts
After scoring and ranking, the system selects the candidates that will actually be served. The current Home Mixer pipeline describes this as:
The selector sorts candidates by score and selects the top candidates. Post-selection filtering can then perform final validation and deduplication. (GitHub)
10 to 15. Personalization, Out-of-Network Reach & Why Distribution Changes
10. Why You See Posts From People You Don't Follow: Phoenix Retrieval uses a two-tower architecture to find potentially relevant posts from a much larger corpus outside your existing network. (GitHub)
11. The For You Feed Is Personalized: Two people can open X at the same time and receive very different feeds because ranking uses viewer context and individual predicted engagement.
12. Why a Post Can Have Reach Without Going Viral: A post may be highly relevant to a relatively small group of users and perform well for that niche audience without becoming broadly popular.
13. Why Your Post Can Stop Appearing: Distribution can change due to age filtering, deduplication, author diversity, or changing viewer interests. A sudden drop in impressions does not automatically prove an account is "shadowbanned."
14. Is There a Single X Algorithm Score? No single public number represents the algorithm. The architecture relies on multi-action predictions and weighted scoring.
15. What the Open Source Code Actually Tells Us: Open source provides architectural transparency into retrieval, hydration, multi-action prediction, ranking, and selection, though production models are continuously trained and larger in scale. (GitHub)
The Simple Version
If you don't want to read the code, remember these six steps:
How X Ranks and Recommends Posts
Creator & Reach Guides
Sources
- • xAI's X For You Algorithm repository — current open-source For You architecture, including Thunder, Phoenix, filtering, scoring and selection. (GitHub)
- • Phoenix recommendation architecture — retrieval and transformer-based ranking details.
- • X's original open-source recommendation repository — earlier Home Mixer, candidate sources, user signals, ranking and visibility-filter architecture.