Overview
The Follow Recommendations Service (FRS) is a robust recommendation engine designed to provide users with personalized suggestions for accounts to follow. FRS supports Who-To-Follow (WTF) module recommendations across various Twitter product interfaces and delivers FutureGraph tweet recommendations (tweets from accounts users may want to follow). The service implements a multi-stage pipeline:- Candidate Generation - Use various signals and algorithms to identify candidate accounts
- Filtering - Apply quality and health filters
- Ranking - Score candidates using ML models and heuristics
- Transform - Add social proof, tracking tokens, and other metadata
- Truncation - Trim to optimal result size
Service Definition
FRS is defined infollow-recommendations-service/thrift/src/main/thrift/follow-recommendations-service.thrift
getRecommendations
Returns personalized account recommendations for a user.Request
ClientContext
required
DisplayLocation
required
Location where recommendations will be displayed. Key values:
HOME_TIMELINE(39) - Home timeline WTF modulePROFILE_SIDEBAR(2) - Profile page sidebarEXPLORE_TAB(57) - Explore tab recommendationsNUX_PYMK(67) - New user experience “People You May Know”NUX_INTERESTS(68) - New user interest-based recommendationsPOST_NUX_FOLLOW_TASK(75) - Post-NUX follow taskHOME_TIMELINE_TWEET_RECS(83) - Tweet author recommendations in HomeMagicRecs(59) - Account recommendations in notifications
display_location.thriftDisplayContext
Additional context about the display surface
int32
Maximum number of recommendations to return
string
Cursor for pagination to continue returning results
list<int64>
User IDs to exclude from recommendations (already following, dismissed, etc.)
bool
Whether to include promoted (advertised) accounts in results
DebugParams
Debug parameters for testing and development
string
User’s inferred location state
Response
list<Recommendation>
required
List of account recommendations
UserRecommendation
User account recommendation
int64
required
Recommended user’s ID
Reason
Reason for the suggestion (e.g., social context like “Followed by X”)
AdImpression
Present if this is a promoted account; used for ad impression tracking
string
Tracking token for attribution and analytics
ScoringDetails
Details about how the candidate was scored
string
Identifier for which recommendation flow generated this candidate
map<string, FeatureValue>
Feature switch overrides for this candidate
Exceptions
ServerError
Server-side error occurred
UnknownClientIdError
Client ID is not recognized
NoClientIdError
No client ID was provided
getRecommendationDisplayResponse
Returns recommendations with additional display metadata (headers, footers, presentation settings).Request
Same asgetRecommendations
Response
list<HydratedRecommendation>
required
Header
Header component for the WTF module
Footer component for the WTF module
WTFPresentation
Presentation settings for Who To Follow module
scoreUserCandidates
Scores a provided list of user candidates. Used for feature hydration and logging during data collection.Request
ClientContext
required
Client context
DisplayLocation
required
Display location
list<UserRecommendation>
required
List of user candidates to score
DebugParams
Debug parameters
Response
list<UserRecommendation>
required
Scored candidates (currently returns empty list - used primarily for logging)
debugCandidateSource
Debug endpoint for getting recommendations from a single candidate source. Useful for testing and debugging individual candidate generation algorithms.Request
ClientContext
required
Client context
DebugCandidateSourceIdentifier
required
Identifier for the specific candidate source to test
list<int64>
User-Topic-Tweet (UTT) interest IDs
DebugParams
Additional debug parameters
list<int64>
Recently followed user IDs for context
list<RecentlyEngagedUserId>
Recently engaged user IDs with engagement metadata
list<int64>
Based-on-your-follows seed user IDs
list<int64>
“Similar to” seed user IDs
bool
required
Whether to apply Social Graph Service predicate filtering
int32
Maximum results to return
Response
list<Recommendation>
required
Recommendations from the specified candidate source
executePipeline
Executes a recommendation pipeline and returns the full execution log. Used by debugging tools to understand pipeline behavior.Request
Same asgetRecommendations
Response
PipelineExecutionResult
Complete execution trace including:
- Candidate sources called
- Filters applied
- Ranking scores
- Transform operations
- Timing information
- Feature values
Machine Learning Pipeline
FRS uses ML models for ranking candidates:- Feature Hydration - Fetch user and candidate features
- DataRecord Construction - Build DataRecord for each (user, candidate) pair
- ML Prediction - Send to ML prediction service
- Scoring - Weighted sum of p(follow|recommendation) and p(engagement|follow)
Candidate Sources
FRS supports multiple candidate generation algorithms:- Social graph-based (follow-of-follows, mutual follows)
- Interest-based (topic affinity, entity graphs)
- Geo-based (popular in region)
- Engagement-based (profile visits, search clicks)
- Model-based (SimClusters, embeddings)
Related APIs
- CR Mixer API - Tweet recommendations
- Data Record Formats - ML data format
- Thrift Definitions - Complete type definitions