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.Client for communicating with the Phoenix prediction service
Predicted Actions
Phoenix generates probability scores for the following actions:Probability the user will like/favorite the tweet
Probability the user will reply to the tweet
Probability the user will retweet
Probability the user will expand photos
Probability the user will click the tweet
Probability the user will click the author’s profile
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
Probability the user will dwell on the tweet
Probability the user will quote tweet
Probability of clicking a quoted tweet
Probability the user will follow the author
Probability of negative feedback (“not interested”)
Probability the user will block the author
Probability the user will mute the author
Probability the user will report the tweet
Continuous Actions
Predicted dwell time in seconds (continuous value, not a probability)
Additional Metadata
Unique identifier for the prediction request, useful for debugging and logging
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
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.Exponential decay factor applied to subsequent posts from the same author
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
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.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
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
| Field | Type | Set By | Purpose |
|---|---|---|---|
phoenix_scores | PhoenixScores | PhoenixScorer | Raw ML predictions |
weighted_score | Option<f64> | WeightedScorer | Weighted combination |
score | Option<f64> | AuthorDiversityScorer, OONScorer | Final ranking score |
score field is used by selectors to determine the order candidates are served to users.