Overview
Home Mixer is the main service used to construct and serve Twitter’s Home Timelines. Built on Product Mixer, Twitter’s custom Scala framework for building content feeds, it currently powers:- For You - Best tweets from people you follow + recommended out-of-network content
- Following - Reverse chronological tweets from people you follow
- Lists - Reverse chronological tweets from List members
Architecture
Home Mixer is built on Product Mixer, a custom Scala framework that facilitates building feeds of content through structured pipelines.Pipeline Structure
Product Mixer services are structured around Pipelines that split execution into transparent and structured steps:Product Pipelines
Requests first go to Product Pipelines, which select which Mixer Pipeline or Recommendation Pipeline to run for a given request.
Mixer/Recommendation Pipelines
Each pipeline may run multiple Candidate Pipelines to fetch candidates:
- Mixer Pipelines combine results of multiple heterogeneous Candidate Pipelines (e.g., ads, tweets, users)
- Recommendation Pipelines score and rank results of homogeneous Candidate Pipelines
For You Timeline
The For You recommendation algorithm involves several key stages:1. Candidate Generation
Fetch tweets from various candidate sources:- Earlybird Search Index - Real-time tweet search index
- User Tweet Entity Graph (UTEG) - Graph-based tweet recommendations
- CR Mixer - Candidate generation and mixing service
- Follow Recommendations Service - Account recommendations for tweet discovery
2. Feature Hydration
Fetch approximately 6,000 features needed for ranking. These features include:- User engagement history
- Tweet metadata and content features
- Author features
- Real-time signals
3. Scoring and Ranking
Apply machine learning models to score and rank candidates based on predicted user engagement.4. Filters and Heuristics
Author Diversity
Ensure variety in tweet authors shown to users
Content Balance
Mix in-network vs out-of-network content appropriately
Feedback Fatigue
Reduce content similar to previously dismissed tweets
Visibility Filtering
Remove blocked, muted authors/tweets and apply NSFW settings
5. Mixing
Integrate tweets with non-tweet content:- Ads
- Who-to-follow modules
- Prompts and engagement modules
6. Product Features and Serving
- Conversation modules for replies
- Social context (“Liked by…”, “Followed by…”)
- Timeline navigation
- Edited tweets support
- Feedback options
- Pagination and cursoring
- Client instructions and content marshalling
Pipeline Configurations
For You Pipeline Hierarchy
The
ForYouConversationServiceCandidatePipelineConfig serves as a backup reverse chronological pipeline in case Scored Tweets fails.Following Pipeline Hierarchy
Lists Pipeline Hierarchy
Key Components
Product Pipeline Config
The main entry point for the For You timeline:Performance Considerations
Related Services
- CR Mixer - Candidate generation and mixing
- Follow Recommendations Service - Account recommendations
- Timeline Ranker - Legacy ranking service
- Tweetypie - Tweet data service