Skip to main content

Candidate Generation

Candidate generation is the critical first stage of X’s recommendation pipeline, responsible for narrowing down approximately 1 billion potential tweets to a manageable set of thousands of candidates for downstream ranking. This process leverages diverse candidate sources and user behavior signals.

Overview

The candidate sourcing stage uses X user behavior as the primary input to identify potentially relevant content. Multiple specialized systems work in parallel to retrieve candidates from different perspectives.

Input

~1 Billion Tweets

Process

Multi-Source Retrieval

Output

~2-5K Candidates

Candidate Sources

Home Mixer orchestrates multiple candidate sources to retrieve diverse content:

For You Timeline Sources

Earlybird Search Index: Find and rank tweets from accounts the user follows
  • Coverage: ~50% of For You timeline candidates
  • Method: Search index traversal with light ranker scoring
  • Pipeline: ScoredTweetsInNetworkCandidatePipelineConfig
Earlybird combines candidate retrieval with light ranking for efficient in-network scoring

User Signals for Candidate Sourcing

Candidate sources use diverse user behavior signals to identify relevant content:

Explicit Signals

Social Graph

  • Author Follow: Accounts the user follows
  • Author Unfollow: Recently unfollowed accounts
  • Author Mute: Muted accounts
  • Author Block: Blocked accounts

Tweet Engagement

  • Tweet Favorite: Liked tweets
  • Tweet Unfavorite: Unliked tweets
  • Retweet: Retweeted content
  • Quote Tweet: Retweets with comments
  • Tweet Reply: Replied to tweets
  • Tweet Share: Shared tweets
  • Tweet Bookmark: Bookmarked content

Negative Signals

  • Tweet Don’t Like: “Not interested” feedback
  • Tweet Report: Reported tweets

Implicit Signals

  • Tweet Click: Viewed tweet details
  • Tweet Video Watch: Video watch time
  • Notification Open: Opened push notifications
  • Ntab Click: Clicks from notifications tab

Signal Usage by Component

Different candidate sources use signals as features and/or training labels:
USS = User Signal Service, FRS = Follow Recommendation Service

Candidate Source Algorithms

SimClusters

Community detection and sparse embeddings
1

Community Detection

Identify communities of users with similar interests:
2

User Embeddings

Represent users as sparse vectors over communities:
3

Tweet Embeddings

Represent tweets based on engagement from community members:
4

Candidate Retrieval

Find tweets from user’s communities:

TwHIN

Dense knowledge graph embeddings for Users and Tweets
Build heterogeneous graph with multiple entity types:

Real Graph

Predict likelihood of user-to-user interaction

Candidate Pipeline Flow

1

Parallel Retrieval

Query all candidate sources simultaneously:
2

Candidate Merging

Combine candidates from all sources:
3

Basic Filtering

Apply lightweight filters in candidate pipeline:
4

Deduplication

Remove duplicate candidates:
5

Pass to Ranking

Send candidates to feature hydration and scoring:

GraphJet Framework

Many candidate sources (UTEG, Recos-Injector) use the GraphJet framework:

GraphJet

In-memory graph processing for real-time recommendationsKey Features:
  • Real-time graph updates from user actions
  • Sub-millisecond graph traversal queries
  • Bipartite graph representation (users ↔ tweets)
  • Time-decayed edge weights for recency

Performance Characteristics

Reduction Ratio

~1,000,000:1 reduction from all tweets to candidates

Latency

50-200ms total for parallel candidate retrieval

Diversity

Multiple sources ensure diverse content perspectives

Freshness

Real-time graph updates capture latest user behavior

Candidate Quality Signals

Early quality filtering in candidate generation:

Learn More

Ranking Systems

Learn how candidates are scored and ranked

Product Mixer

Explore the pipeline framework orchestrating candidate generation

Navi ML Serving

Understand how embedding models are served