How the X (Twitter) algorithm works, according to its own code
X has published the code behind its For You feed twice, in 2023 and in its current form in 2026. I read it: here's how posts get ranked, and what the code can't tell you.
How to read my tags: confirmedthe source says it · inferredmy deduction from what's confirmed · speculateda guess, and I say so
- X has published its For You ranking code twice: Twitter's release of 31 March 2023, and today's code, last updated on 18 September 2026. confirmed · 1, 3, 5
- Today, one AI model predicts how likely each viewer is to take about two dozen actions on a post; published weights turn those predictions into one score. confirmed · 5
- In the September 2026 settings, a predicted reply or quote weighs 5, a like 0.5 and a share by copied link 20. confirmed · 5 Predicted mutes, blocks and reports count heavily against a post. confirmed · 5
- For You drops posts older than 48 hours, discounts an author's extra posts in the same refresh, and scores posts from accounts you don't follow at 75%. confirmed · 5
- Nobody outside X, me included, can see how the trained model judges a given post: it isn't published, and its predictions depend on each viewer's history. confirmed · 5
X has published its ranking code twice, and the 2023 version is outdated
Few platforms publish the code behind their main feed. X has. On 31 March 2023, Twitter released the source code of its recommendation algorithm, which picks posts for the For You timeline. confirmed · 2, 3 It came as two GitHub repositories, with an engineering blog post explaining it. confirmed · 1, 3, 4 Twitter said it left out code that could put user safety and privacy at risk or help bad actors, plus the ad recommendation code, training data and model weights. confirmed · 2 The main repository was updated until July 2023, then once more on 3 September 2025. confirmed · 3
Today's system is a separate codebase, published by xAI on GitHub as x-algorithm: "the core code that determines which posts a viewer sees in the For You feed on X". confirmed · 5 Its settings file was last synced with X's configuration system on 18 September 2026. confirmed · 5 X calls these settings its "primary production values". confirmed · 5
Mind the date gap. Many explainers still rely on the March 2023 release, which describes the Twitter-era system: about 1,500 candidate posts per request, and a timeline that was on average half posts from accounts you follow. confirmed · 1 The 2026 code uses a different programming language, a different model and a different list of predicted actions. confirmed · 3, 5 Even X's own Help Center page on For You is undated and still links to the 2023 repository. confirmed · 6
Today's feed predicts two dozen reactions per post, then weighs them
1Understanding posts and accounts. A classifier called Grox sorts new posts into categories such as spam, adult content and violent media, and turns their text and images into numeric summaries. confirmed · 5 Separate models check images and video. confirmed · 5 Other jobs rate accounts: one labels an account by how people respond to its posts (blocks, reports and spam reports, relative to likes), one looks for inauthentic behavior, and one computes a reputation score from follows and engagement. confirmed · 5 These labels decide whether a post can be shown at all, not where it ranks. confirmed · 5
2Finding candidates (possible posts). Each time the app asks for posts, recent posts from accounts you follow come from a live store called Thunder. confirmed · 5 Posts from accounts you don't follow come from Phoenix retrieval, which matches your recent activity against posts described by their content and author, and from SimClusters, which groups accounts and posts by who engages with what. confirmed · 5 To that retrieval model, you're mostly what you've interacted with: it learns no separate profile for you and reads only your history, plus a few details such as country and language. confirmed · 5
3First filters. Before scoring, the code removes duplicates, posts older than 48 hours, your own posts, reposts and replies from accounts you don't follow, posts from accounts you block or mute, posts with your muted keywords, posts you've already seen, and subscriber-only posts you can't open. confirmed · 5
4Ranking by predicted actions. A transformer model called Phoenix, the same family of AI that powers chatbots, reads your recent engagement history. confirmed · 5 It predicts how likely you are to like, reply, repost, quote, share, click, watch, linger, follow the author, or tap "not interested", mute, block or report. confirmed · 5 It also sees context such as the post's age and your local time. confirmed · 5 It scores each post on its own, so other posts in the batch can't change its score. confirmed · 5 Then the predictions are multiplied by weights and added up. confirmed · 5 The 18 September 2026 settings include these weights:
- Reply 5, raised to 20 on original posts from someone you follow who follows you back (a boost X tested from 10 July 2026 and set at this level on 24 July). confirmed · 5
- Quote 5, share 2, share by DM 5, share by copying the link 20, follow the author 4. confirmed · 5
- Repost 1, like 0.5, click into the post 0.4, open a link 0.2, plus small weights for lingering on a post and opening photos and videos. confirmed · 5
- Profile clicks and "video quality views" are predicted but currently weighted zero. confirmed · 5
- Not interested −43.2, mute −58.8, block −31.2, report −234. confirmed · 5
X left a warning in the code: the weights multiply one viewer's predicted probabilities, not counts, so reading them as "one report cancels 468 likes" is wrong. confirmed · 5 Reports weigh heavily because they're more than 1,000 times rarer than likes. confirmed · 5
Three adjustments follow. Posts from accounts you don't follow, and replies and reposts from accounts you do follow, are multiplied by 0.75. confirmed · 5 Twitter's 2023 code did the same for accounts you don't follow. confirmed · 3 Extra posts from one author in the same refresh are discounted more and more, but never below a quarter of their score. confirmed · 5 By my arithmetic with these settings, the author's second post keeps about 62% of its score and the third about 44%. inferred · 5 A new-author boost can lift one post per refresh to around 16th place, if it's an original post under 48 hours old, from an account with 1,000 or fewer followers, with fewer than 1,000 views on the Home timeline. confirmed · 5 A last step spreads out posts that look too alike, giving up a little score for variety. confirmed · 5
For comparison, the 2023 ranking model had about 48 million parameters and predicted ten kinds of engagement, including likes, retweets, replies, replies the author engaged with, and reports. confirmed · 1, 3
5Final checks and mixing. After ranking, a visibility service decides for each post and viewer: allow, show behind a warning screen, or drop. confirmed · 5 Some drop rules apply only when a post would be recommended to someone who doesn't follow the author, such as rules for "do not amplify" labels, a broad spam check, malicious links and abuse. confirmed · 5 Followers can still see the same post. confirmed · 5 Duplicate branches of a conversation are collapsed, and ads, Who to Follow and prompts are mixed in. confirmed · 5
6Learning from what happens next. Your recent actions are the main input the model reads on your next request. confirmed · 5 So what you engage with today shapes what For You shows you tomorrow. inferred · 5 The repository has the code that trains the production model, but not the trained model, and doesn't say how often the live model is retrained. confirmed · 5 X's Help Center only says it's "continuously trained on your interactions". confirmed · 6
What nobody outside X can know, and four beliefs I checked
The code shows the rules, not the judgments. The trained model isn't published, and its predictions depend on each viewer's history. confirmed · 5 So no one outside X can compute the score your next post will get. inferred · 5 I watch videos all day, and I can't either.
X says it keeps the Grox classifier's prompts and some labeling rules out of the code so the system is harder to game. confirmed · 5 Settings can differ for people inside experiments, and X only aims to publish experiments that reach 10% or more of traffic. confirmed · 5 The repository focuses on For You and doesn't cover how replies are ordered under a post, or how Search and Explore rank. confirmed · 5
- "One report cancels out hundreds of likes." Contradicted: the weights apply to predicted probabilities, not counts. confirmed · 5 X's code comments add that reports from bad actors mostly affect recommendations for users similar to them, and that only actions on posts served in the Home timeline count for ranking. confirmed · 5 Blocks and reports do feed account-level labels, though. confirmed · 5 How much a coordinated campaign could move those labels isn't published.
- "Premium boosts your posts." It did in the 2023 code, not in today's For You scoring. confirmed · 3, 5 The March 2023 code multiplied "Blue Verified" authors' scores by default factors of 4 for their followers and 2 for everyone else. confirmed · 3 Those multipliers are gone from the 2025 update. confirmed · 3 X's Premium page does promise "reply prioritization" in conversations. confirmed · 7 And verified accounts are part of the starting point for the reputation score that labeling rules read. confirmed · 5
- "Links kill your reach." I found no published paper, code or official page that confirms a penalty on ordinary links. In the 2026 settings, opening a link has a small positive weight, and the one link rule I found drops recommended posts with malicious links. confirmed · 5 The 2023 to 2025 code also removed posts from accounts you don't follow if they linked to sites on a "competitor" list, but the list itself wasn't in the code. confirmed · 3
- "X shadowbans accounts." Confirmed in a narrower form: labels such as "do not amplify", or the broad spam check, can stop a post being recommended to non-followers while followers still see it. confirmed · 5 X's Under the Hood tool, still a pilot, shows statistics on these labels for your account and posts. confirmed · 5
Questions people ask
Is the X (Twitter) algorithm open source?
What does the X algorithm prioritize in 2026?
How long does a post stay in the For You feed on X?
Does X Premium boost your reach?
Can mass reporting or blocking kill my reach on X?
How can I tell if X is limiting my posts?
Sources
- Twitter Engineering (2023). Twitter's Recommendation Algorithm. Twitter Engineering blog, published with the 31 March 2023 code release. blog.x.com · official page · productionDescribes the Twitter-era For You pipeline as it ran in March 2023 (candidate sources, the neural ranker, filters, mixing); superseded by the 2026 code.
- Twitter (2023). A new era of transparency for Twitter. Twitter company blog, 31 March 2023. blog.x.com · official page · official statementAnnounces the 2023 code release and lists what was left out (safety code, ad recommendation code, training data, model weights); no technical detail.
- Twitter (2023, updated 2025). the-algorithm: Source code for the X Recommendation Algorithm. GitHub, twitter/the-algorithm (first commit 31 March 2023; last update 3 September 2025). github.com · open-source code · productionTwitter-era code for For You (home-mixer, filters, Blue Verified and out-of-network multipliers, the ten engagement types); code defaults may differ from live settings, and the repository is not buildable as a whole.
- Twitter (2023). the-algorithm-ml. GitHub, twitter/the-algorithm-ml. github.com · open-source code · productionHolds the 2023 For You neural ranker ("heavy ranker") and TwHIN embedding code; its 2023 weight table is not quoted in this article.
- xAI / X (2026). x-algorithm: X For You Feed Algorithm. GitHub, xai-org/x-algorithm (README; home-mixer/params/param.rs, synced 18 September 2026; home-mixer/scorers; docs/BIDIRECTIONAL_BOOST_CHANGE.md; phoenix/README.md; user-cred-v2; visibility-filtering). github.com · open-source code · productionThe current For You code and weights as of 18 September 2026; Grox prompts, some labeling rules and the trained model are not included, and settings can change or differ inside experiments.
- X (undated, read 21 September 2026). For You Home Timeline Recommendations. X Help Center. help.x.com · official page · official statementGeneral description of For You signals and user controls; no weights or dates, and it links to the 2023 repository.
- X (undated, read 21 September 2026). About X Premium. X Help Center. help.x.com · official page · official statementDescribes "reply prioritization" for subscribers in conversation rankings, with levels still being tested; says nothing about For You scoring.
This is the plain-language version. The full research — every stage written out formally — is Jean-Paul Azzi's, and it's becoming a book. Every claim here points at the platform's own paper, page or code; nothing comes from marketing blogs.