Scorer trait with both score and update methods.
Overview
Scorers generate new score values and return updated candidate objects. Theupdate method merges these scores back into the original candidates:
Available Scorers
PhoenixScorer
Uses the Phoenix ML prediction service to generate engagement probability scores for each candidate.Arc<dyn PhoenixPredictionClient>
required
Client for communicating with the Phoenix prediction service
Predicted Actions
Phoenix generates probability scores for the following actions:Option<f64>
Probability the user will like/favorite the tweet
Option<f64>
Probability the user will reply to the tweet
Option<f64>
Probability the user will retweet
Option<f64>
Probability the user will expand photos
Option<f64>
Probability the user will click the tweet
Option<f64>
Probability the user will click the author’s profile
Option<f64>
Probability of video quality view (watching video to completion)
Probability the user will share the tweet
Probability of sharing via direct message
Probability of sharing via copy link
Option<f64>
Probability the user will dwell on the tweet
Option<f64>
Probability the user will quote tweet
Option<f64>
Probability of clicking a quoted tweet
Option<f64>
Probability the user will follow the author
Option<f64>
Probability of negative feedback (“not interested”)
Option<f64>
Probability the user will block the author
Option<f64>
Probability the user will mute the author
Option<f64>
Probability the user will report the tweet
Continuous Actions
Option<f64>
Predicted dwell time in seconds (continuous value, not a probability)
Additional Metadata
Option<u64>
Unique identifier for the prediction request, useful for debugging and logging
Option<u64>
Timestamp (milliseconds since epoch) when the candidate was scored
Implementation Details
Code Example:home-mixer/scorers/phoenix_scorer.rs
home-mixer/scorers/phoenix_scorer.rs
WeightedScorer
Combines Phoenix prediction scores into a single weighted score using configurable weights. Purpose: Translates multiple engagement signals into a single ranking scoreScore Calculation
The weighted score is computed as:home-mixer/scorers/weighted_scorer.rs
apply multiplies each score by its weight:
Configuration Weights
Weights are configured via constants (in the excludedparams module):
- Positive Engagement:
FAVORITE_WEIGHT,REPLY_WEIGHT,RETWEET_WEIGHT,SHARE_WEIGHT, etc. - Negative Signals:
NOT_INTERESTED_WEIGHT,BLOCK_AUTHOR_WEIGHT,MUTE_AUTHOR_WEIGHT,REPORT_WEIGHT(typically negative) - Continuous:
CONT_DWELL_TIME_WEIGHTfor dwell time prediction
Video Quality View (VQV) Eligibility
VQV weight is only applied to videos meeting minimum duration requirements:home-mixer/scorers/weighted_scorer.rs
Score Normalization
The weighted score is normalized and offset-adjusted:home-mixer/scorers/weighted_scorer.rs
Output
Option<f64>
The combined, weighted score used for initial ranking
AuthorDiversityScorer
Applies a decay multiplier to diversify authors within a feed response, preventing dominance by any single author.f64
default:"AUTHOR_DIVERSITY_DECAY"
Exponential decay factor applied to subsequent posts from the same author
f64
default:"AUTHOR_DIVERSITY_FLOOR"
Minimum multiplier value, ensuring even repeated authors aren’t completely suppressed
Diversity Multiplier Formula
home-mixer/scorers/author_diversity_scorer.rs
position is the 0-indexed count of previous posts from the same author.
Example: If decay_factor = 0.8 and floor = 0.5:
- 1st post from author: multiplier = 1.0 (no penalty)
- 2nd post from author: multiplier = 0.9 (0.5 * 0.8^1 + 0.5)
- 3rd post from author: multiplier = 0.82 (0.5 * 0.8^2 + 0.5)
- Converges to floor = 0.5
Algorithm
- Sort candidates by
weighted_score(descending) - Track author occurrence counts
- For each author’s nth post, multiply score by
multiplier(n-1) - Return updated scores in original order
home-mixer/scorers/author_diversity_scorer.rs
Output
Option<f64>
The diversity-adjusted score (weighted_score × diversity_multiplier)
OONScorer
Out-of-Network Scorer that applies a weight factor to out-of-network candidates, typically reducing their scores relative to in-network content.f64
Multiplier applied to out-of-network candidates (configured via
OON_WEIGHT_FACTOR)- If
candidate.in_networkisSome(false), multiply score byOON_WEIGHT_FACTOR - Otherwise, leave score unchanged
home-mixer/scorers/oon_scorer.rs
Output
Option<f64>
The network-adjusted final score
Scorer Pipeline Order
Scorers are typically applied in this sequence:- PhoenixScorer - Generate ML prediction scores
- WeightedScorer - Combine predictions into weighted_score
- AuthorDiversityScorer - Apply diversity adjustments to create score
- OONScorer - Apply final network-based adjustments to score
Score Field Progression
The final
score field is used by selectors to determine the order candidates are served to users.