X Algorithm is the core system powering the "For You" recommended feed on the X platform. Open-sourced by xAI on May 15, 2026, it uses a Rust + Python hybrid architecture, deeply integrating social graphs with interest graphs, and employs Grok Transformer for end-to-end post scoring — replacing traditional hand-crafted feature engineering.
The system processes posts from 11+ candidate sources, applies 17+ filters, and uses a 19-dimensional signal model to predict user engagement probability, ultimately delivering a personalized feed through a multi-stage pipeline.
Orchestration layer written in Rust. Provides two gRPC services: ForYouFeedServer and ScoredPostsServer. Coordinates the entire recommendation pipeline.
Social graph retrieval engine in Rust. Retrieves posts from followed accounts and social connections. Updated in real-time via Kafka streams.
Scoring module in Python/JAX+Haiku. Dual-tower retrieval + Transformer ranking. Predicts 19 engagement signals for each post.
Multimodal embedding generation in Python. Generates 1024-dimensional embeddings for posts, users, and interactions. Powers semantic understanding.
Rust Trait-based pipeline framework. Defines the candidate generation and filtering pipeline with 11+ sources and 17+ filters.
| Component | Language | Framework | Responsibility |
|---|---|---|---|
| Home Mixer | Rust | Tokio + Tonic (gRPC) | Orchestration layer |
| For You Pipeline | Rust | async/await | Candidate pipeline orchestration |
| Thunder | Rust | Kafka + Redis | Social graph retrieval |
| Phoenix | Python | JAX + Haiku | Post scoring and ranking |
| Grox | Python | PyTorch | Multimodal embedding generation |
| Candidate Pipeline | Rust | Trait-based | Candidate generation framework |
The Phoenix module predicts 19 engagement signals for each post, divided into positive feedback (15) and negative feedback (4):
Each signal is multiplied by a configurable weight, summed, and normalized. The weights are externally configurable, allowing X to adjust the algorithm without code changes.
To prevent information cocoons, the system applies an exponential decay penalty when multiple posts from the same author appear in the feed. The decay rate λ is configurable, ensuring diverse content sources while still showing high-quality content from popular authors.
X Algorithm represents a significant step forward in recommendation system transparency. By open-sourcing the complete codebase, Musk and xAI have provided the research community with an industrial-grade reference implementation.
Key architectural decisions — Rust for performance-critical paths, Python for ML models, Transformer-based scoring, and configurable weighting — reflect years of production experience at scale.
This system provides an industrial-grade reference for recommendation system researchers.