How the X (Twitter) algorithm actually works

X is the only large platform that publishes the code ranking its main feed. It also had to add a comment to that code correcting the most-repeated claim about it.

9 minute read

This is the one major feed whose source you can read

Every other guide to a social algorithm is inference from measurement. This one does not have to be. Twitter published a version of its recommendation code in 2023, and xAI replaced it on 20 January 2026 with a new repository covering the Grok-derived system now running the For You feed. TechCrunch reported the release alongside a $140 million European transparency fine handed down the month before, and some observers called the whole exercise transparency theatre. That criticism has force, but it does not change the fact that the code is there. A second release on 13 and 14 August 2026 added the scoring parameters and the visibility-filtering systems, and that is the version worth reading, because the January drop did not include the numbers.

Where candidates come from, and a figure that quietly disappeared

Each request assembles a fresh feed from two pools. In-network candidates come from a service called Thunder, which keeps recent posts from accounts you follow in memory. Out-of-network candidates come from Phoenix retrieval, a learned model that finds posts by embedding similarity, and from SimClusters, which works by community clustering. Both pools are then ranked by the same model, so following someone does not put them in a protected lane. The number everyone quotes — that around half the feed is in-network — comes from the 2023 repository's README, which said roughly 50% of posts came from the in-network search index. The 2026 repository does not restate it. If you see that figure cited as current, it is being carried forward from a system that no longer runs.

Being ranked and being allowed to appear are separate systems

Two mechanisms can stop a post reaching you, and only one of them is ranking. Before scoring, a chain of filters removes candidates outright: anything older than 48 hours, your own posts, duplicates, posts you have already been shown, posts matching your muted keywords, accounts you block or mute, and — importantly for reach — every reply and repost from an account you do not follow. Visibility filtering is a different system again, deciding whether a post appears normally, sits behind an interstitial, or is dropped, based on labels other models attach. X published those label definitions on 13 August 2026, eighteen for posts and twelve for accounts, alongside a pilot tool called Under the Hood that lets eligible accounts download aggregate statistics on their own labels. The Grok prompts that generate several of those labels are deliberately not published.

Phoenix, the model that does the ranking

Phoenix is a transformer, and the same trunk serves both retrieval and ranking. Its main input is your recent engagement history — the production configuration encodes up to 1,022 positions of it — plus context features such as hour of day, post age and surface. For each candidate it outputs one probability per action across a taxonomy of dozens, along with regression heads for continuous values like dwell time. The design detail worth knowing is candidate isolation: candidates can attend to you and to your history, but not to each other. That makes a post's score depend only on you and that post, not on whatever else happened to be in the same batch. There is no hand-written relevance rule anywhere in it.

The weights, and the sentence X had to add to its own README

The final score is a weighted sum across those predicted probabilities. The default weights sit in the public parameter file, and the spread is wide: a predicted like is 0.5, a repost 1.0, a reply 5.0, a quote 5.0, and a share by copied link 20.0. A predicted reply on an original post by someone you mutually follow gets a further boost of 15.0 on top, taking it to 20.0. What matters more than the ordering is what the numbers mean. On 14 August 2026 X added a note to the README, and matching comments in two source files, stating that the weights scale predicted probabilities rather than raw engagement counts — so reading them as count equivalences is simply wrong.

Reply (mutual follow)20.0Share via copy link20.0Reply5.0Quote5.0Share via DM5.0Follow author4.0Share2.0Repost1.0Like0.5Post click0.4Link open0.2
Default positive weights from home-mixer/params/param.rs in X's public repository, read on 29 August 2026. Each multiplies the model's predicted probability of that action, not a count of it, and each is a default that a runtime feature switch can override. The mutual-follow reply figure is the base 5.0 plus a 15.0 boost that applies only to original posts.

The negative signals, and whether mass-reporting works

The same file carries negative weights: not interested at -43.2, block author at -31.2, mute author at -58.8, report at -234.0, and a penalty for scrolling past without dwelling. Those look enormous next to a like at 0.5, and that gap is the source of the widely-shared claim that one report cancels 468 likes. X's own comments say plainly that this is incorrect, and explain why: a report is more than a thousand times rarer than a like, so it needs a large multiplier for the prediction to move the score at all. The code makes a second point about brigading — predictions are personalised, so hostile accounts mostly affect what people like them are shown, and engagement only counts on posts served through the Home Timeline.

Three adjustments applied after the score

The weighted sum is not the last word. Author diversity multiplies each successive post from the same author by a decaying factor, defaulting to a decay of 0.5 down to a floor of 0.25, which is why one account cannot occupy your feed no matter how well it scores. An out-of-network discount multiplies posts from accounts you do not follow by 0.75, and the same discount is applied to replies and reposts from accounts you do follow; inside a topic timeline the factor is 0.5. A new-author boost lifts posts from authors below an impressions threshold toward a target position. A separate reranking service then reorders the result before it is served.

FAQ

Is the X algorithm really open source?

Substantially, yes. xAI published the code behind the For You feed on 20 January 2026 and added the scoring parameters and visibility-filtering systems on 13 and 14 August 2026. Some pieces are deliberately withheld, including the Grok prompts used for content classification and some rule definitions, and the live parameter values can differ from the defaults in the repository.

Does one report really cancel out 468 likes on X?

No, and X added comments to its own code saying so. The ratio is real — report is weighted at -234.0 against 0.5 for a like — but those weights multiply predicted probabilities, not counts of actual engagement. A report is more than a thousand times less likely than a like, so it needs the larger multiplier to influence ranking at all.

Is half the For You feed still from accounts you follow?

That figure comes from the 2023 repository, which stated that around 50% of posts came from the in-network search index. The 2026 repository describes in-network and out-of-network sourcing without publishing a split, so the number is no longer verifiable. What is documented is that out-of-network posts are discounted by a factor of 0.75 after scoring.

How long do posts stay in the For You feed?

The age filter drops candidates older than 48 hours before they reach the ranker, so that is the hard outer limit for organic distribution through the recommendation system. Posts can still be reached directly, through search, or from a profile after that, but they stop being eligible for the For You feed.

Sources

Related pages