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
Client context containing caller/client level information
User ID requesting recommendations
Guest ID for logged-out users
Application identifier
Client IP address
Client user agent string
Inferred country code
Inferred language code
Device identifier
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.thriftAdditional context about the display surface
Maximum number of recommendations to return
Cursor for pagination to continue returning results
User IDs to exclude from recommendations (already following, dismissed, etc.)
Whether to include promoted (advertised) accounts in results
Debug parameters for testing and development
User’s inferred location state
Response
List of account recommendations
User account recommendation
Recommended user’s ID
Reason for the suggestion (e.g., social context like “Followed by X”)
Present if this is a promoted account; used for ad impression tracking
Tracking token for attribution and analytics
Details about how the candidate was scored
Identifier for which recommendation flow generated this candidate
Feature switch overrides for this candidate
Exceptions
Server-side error occurred
Client ID is not recognized
No client ID was provided
getRecommendationDisplayResponse
Returns recommendations with additional display metadata (headers, footers, presentation settings).Request
Same asgetRecommendations
Response
Header component for the WTF module
Footer component for the WTF module
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
Client context
Display location
List of user candidates to score
Debug parameters
Response
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
Client context
Identifier for the specific candidate source to test
User-Topic-Tweet (UTT) interest IDs
Additional debug parameters
Recently followed user IDs for context
Recently engaged user IDs with engagement metadata
Based-on-your-follows seed user IDs
“Similar to” seed user IDs
Whether to apply Social Graph Service predicate filtering
Maximum results to return
Response
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
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