Skip to main content

Overview

Home Mixer is the main service used to construct and serve Twitter’s Home Timelines. It powers the For You timeline, Following timeline, and Lists. Home Mixer is built on Product Mixer, Twitter’s custom Scala framework for building feeds of content. The service implements a pipeline architecture that processes requests through multiple stages:
  • Candidate Generation - Fetch tweets from various sources (Earlybird, User Tweet Entity Graph, CR Mixer, FRS)
  • Feature Hydration - Fetch ~6000 features needed for ranking
  • Scoring and Ranking - Use ML models to score and rank candidates
  • Filtering - Apply heuristics for diversity, content balance, and visibility
  • Mixing - Integrate tweets with ads, who-to-follow modules, and other content

Service Interface

Home Mixer uses Product Mixer’s pipeline framework and does not expose a direct Thrift service interface. Instead, it processes requests through:

Product Pipelines

ForYouProductPipelineConfig Handles requests for the main For You timeline.
clientContext
ClientContext
required
Client context including user ID, guest ID, app ID, device information
product
Product
required
Product identifier (e.g., Home, HomeRealTime)
productContext
ProductContext
Product-specific parameters and configuration
maxResults
int32
Maximum number of results to return
cursor
string
Pagination cursor for fetching additional results

Mixer Pipelines

ForYouScoredTweetsMixerPipelineConfig Main orchestration layer that mixes tweets with ads and user recommendations.
tweets
list<ScoredTweet>
List of scored and ranked tweets
tweetId
int64
Unique identifier for the tweet
score
double
Ranking score for the tweet
authorId
int64
User ID of the tweet author
features
map<string, double>
Hydrated features used for ranking
cursor
string
Cursor for pagination

Candidate Sources

Home Mixer fetches tweet candidates from multiple sources:

In-Network Sources

ScoredTweetsInNetworkCandidatePipelineConfig Fetches tweets from accounts the user follows using the Earlybird search index.

Out-of-Network Sources

ScoredTweetsTweetMixerCandidatePipelineConfig Fetches recommended tweets from CR Mixer. ScoredTweetsUtegCandidatePipelineConfig Fetches tweets based on User Tweet Entity Graph engagement signals. ScoredTweetsFrsCandidatePipelineConfig Fetches tweets from accounts recommended by Follow Recommendations Service.

Ranking and Scoring

The service applies ML-based ranking using the ScoredTweetsRecommendationPipelineConfig:
  1. Feature hydration fetches ~6000 features per tweet
  2. ML model computes ranking scores
  3. Filters apply author diversity, content balance, and feedback fatigue rules
  4. Final re-ranking and mixing with non-tweet content

Pipeline Configuration

Pipelines are configured through:
  • Feature Switches - Toggle features on/off for experimentation
  • Decider Keys - Control ranking and filtering logic
  • Model IDs - Specify which ML models to use for scoring

Error Handling

Home Mixer follows Product Mixer’s error handling conventions:
  • Validation errors return detailed error messages to clients
  • Server errors are logged but details are not exposed to clients
  • Partial failures in candidate sources are handled gracefully
  • Circuit breakers prevent cascading failures

Build docs developers (and LLMs) love