xAI

X open-sources algorithm powered by Grok AI

Published

on

On January 20, 2026, the X (formerly Twitter) team announced the release of the source code for the platform’s new recommendation algorithm. This comes after the company owner, Elon Musk, promised to open-source the full code behind organic and ad recommendations within days. He also said that updates to the code will come every four weeks, including detailed developer notes.

The code is now available on GitHub at xai-org/x-algorithm. The algorithm is used to personalize the “For You” feed, deciding which posts users see. It uses a transformer model based on the same architecture as xAI’s Grok-1, using machine-learning.

Unlike older systems, this version removes all manual rules and hand-crafted features. The transformer model handles everything by learning directly from user behavior. It predicts how likely a user is to engage with a post in different ways, such as liking, replying, reposting, clicking, watching a video, or dwelling longer on the content. It also predicts negative actions, like blocking, muting, or reporting.

The final score for each post is a weighted sum: positive actions get positive weights, while negative ones subtract from the score. This helps show content users will enjoy and hide what they dislike.

Posts come from two main sources. “In-network” posts are from accounts the user follows, handled quickly by a component called Thunder. “Out-of-network” posts come from the wider platform, found through a similarity search system called Phoenix that matches posts to the user’s interests.

The process is managed by Home Mixer, which gathers user history, pulls candidate posts, adds details like media and author info, filters out duplicates, old posts, blocked users, or muted topics, then scores and ranks them. An extra step reduces scores for repeated authors to keep the feed varied.

“We know the algorithm is dumb and needs massive improvements, but at least you can see us struggle to make it better in real-time and with transparency. No other social media companies do this.” Musk wrote on X social media following the open-source algorithm announcement.

The code is mostly written in Rust and Python, designed to be fast, modular, and easy to extend.

This open-sourcing brings full transparency to how X curates feeds. By sharing the Grok-powered system with no hidden tweaks, X is inviting developers and users to study, understand, and potentially suggest improvements to one of the world’s largest social recommendation systems.

Exit mobile version