Social Media Management

xAI publishes updated X For You algorithm on GitHub

Update adds a runnable pipeline and Grok-based ranker. Production weights and training code stay closed.

Liza Chan
Liza ChanAI & Emerging Tech Correspondent
May 16, 20265 min read
Share:
Stylized illustration of a social media timeline feeding into a transformer model architecture with some elements visible and others obscured

xAI quietly updated X's open-sourced For You feed algorithm earlier this year, and the new release is more substantial than the 2023 original. The repo at xai-org/x-algorithm now ships a runnable inference pipeline, a pre-trained mini Phoenix model, and modules for ads blending and content classification that weren't in the first drop. It's a fuller picture than what Musk called the "quite embarrassing" 2023 release. Still incomplete in the ways that matter most.

What's actually in there

Most prominently, an end-to-end pipeline. A single phoenix/run_pipeline.py entry point now wires retrieval into ranking, mirroring how the two stages compose in production. Out-of-the-box inference works because xAI shipped a frozen mini Phoenix checkpoint as a 3 GB Git LFS archive: 256-dimension embeddings, 4 attention heads, 2 transformer layers. The production model is bigger. xAI doesn't say how much bigger.

Phoenix is the piece worth understanding. It's a transformer ported from Grok-1, the language model architecture xAI open-sourced in 2024, adapted here with custom input embeddings and an unusual attention mask: candidates cannot attend to each other during scoring. That isolation is the trick. It lets one forward pass score hundreds of posts in parallel without contamination between them. The model outputs eleven engagement probabilities per candidate, including the obvious ones (favorite, reply, repost) alongside choices like P(dwell), P(profile_click), and P(follow_author). A weighted sum produces the final score.

The "no heuristics" claim

The Phoenix documentation contains a bold sentence: xAI says it has "eliminated every single hand-engineered feature and most heuristics from the system. The Grok-based transformer does all the heavy lifting." I read it twice to make sure I wasn't missing context.

Scoring is end-to-end neural, sure. But the feed you actually see is still shaped by hand-tuned weights combining the eleven action probabilities, an Author Diversity Scorer that explicitly attenuates repeated authors, an Out-Of-Network Scorer that rebalances non-followed content, and a pre-filtering stage that drops duplicates and expired content before any neural ranking happens. That's a lot of heuristics for a system claiming to have eliminated them. Maybe what they mean is the candidate ranking itself is purely learned. The framing is generous.

What they didn't ship

Training code. The repository contains model architecture, inference, the gRPC service that serves scored posts to the rest of X's stack, and the orchestration layer in Rust. It does not contain the pipeline that produces the production Phoenix weights. xAI is direct about this: "Production Phoenix is trained continuously on real-time data. This release is a frozen checkpoint from that continuous training process, a snapshot at a point in time."

Included for demos: a 537,000-post archive filtered to "Sports" topics from a 6-hour window. That's a toy. The real out-of-network retrieval runs against a global corpus that doesn't ship anywhere.

So what can you actually do with this code? Read the architecture, run inference on the mini model against the sports demo, trace how a request flows through the gRPC service. What you can't do is reproduce X's actual For You ranking, audit what the production model was trained to optimize, or verify that the deployed system behaves the way the open code suggests.

The hydrators tell on themselves

Buried in the release notes is the new list of "query hydrators" that fetch user context before ranking happens: followed topics, starter packs, impression bloom filters, IP, mutual follow graphs, and served history. The IP one is interesting. It means the recommendation system reads where users are connecting from at request time. xAI doesn't elaborate on what it uses IP for, presumably geographic personalization or some flavor of filtering, and the code becomes its own documentation.

And brand safety is its own rabbit hole inside the new ads module. The release describes it as "brand-safety tracking that respects sensitive content boundaries," which is corporate language for advertisers not wanting to appear next to certain posts. How those boundaries are drawn is the detail that would matter, and is not really documented anywhere in the repo.

How this lands

The 2023 release was widely criticized for being theater. Code dropped then couldn't actually be run, didn't include model weights, and contained variables like author_is_elon that looked more like embarrassment than transparency. This new drop is structurally better. It's runnable. It's coherent. The architecture documentation is genuinely informative for anyone trying to understand how modern feed ranking actually works.

xAI still controls every meaningful lever. The weights are theirs. The training data is theirs. The continuous retraining is theirs. What's open is the shape of the box.

That might still be useful. Researchers will pull this apart over the coming weeks, particularly anyone trying to understand whether Grok-style transformers generalize cleanly beyond language modeling. The interesting open question, separate from the transparency one: candidate-isolated transformers are an unusual design. If they work as well in production as xAI implies, expect the pattern to propagate.

Tags:X algorithmPhoenixGrokopen sourcerecommendation systemsxAIsocial mediamachine learning
Liza Chan

Liza Chan

AI & Emerging Tech Correspondent

Liza covers the rapidly evolving world of artificial intelligence, from breakthroughs in research labs to real-world applications reshaping industries. With a background in computer science and journalism, she translates complex technical developments into accessible insights for curious readers.

Related Articles

Stay Ahead of the AI Curve

Get the latest AI news, reviews, and deals delivered straight to your inbox. Join 100,000+ AI enthusiasts.

By subscribing, you agree to our Privacy Policy. Unsubscribe anytime.

xAI Updates X For You Algorithm Code on GitHub | aiHola