X (Twitter) Algorithm: What the Open-Source Code Reveals
The Twitter algorithm (now X) decides the For You timeline in four steps: gather candidates, filter them, score them with a neural model, then mix the final feed. X published the code on GitHub in 2023, including a weight table in which replies and conversations count many times more than a like and negative signals such as reports override everything else. Since January 2026 the rebuilt system has been public in the xai-org/x-algorithm repository, with current weights since August 2026.
Key Takeaways
- On March 31, 2023, X published the source code of the For You timeline in two GitHub repositories, making it the only major platform whose ranking logic can be read rather than interpreted.
- According to the 2023 engineering blog, For You pulls around 1,500 candidates per request from a pool of hundreds of millions of posts, roughly half from your own network and half from outside it.
- In the weight table published in 2023 a reply counts 13.5, which is 27 times a like (0.5), and a reply that the author responds to counts 75.0, which is 150 times a like.
- Negative signals dominate the 2023 calculation: a report sits at -369.0 in the code, almost five times the highest positive weight (75.0); negative feedback at -74.0 roughly matches that highest positive weight and far exceeds all others.
- The premium boost is documented in the 2023 code (multiplier 4.0 in-network, 2.0 out-of-network, original posts only), while a link penalty and a 30 to 60 minute window are not.
- The old twitter/the-algorithm repository received a large update in September 2025 with Grok components for categorization, filtering and a slop score plus a new Phoenix scorer, but without a new weight table.
- Since January 2026 X has published its rebuilt algorithm in the xai-org/x-algorithm repository, and since August 13, 2026, it has included weights that are synced from production several times a week. In the sync of October 12, 2026, a reply weighed 5.0, a like 0.6 and a report -234.0, which makes the 2023 table a historical snapshot. By October 13 the like already stood at 0.66.
The only platform whose ranking you can read
On March 31, 2023, X published the source code of the For You timeline in two GitHub repositories. Since then the ranking rules of exactly one major social platform can be read in the original. Instagram, TikTok, LinkedIn and YouTube supply statements, blog posts and the occasional architecture paper, while the concrete weights stay internal. At X they sat in a file as numbers.
That makes the code valuable, but only if you keep two things apart: what is actually in the repository, and what has been claimed on top of it in the years since. A good share of the popular X reach advice is not in there. How recommender systems work in principle (candidate generation, light ranking, heavy ranking, re-ranking) is described in Recommendation Algorithm: How Social Media Algorithms Rank. This article is about the documented details of one concrete system.
One caveat up front: the 2023 weight table dates from April 2023, and the associated ML repository has not been touched since. The old main repository received one more large update in September 2025. In January 2026 a new repository followed, xai-org/x-algorithm, with a rebuilt system and, since August 2026, current weights. The 2023 numbers therefore describe a historical state; the current ones are in the section on the 2026 code. This article is current as of October 2026.
Twitter algorithm: how For You turned millions of posts into 1,500 in 2023
According to the 2023 engineering blog, X pulls around 1,500 candidates per request from a pool of hundreds of millions of posts and scores them with a neural network of roughly 48 million parameters that is continuously retrained on post interactions. About half of the content served came from the user's own network at the time, the other half from outside it. In the old repository the ranking component is called heavy-ranker.
The candidates come from several sources named in the README of the 2023 main repository:
- search-index: finds and ranks posts from your own network, around 50% of the content served according to the README.
- tweet-mixer: collects out-of-network candidates, meaning content from accounts a user does not follow.
- UTEG on GraphJet: traverses the interaction graph, pulling posts that people you interact with have interacted with.
- SimClusters and TwHIN: community detection with sparse embeddings and dense knowledge graph embeddings for users and posts respectively. Both assign accounts and content to interest clusters without any follow relationship.
Alongside these, the README lists components that only come into play after candidate retrieval: real-graph predicts how likely a user is to interact with one particular other user, the trust-and-safety-models detect NSFW and abusive content, the visibility-filters filter content out or downrank it, and the heavy-ranker scores everything that gets through.
This split decides more about reach than any weight in the ranking. A post that makes it into no candidate list is never scored. In 2023, anyone writing only into their own network was playing for only half of the available impressions, and the other half ran through embeddings and graph traversal.
Two things follow from this in practice. First, embedding-based sources depend on being classifiable: SimClusters and TwHIN can only assign an account to an interest cluster if its content is thematically recognizable. A profile whose posts scatter across topics hands these sources a blurred signal. Second, in the 2023 system the interaction graph via UTEG was a candidate source in its own right. Replies therefore worked twice: as a heavily weighted signal in the ranking, and as an edge in the graph through which later posts reached other people's timelines. In the new system the tweet-mixer source is switched off by default according to param.rs; out-of-network candidates come from Phoenix retrieval, SimClusters and a list of popular posts.
Your follower count is accordingly an upper bound for part of the distribution, not a distribution list. As a rule of thumb for planning: distribution shifts from the question of who someone follows to the question of what interests users with similar behavior. Every post is effectively tested against the entire pool again.
The 2023 weights: replies beat likes by a factor of 27
The most interesting part sits in the README of the ML repository, as of April 2023: in the heavy ranker's weight table a reply counts 13.5 and a like 0.5. A post's score there is the weighted sum of predicted interaction probabilities. The model estimates for every candidate how likely each action is and multiplies those probabilities by fixed factors.
Signal (name in the code) | Weight | Factor versus a like |
|---|---|---|
report | -369.0 | 738x negative |
reply_engaged_by_author | 75.0 | 150x |
negative_feedback_v2 | -74.0 | 148x negative |
reply | 13.5 | 27x |
good_profile_click | 12.0 | 24x |
good_click | 11.0 | 22x |
good_click_v2 | 10.0 | 20x |
retweet | 1.0 | 2x |
fav (like) | 0.5 | 1x |
video_playback50 | 0.005 | 0.01x |
Three things stand out here. First, conversation beats consumption, and by a wide margin. The highest positive weight belongs to reply_engaged_by_author: the reply that the original author in turn responds to. What is modeled is the probability of a dialogue. The top value in the table therefore hangs on the author's own behavior, and whoever answers replies produces the most expensive signal on the list.
Second, negative signals are the most expensive position in the calculation. A report sits at -369.0 in the table, almost five times the highest positive weight (75.0). Negative feedback at -74.0 roughly matches that highest positive weight and far exceeds all others. Anyone sharpening their tone on purpose raises two predictions at once: the one for replies and the one for negative reactions. The outcome depends on which of the two the model rates higher for a given audience.
Third, in 2023 video was practically irrelevant in the ranking: video_playback50 stands at 0.005. The table has not been updated since April 2023, and the README itself notes that the exact weights can be adjusted at any time. It therefore describes a historical state. The weights X has published since August 2026 are covered further down.
Interaction signals working as a ranking factor is not a social media specialty, incidentally. In web search, NavBoost is a confirmed system of the same kind.
What is in the code and what is only claimed
Rules circulate about the X algorithm that sound as if they had been read out of the code and do not appear in it. The check comes out mixed.
Common claim | Documented in the 2023 code? | What is verifiable |
|---|---|---|
Replies count far more than likes | Yes | reply 13.5 versus fav 0.5 |
X Premium brings a reach boost | Yes | Multiplier 4.0 in-network, 2.0 out-of-network, original posts only |
External links are penalized | No | The code contains only a parameter list for competitor URLs, no link penalty |
The first 30 to 60 minutes decide | No | No such time window appears in the code |
The premium boost is the most clearly documented point: a multiplier of 4.0 for verified authors in their own network and 2.0 outside it sits as a parameter in the code, applied exclusively to original posts, not to replies. In the old twitter/the-algorithm repository, as reworked in September 2025, this parameter no longer exists under that name, and the weights in the new repository (param.rs) contain no premium multiplier.
With links the situation differs from what most guides claim. That posts with an external link receive less reach is widely reported and communicated by the platform itself, but it is not in the disclosed code. Nor is there a golden hour with fixed thresholds. A cold start test on small audiences exists in every recommender system, while the circulated fixed thresholds belong to folklore. How to tell a real reduction in reach from normal cold start variance is covered in What Is a Shadowban? Link Penalty, Cold Start and Myths.
The 2025 code: Grok, Phoenix and a slop score
On September 3, 2025, a commit with more than 65,000 added lines landed in the old main repository twitter/the-algorithm. It brings a set of Grok-based components into home-mixer and tweet-mixer.
- Categorization: GrokAnnotationsFeatureHydrator, UserEngagedGrokCategoriesFeatureHydrator and GrokTopics assign posts and observed user engagement to Grok categories.
- Candidate source: PopGrokTopicTweetsCandidateSource pulls candidates along these topics.
- Filtering: GrokSpamFilter, GrokNsfwFilter, GrokGoreFilter and GrokViolentFilter sort content out before ranking.
- Quality dampening: a GrokSlopScoreRescorer with its own decay parameter lowers the score of content classified as mass-produced.
- New scorer: a model referred to as Phoenix, with its own activation parameter.
SimClusters are still in the code, among other places when boosting cold posts in content exploration. The widespread claim that a language model has taken over cluster assignment cannot be supported with this. Something else is documented, and it matters more operationally: between post and ranking there now sits a machine assessment of quality and topic. Generic serial posts are classified before they compete for attention.
The slop score is the part with the most awkward side effects for planning. It is built as a rescorer, so it takes effect after candidate generation and dampens the score instead of removing the post. From the outside the result looks like a technical fault: the post is reachable, analytics show impressions, the distribution stays flat anyway. Because the classification sits in the model and not in a rule, there is neither a notification nor a verifiable justification for it.
As a rule of thumb for dealing with this: serial formats with an interchangeable structure, automatically generated variants of the same post and threads that only produce volume all work against precisely this classification. How heavily the Grok components were weighted in production is not apparent from the 2025 code. X only started publishing weights again in 2026, in the new repository.
The 2026 code: a new repository with current weights
In January 2026 X published the code of the For You timeline in a new repository: xai-org/x-algorithm. The system has been rebuilt, mostly in Rust and Python. According to the first README, a Grok-based transformer called Phoenix ranked all candidates, ported from the open-source release of Grok-1. In the same README X stated that it had removed every hand-engineered feature and most heuristics. According to today's Phoenix README, however, that code was only a sample model. Since the release of August 13, 2026, the repository has contained the production implementation, and the current README calls Phoenix simply a transformer model.
The current README describes the setup like this:
- Home Mixer assembles the timeline for each request.
- Thunder keeps recent posts from the accounts you follow in memory and supplies the in-network candidates.
- Phoenix retrieval finds posts from accounts you do not follow. Since the release of August 13, 2026, the code has included SimClusters as an additional out-of-network source.
- Phoenix predicts for every candidate how likely you are to like, reply to, share or report it, or to mute its author. A RankingScorer combines these probabilities into a weighted sum.
- After scoring, heuristics apply, two of which were already in the January README: further posts by the same author are progressively discounted, and posts from accounts you do not follow get a discount. Newly described is a boost for authors with few impressions.
The weights arrived with the same release, in the file home-mixer/params/param.rs. According to the README, cron scripts set the defaults there to the primary production values. In the sync of October 12, 2026, the file contained these values, among others:
Signal (name in the code) | Weight |
|---|---|
ReportWeight (report) | -234.0 |
MuteAuthorWeight (mute author) | -58.8 |
NotInterestedWeight (not interested) | -47.52 |
BlockAuthorWeight (block author) | -31.2 |
ShareViaCopyLinkWeight (copy link) | 20.0 |
ReplyWeight (reply) | 5.0 |
QuoteWeight (quote) | 5.0 |
ShareViaDmWeight (share via direct message) | 5.0 |
FollowAuthorWeight (follow author) | 4.0 |
ShareWeight (share) | 2.0 |
RetweetWeight (repost) | 1.0 |
FavoriteWeight (like) | 0.6 |
A reply therefore weighs a little over eight times a like, down from 27 times in 2023, and a report 390 times. From the first release on August 13 until the sync of October 8, 2026, the like stood at 0.5; only the sync of October 12 raised it to 0.6. The ratio of 468 to 1 between report and like, which the README also mentions, dates from that period. The values keep moving: in the sync of October 13 the like was already at 0.66. For original posts from accounts that you follow and that follow you back, there has been a boost on the reply weight since July 13, 2026, set at 20.0 at first and at 15.0 since July 24. A reply there therefore counts 20.0 instead of 5.0.
The README itself warns against the obvious misreading: the weights multiply predicted probabilities, not counts. One report does not cancel out 390 likes. According to a comment in the code, the baseline probability of a report is more than 1,000 times lower than that of a like. The high weight makes sure this rare prediction affects the ranking at all.
What of this transfers to other platforms
X works as a reference model because it lets you prove here what is merely plausible elsewhere. Three patterns transfer.
- Weighted utility function: ranking is a sum of weighted predictions, not a single factor. The arXiv paper "Choosing the Right Weights" by Milli, Pierson and Garg takes exactly these disclosed Twitter weights as its starting example and examines the consequences empirically on around 70 million Facebook URLs. Every large platform works on this principle, only without published numbers.
- Negative signals: at X they are quantified. At Instagram, TikTok and LinkedIn the structure is comparable, because the same type of model is in use, one that predicts positive and negative user reactions together. Which signals feed in there with which weight is not public.
- Conversation signals: replies, sends and saves are harder to produce than likes and therefore more informative.
And a limit that should not be waved away: only X has disclosed code. Everything circulating as a weighting for Instagram, TikTok, LinkedIn or YouTube is a platform statement or a secondary analysis. Anyone transferring X figures one to one onto Instagram is calculating with invented values.
A realistic expectation of X engagement
The benchmarks for X sit far apart, depending on the reference base. Hootsuite reports an engagement rate of 1.8% for X across industries and globally, as of June 17, 2026, measured as interactions per post divided by followers, against 3.5% on Instagram, 3.4% on LinkedIn, 1.5% on TikTok and 1.3% on Facebook. The 2024 Metricool X study arrives at 1.3% to 2.21% on an international sample, depending on account size. Socialinsider reports 0.10% on a follower basis in its international benchmarks for 2026, covering the period since the fourth quarter of 2025. DACH-specific figures for X are not available.
These values are averages from differently composed samples with different formulas, not statements of cause and effect. They are too coarse for setting targets, but they are enough for a plausibility check: anyone reporting values for X far above this range is probably measuring against reach instead of followers. How to build a reliable baseline of your own is covered in What Is a Good Engagement Rate? Social Media Benchmarks 2026.
What the disclosure does not deliver
The open code answers the structural question. It shows which signals a recommender system evaluates at all, in what order candidates come about, and how heavily negative feedback counts. Since August 2026 the new repository has answered part of the operational question: it contains the default weights, which according to the README match the primary production values. What runs in smaller experiments stays open, because according to the README X only aims to make experiments visible in the repository once they run on a notable share of traffic, for example 10 percent or more. X also deliberately holds back some parts, such as the LLM prompts of the Grox component and some Botmaker rules. Whether the premium boost lives on in another form is not documented either. It is in exactly these gaps that most of the advice literature on X is produced. Sticking to what is verifiable costs you a few comfortable certainties and still leaves more hard substance for X than for any other platform.
Data & Statistics
For You pulls around 1,500 candidates per request from a pool of hundreds of millions of posts, approximately half in-network and half out-of-network; the ranking model has around 48 million parameters.
X/Twitter Engineering Blog, "Twitter's Recommendation Algorithm" (March 31, 2023), archived version (2023)Components according to the README (candidate sources, models, filters): search-index (around 50 percent of posts, in-network), tweet-mixer (out-of-network), UTEG on GraphJet, SimClusters, TwHIN, real-graph (prediction of user-user interaction), trust-and-safety-models (detection of NSFW and abusive content), visibility-filters (filtering and downranking), heavy-ranker (ranking model).
X/Twitter the-algorithm, GitHub README (2023)Heavy ranker weights (as of April 2023): report -369.0; reply_engaged_by_author 75.0; negative_feedback_v2 -74.0; reply 13.5; good_profile_click 12.0; good_click 11.0; good_click_v2 10.0; retweet 1.0; fav 0.5; video_playback50 0.005.
X/Twitter the-algorithm-ml, heavy ranker README (2023)Premium boost in code as of 2023: multiplier 4.0 for verified authors in-network and 2.0 out-of-network, applied only to original posts.
X/Twitter the-algorithm, ScoredTweetsParam.scala (2023)Commit from September 3, 2025, with over 65,000 added lines brings Grok components (annotations, topics, spam/NSFW filters, slop score rescorer) and a Phoenix scorer into home-mixer and tweet-mixer.
X the-algorithm, commit "update for-you recommendations code" (2025)From the first release on August 13 until the sync of October 8, 2026, param.rs set Favorite at 0.5, Reply at 5.0 and Report at -234.0. The report weight was therefore 468 times the like weight.
xai-org/x-algorithm, home-mixer/params/param.rs (sync of October 8, 2026) (2026)In January 2026 X published its rebuilt For You algorithm in the xai-org/x-algorithm repository. The README of that version describes the ranking model Phoenix as a Grok-based transformer that predicts the probability of individual actions for every candidate.
xai-org/x-algorithm, README (January 2026 version) (2026)With the release of August 13, 2026, X replaced the Phoenix sample model, a transformer ported from Grok-1, with the production implementation including training code.
xai-org/x-algorithm, phoenix/README.md (2026)Weights in home-mixer/params/param.rs, sync of October 12, 2026: ShareViaCopyLink 20.0; Reply 5.0; Quote 5.0; ShareViaDm 5.0; FollowAuthor 4.0; Share 2.0; Retweet 1.0; Favorite 0.6; Report -234.0; MuteAuthor -58.8; NotInterested -47.52; BlockAuthor -31.2.
xai-org/x-algorithm, home-mixer/params/param.rs (2026)X published two repositories with the For-You recommendation code on March 31, 2023; the ML repository was last modified on April 5, 2023.
X Blog, "A new era of transparency for Twitter" (2023)The paper "Choosing the Right Weights" uses the disclosed Twitter weights as a starting example and examines linear engagement weighting empirically on approximately 70 million Facebook URLs.
arXiv 2305.17428, Milli, Pierson, Garg (2023)Average engagement rate on a follower basis, across industries and globally: X 1.8%, Instagram 3.5%, LinkedIn 3.4%, TikTok 1.5%, Facebook 1.3%.
Hootsuite, Average Engagement Rate (as of June 17, 2026) (2026)X engagement rate depending on account size 1.3% to 2.21% (international sample).
Metricool X study 2024 (2024)X engagement rate on a follower basis 0.10% since the fourth quarter of 2025 (international sample).
Socialinsider, Social Media Benchmarks 2026 (2026)Opens the chat with a prepared prompt.
Frequently asked questions
Is the Twitter algorithm really open source?
Which signals count most in the X ranking?
Are external links really penalized on X?
Does an X Premium subscription bring more reach?
Does the code published in 2023 still apply in 2026?
How strongly does Grok influence ranking on X?
What is a realistic engagement rate on X?
Want to go deeper?
Get new analyses straight to your inbox, or see how we put this knowledge to work for companies.