X Algorithm

EXPLORER

System Architecture

Overview

MERMAID DIAGRAM
flowchart TB
    U["User Request"]
    HM["Home-Mixer
Orchestration"]
    P["Phoenix
ML RecSys"]
    T["Thunder
In-Network"]
    ADS["Ads Source"]
    SC["ScoredPosts"]
    FY["ForYou Feed"]
    K["Kafka
Events"]

    U --> HM
    HM --> P
    HM --> T
    HM --> ADS
    P --> HM
    T --> HM
    ADS --> HM
    HM --> FY
    K --> T
    K --> P
    FY --> U

Three-Service Architecture

xAI's feed algorithm is a distributed system with three Rust/Python services orchestrating billions of daily recommendations.

  • Home-Mixer: Entry point — builds query, hydrates user context, fans out to sources
  • Phoenix (JAX/Python): ML core — two-tower retrieval + transformer ranking
  • Thunder (Rust): Real-time — fetches posts from followed users via gRPC
  • Kafka: Asynchronous event backbone connecting all services

~10K LOC

Total Code

3

Services

Python + Rust

Languages

2 (Retrieval + Ranker)

ML Models