Add experimental slate-level diversity reranking - #37
Open
therufet721 wants to merge 3 commits into
Open
Conversation
therufet721
marked this pull request as ready for review
August 14, 2026 03:30
therufet721
marked this pull request as draft
August 14, 2026 03:46
therufet721
marked this pull request as ready for review
August 14, 2026 03:47
|
Thank you you don't know how much I appreciate this! |
|
LGTM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Why
Individually relevant posts can still produce a repetitive feed when the top-ranked slate contains repeated authors or adjacent content from the same semantic cluster. This change adds an interpretable, bounded reranking layer while preserving score order whenever the constraints allow it.
Interaction with existing soft author diversity
RankingScoreralready supportsEnableAuthorDiversity, which computesSlateContext.kin its pre-diversity score order and applies a soft score multiplier usingAuthorDiversityDecayandAuthorDiversityFloor. This PR intentionally adds an independently configurable hard guardrail rather than replacing that mechanism: a soft decay discourages repetition but cannot guarantee a maximum.The selector does not reuse
SlateContext.kbecause that value only counts the raw serving/retweetingauthor_id, reflects an earlier pool ordering, and can become stale after VMRanker changes scores. It also is not a count of the selector's dynamically chosen prefix. The selector therefore maintains fresh counts for both the serving author and the original author of retweeted content.Before enabling broadly, evaluation should compare three cells: existing soft decay only, hard cap only, and soft decay plus hard cap. Incremental reorder rate and score/rank displacement from the hard selector should be measured to detect over-diversification.
Configuration
EnableSlateDiversity(default:false)SlateDiversityAuthorWindowSize(default:20)SlateDiversityMaxPostsPerAuthor(default:2)EnableSlateSemanticDiversity(default:truewithin an enabled treatment)SlateDiversityMaxLookahead(default:10)Validation
The standalone harness compiles the same dependency-free engine used by the Home Mixer adapter. Tests cover original-author and serving-author caps, exact semantic-vector matching, partial-vector overlap, fallback ordering, lookahead displacement, degenerate configurations, and 500 deterministic randomized candidate pools verifying that candidates are never lost or duplicated.
Also validated with Rustfmt,
cargo clippy --all-targets -- -D warnings, andgit diff --check.Limitations and follow-ups
home-mixer, so the adapter still requires internal CI compilation.This PR is intentionally draft and the feature remains off by default.