Skip to main content

Welcome to the X For You Feed Algorithm

The For You feed algorithm retrieves, ranks, and filters posts from two sources: in-network content (from accounts you follow) and out-of-network content (discovered through ML-based retrieval). Both sources are combined and ranked together using Phoenix, a Grok-based transformer model that predicts engagement probabilities for each post.

Overview

Understand how the For You feed works

Architecture

Explore the system architecture and components

Phoenix ML System

Learn about the Grok-based transformer models

API Reference

Browse the complete API documentation

Key Features

The X For You feed algorithm is built on several innovative design principles:

Grok-Based Transformer

Uses transformer architecture from the Grok-1 open source release, adapted for recommendation systems

Candidate Isolation

Special attention masking ensures candidates can’t attend to each other during ranking

Multi-Action Prediction

Predicts probabilities for likes, replies, reposts, clicks, and more

Two-Stage Pipeline

Retrieval narrows millions of candidates to thousands, then ranking orders the final feed

Core Components

The system is built from several key components:

Home Mixer

Orchestration layer that assembles the For You feed

Phoenix

ML component for retrieval and ranking with Grok-based transformers

Thunder

In-memory post store and real-time ingestion pipeline

Candidate Pipeline

Reusable framework for building recommendation pipelines

Design Philosophy

The system relies entirely on the Grok-based transformer to learn relevance from user engagement sequences. No manual feature engineering for content relevance.
This approach significantly reduces complexity in data pipelines and serving infrastructure while enabling the model to discover patterns that hand-engineered features might miss.

Build docs developers (and LLMs) love