X (Twitter) Algorithm: What the Open-Source Code Reveals
Opens the chat with a prepared prompt.
The Twitter algorithm (now X) decides the For You timeline in four steps: gather candidates, pre-sort them, score them with the neural heavy ranker, then mix the final feed. X published this 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.
Key Takeaways
- On 31 March 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 published weight table 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 calculation: a report sits at -369.0 in the code and negative feedback at -74.0, both amounts far above every positive weight in the table.
- 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 main branch received a large update in September 2025 with Grok components for categorisation, filtering and a slop score plus a new Phoenix scorer, but without a new weight table.
- For reach planning the open code is a model, not a live image: the weights date from April 2023, and the README itself points out that they can be adjusted at any time.
The only platform whose ranking you can read
On 31 March 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 published weight table dates from April 2023, and the associated ML repository has not been touched since. The main branch, by contrast, received a large update in September 2025. The open code is therefore a model of the system, not a live image of it. This article is current as of August 2026.
Twitter algorithm: how For You turns millions of posts into 1,500
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 repository the ranking component is called heavy-ranker.
The candidates come from several sources named in the README of the 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 supply the visibility filters, 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. Anyone writing only into their own network is playing for half of the available impressions, and the other half runs 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 recognisable. A profile whose posts scatter across topics hands these sources a blurred signal. Second, the interaction graph via UTEG is a candidate source in its own right. Replies therefore work twice: as a heavily weighted signal in the ranking, and as an edge in the graph through which your later posts reach other people's timelines in the first place.
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 behaviour. Every post is effectively tested against the entire pool again.
The 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 modelled is the probability of a dialogue. The top value in the table therefore hangs on the author's own behaviour, 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, negative feedback at -74.0, and both amounts are far above every positive weight. 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. Whether that still holds today cannot be established, because the table has not been updated since April 2023. The README itself notes that the exact weights can be adjusted at any time. The table therefore describes a state that X has not confirmed for three years.
Interaction signals working as a ranking factor is not a social media speciality, 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 penalised | 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 reworked main branch from September 2025 this parameter no longer exists under that name.
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 3 September 2025 a commit with more than 65,000 added lines landed in the main repository. It brings a set of Grok-based components into home-mixer and tweet-mixer.
- Categorisation: 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 are weighted in production is not apparent from the code, and no new weight table has been published.
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 17 June 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. The operational question stays open: it does not show which weights the For You timeline runs on today, how strongly the Grok components intervene in production, or whether the premium boost lives on in another form. It is in exactly this gap 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 zieht pro Anfrage rund 1.500 Kandidaten aus einem Pool von hunderten Millionen Posts, etwa je zur Hälfte In-Network und Out-of-Network; das Ranking-Modell hat rund 48 Millionen Parameter.
X/Twitter Engineering Blog, "Twitter's Recommendation Algorithm" (31. März 2023), Archivfassung (2023)Komponenten laut README (Kandidatenquellen, Modelle, Filter): search-index (rund 50 Prozent der Posts, In-Network), tweet-mixer (Out-of-Network), UTEG auf GraphJet, SimClusters, TwHIN, real-graph (Vorhersage der Nutzer-Nutzer-Interaktion), trust-and-safety-models (Sichtbarkeitsfilter), heavy-ranker (Ranking-Modell).
X/Twitter the-algorithm, GitHub-README (2023)Heavy-Ranker-Gewichte (Stand 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 im Code-Stand 2023: Multiplikator 4,0 für verifizierte Autoren In-Network und 2,0 Out-of-Network, nur auf Original-Posts angewendet.
X/Twitter the-algorithm, ScoredTweetsParam.scala (2023)Commit vom 3. September 2025 mit über 65.000 hinzugefügten Zeilen bringt Grok-Komponenten (Annotations, Topics, Spam-/NSFW-Filter, Slop-Score-Rescorer) und einen Phoenix-Scorer in home-mixer und tweet-mixer.
X the-algorithm, Commit "update for-you recommendations code" (2025)X veröffentlichte am 31. März 2023 zwei Repositories mit dem Code der For-You-Empfehlung; das ML-Repository wurde zuletzt am 5. April 2023 geändert.
X Blog, "A new era of transparency for Twitter" (2023)Das Paper "Choosing the Right Weights" nutzt die offengelegten Twitter-Gewichte als Ausgangsbeispiel und untersucht lineare Engagement-Gewichtung empirisch an rund 70 Millionen Facebook-URLs.
arXiv 2305.17428, Milli, Pierson, Garg (2023)Durchschnittliche Engagement-Rate auf Follower-Basis, branchenübergreifend und global: X 1,8 %, Instagram 3,5 %, LinkedIn 3,4 %, TikTok 1,5 %, Facebook 1,3 %.
Hootsuite, Average Engagement Rate (Stand 17. Juni 2026) (2026)X-Engagement-Rate je nach Accountgröße 1,3 % bis 2,21 % (internationale Stichprobe).
Metricool X-Studie 2024 (2024)X-Engagement-Rate auf Follower-Basis 0,10 % seit dem vierten Quartal 2025 (internationale Stichprobe).
Socialinsider, Social Media Benchmarks 2026 (2026)FAQ
Is the Twitter algorithm really open source?
Which signals count most in the X ranking?
Are external links really penalised 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.