Skip to content

Conversation

@google-labs-jules
Copy link

This change addresses two logical flaws in the home-mixer ranking algorithms:

  1. Author Diversity Scorer: The diversity penalty was applied to all scores by multiplying with a decay factor (<= 1.0). For negative scores (e.g. from negative signals like blocks/mutes), this multiplication made the score less negative (i.e. increased it), effectively promoting content from authors that should be penalized. The fix ensures the multiplier is only applied to positive scores.
  2. Weighted Scorer: The offset_score function had a discontinuity at 0 due to a special formula for negative inputs. This resulted in arbitrary score jumps for candidates crossing the zero threshold. The fix unifies the offset logic to be linear and continuous for all inputs.

PR created automatically by Jules for task 13179902545450204237 started by @sashimikun

- Fix `AuthorDiversityScorer`: prevent boosting of negative scores by only applying diversity decay to positive scores. Previously, multiplying a negative score by a factor < 1 resulted in a less negative score (boosting it).
- Fix `WeightedScorer`: fix discontinuity in `offset_score` function at zero. Previously, negative scores were handled by a formula that caused a jump in the score function at 0. Now using a continuous linear offset for all scores.
@google-labs-jules
Copy link
Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@sashimikun
Copy link
Owner

@jules write me a before and after test, keep the test script and please provide evidence of improvement or scenario that is easily explained

@google-labs-jules
Copy link
Author

@jules write me a before and after test, keep the test script and please provide evidence of improvement or scenario that is easily explained

I have added a test script home-mixer/demonstrate_fixes.rs to the repository that demonstrates the issues and the fixes.

Here is the output from running the script:

=== Demonstration of Fixes for Ranking Algorithms ===

1. Author Diversity Scorer Fix
Scenario: A candidate has a negative score (e.g., -100.0) due to negative signals.
          It is the 2nd post from the same author, so a decay factor (0.5) applies.

Input Score: -100
Diversity Multiplier: 0.5
Before Fix (Old Logic): -50 (BOOSTED! -50 is better than -100)
After Fix (New Logic):  -100 (CORRECT - score remains low)

-----------------------------------------------------

2. Weighted Scorer Fix
Scenario: Comparing scores just above and below zero to check for continuity.
          Constants: WEIGHTS_SUM=200, NEGATIVE_SCORES_OFFSET=50, NEGATIVE_WEIGHTS_SUM=-100

-- Before Fix (Discontinuity) --
Score -0.001 -> -25.0003
Score +0.001 -> 50.0010
Gap: 75.0012 (Huge jump at zero!)

-- After Fix (Continuous) --
Score -0.001 -> 49.9990
Score +0.001 -> 50.0010
Gap: 0.0020 (Smooth transition)

The script is included in the PR commit.

- Fix `AuthorDiversityScorer`: prevent boosting of negative scores by only applying diversity decay to positive scores.
- Fix `WeightedScorer`: fix discontinuity in `offset_score` function at zero by using a linear offset for all scores.
- Add `home-mixer/demonstrate_fixes.rs`: A standalone Rust script to verify the fixes and demonstrate the before/after behavior.
- Fix `AuthorDiversityScorer`: prevent boosting of negative scores by only applying diversity decay to positive scores.
- Fix `WeightedScorer`: fix discontinuity in `offset_score` function at zero by using a linear offset for all scores.
- Add `home-mixer/demonstrate_fixes.rs`: A standalone Rust script to verify the fixes and demonstrate the before/after behavior.
@sashimikun sashimikun marked this pull request as ready for review January 20, 2026 08:12
- Provided a drafted tweet to explain the bug simply as requested.
Repository owner deleted a comment from google-labs-jules bot Jan 20, 2026
Repository owner deleted a comment from google-labs-jules bot Jan 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant