Skip to main content

Overview

CR-Mixer is a candidate generation service that speeds up iteration and development of candidate generation and light ranking. It acts as a lightweight coordinating layer that delegates candidate generation tasks to underlying compute services. The service provides:
  • Centralized platform for fetching and mixing candidate sources
  • Light ranking layer for candidates
  • Common filtering and deduplication
  • Feature switch management and version control
  • Performance optimization and caching

Service Definition

CR Mixer is defined in cr-mixer/thrift/src/main/thrift/cr_mixer.thrift

getTweetRecommendations

Returns personalized tweet recommendations for a user.

Request

ClientContext
required
Client context containing user identification and device information
int64
User ID requesting recommendations (optional for logged-out users)
int64
Guest ID for logged-out users
int64
Application identifier
string
User’s country code
string
User’s language preference
Product
required
Product surface requesting recommendations. Enum values:
  • Home (1) - Home timeline
  • Notifications (2) - Notification recommendations
  • Email (3) - Email recommendations
  • MoreTweetsModule (4) - Related tweets module
  • ImmersiveMediaViewer (5) - Media viewer
  • VideoCarousel (6) - Video recommendations
  • ExploreTopics (7) - Topic exploration
  • Ads (8) - Ads recommendations
  • HomeRealTime (9) - Real-time home tab
  • TopicLandingPage (10) - Topic pages
ProductContext
Product-specific parameters and configuration options
list<int64>
Tweet IDs to exclude from recommendations (already seen or dismissed tweets)

Response

list<TweetRecommendation>
List of recommended tweets with scores and metadata
int64
required
Unique identifier for the recommended tweet
double
required
Recommendation score (higher is better)
list<MetricTag>
Tags for tracking and attribution
int64
User ID of the tweet author
CandidateGenerationKey
Information about how the candidate was generated (source algorithm, similarity engine)
int64
Timestamp of the most recent engagement signal used (null if not from engagement signals)

Exceptions

ValidationExceptionList
Validation errors with details reported to clients
ServerError
Server errors (details not reported to clients)

getRelatedTweetsForQueryTweet

Returns tweets related to a specific query tweet.

Request

InternalId
required
Internal identifier (tweet ID or user ID) to find related content for
Product
required
Product surface making the request
ClientContext
required
Client context (userId may be None for logged-out users)
list<int64>
Tweet IDs to exclude from results

Response

list<RelatedTweet>
List of related tweets
int64
required
Tweet identifier
double
Similarity/relevance score
int64
Tweet author’s user ID

getRelatedTweetsForQueryAuthor

Returns tweets related to a specific author’s content. Uses the same request/response structure as getRelatedTweetsForQueryTweet.

getUtegTweetRecommendations

Returns tweet recommendations based on User Tweet Entity Graph (UTEG) engagement signals.

Request

ClientContext
required
Client context
Product
required
Product surface
ProductContext
Product-specific parameters
list<int64>
Tweets to exclude

Response

list<UtegTweet>
UTEG-based tweet recommendations
int64
required
Tweet identifier
double
required
Sum of weights of seed users who engaged with the tweet. If a user engaged multiple times (e.g., liked and retweeted), their weight is counted for each engagement.
map<SocialProofType, list<int64>>
required
User social proofs grouped by engagement type (likes, retweets, replies, etc.)

getTopicTweetRecommendations

Returns tweet recommendations for specific topics.

Request

ClientContext
required
Client context
Product
required
Product surface
list<int64>
required
List of topic IDs to get recommendations for
ProductContext
Product-specific parameters
list<int64>
Tweets to exclude

Response

map<int64, list<TopicTweet>>
required
Map from topic ID to list of recommended tweets for that topic
int64
required
Tweet identifier
double
required
Recommendation score
SimilarityEngineType
required
Algorithm used to generate this recommendation (e.g., SimClustersANN, TwHINANN, etc.)

getFrsBasedTweetRecommendations

Returns tweet recommendations based on Follow Recommendations Service (FRS) suggestions - tweets from accounts the user may be interested in following. See Thrift Definitions for complete type definitions.