Skip to main content

Overview

Home Mixer is the primary orchestration service that powers the For You feed on X. It coordinates multiple subsystems to retrieve, rank, and filter posts, returning a personalized feed for each user. The service leverages the Candidate Pipeline framework to compose a multi-stage recommendation pipeline, combining both in-network content (from Thunder) and out-of-network content (from Phoenix Retrieval).

Architecture

Home Mixer exposes a gRPC endpoint (ScoredPostsService) that processes feed requests through a series of pipeline stages:

Pipeline Stages

The PhoenixCandidatePipeline implements the complete feed generation flow:
1

Query Hydration

Fetch user context before retrieving candidates:
  • User Action Sequence: Recent engagement history (likes, replies, reposts)
  • User Features: Following list, preferences, language, country
2

Candidate Sourcing

Retrieve candidates from multiple sources in parallel:
  • Thunder: In-network posts from followed accounts
  • Phoenix Retrieval: Out-of-network posts discovered via ML-based similarity search
3

Hydration

Enrich candidates with additional metadata:
  • Core post data (text, media, timestamps)
  • Author information (username, verification status)
  • Video duration for video posts
  • Subscription eligibility
4

Pre-Scoring Filters

Remove ineligible candidates:
  • Duplicates and reposts of same content
  • Posts older than retention threshold
  • Self-posts (user’s own tweets)
  • Blocked/muted authors
  • Muted keywords
  • Previously seen/served posts
5

Scoring

Apply multiple scorers sequentially:
  • Phoenix Scorer: ML predictions from transformer model
  • Weighted Scorer: Combine predictions into relevance score
  • Author Diversity Scorer: Attenuate repeated authors
  • OON Scorer: Adjust out-of-network content scores
6

Selection

Sort by final score and select top K candidates
7

Post-Selection Processing

Final validation and cleanup:
  • Visibility filtering (spam, violence, gore detection)
  • Conversation deduplication
8

Side Effects

Cache request information for future optimizations

Implementation

The pipeline is constructed using the builder pattern, assembling all components:
home-mixer/candidate_pipeline/phoenix_candidate_pipeline.rs

Request Flow

When a user requests their For You feed:
home-mixer/server.rs

Key Components

Sources

Two primary candidate sources run in parallel:

Thunder Source

Retrieves recent posts from accounts the user follows (in-network)

Phoenix Source

ML-based retrieval of relevant posts from the global corpus (out-of-network)

Filters

Home Mixer applies extensive filtering to ensure feed quality:

Scorers

Multiple scorers combine to produce the final relevance score:
1

Phoenix Scorer

Calls the Phoenix ranking model to get ML predictions for each engagement type (like, reply, repost, etc.)
2

Weighted Scorer

Combines multiple predictions into a single relevance score using weighted sum
3

Author Diversity Scorer

Attenuates scores for posts from the same author to ensure feed diversity
4

OON Scorer

Adjusts scores for out-of-network content based on user preferences

Configuration

Key parameters controlling pipeline behavior:

Performance Characteristics

The pipeline is highly optimized for low latency:
  • Parallel execution: Sources and hydrators run concurrently
  • Sub-millisecond lookups: Thunder provides in-memory access to recent posts
  • Batch prediction: Phoenix scores all candidates in a single inference call
  • Streaming responses: gRPC with Zstd compression for efficient transport
Typical request latency: 100-300ms end-to-end

Monitoring

Home Mixer emits detailed metrics at each pipeline stage:

Candidate Pipeline

Framework that powers Home Mixer’s orchestration

Phoenix

ML component for retrieval and ranking

Thunder

In-memory post store for in-network content

Example Request

Set in_network_only: true to disable Phoenix retrieval and only return posts from followed accounts.