Repository navigation
Keep equal-score retrieval candidates stable across repeated queries - #1060
Merged
Merged
Conversation
Signed-off-by: dada-yan <BinjunYann@gmail.com>
WaylandYang
approved these changes
Oct 3, 2026
WaylandYang
left a comment
Contributor
There was a problem hiding this comment.
Thanks @Maya-Kid. Equal RRF scores took the order of a freshly seeded HashMap, so the same query could keep different candidates at the cutoff. Breaking the tie by id after the score is the right fix, and the test at every limit pins it. Landing it.
Merged
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.
Equal RRF scores inherited the randomized iteration order of a
HashMap. With disjoint lexical/vector hits, repeating the same query could change both the evidence order and which candidate survivestop_k; the shared helper also feeds concept mapping selection.Break equal scores by ascending ID after descending score. Regressions cover ties across every cutoff (including zero), reversed channel order, and equal totals formed from different rank contributions. Both new tests failed before the fix.
Validation on this branch:
cargo +1.98.1 fmt --all --checkcargo +1.98.1 clippy --locked --workspace --all-targets -- -D warningscargo +1.98.1 test --locked --workspace: 1,411 passed, with dedicated PostgreSQL 16/pgvector and both database/PDF requirements enabled; 6 existing opt-in tests remain ignoredcargo +1.98.1 build --locked --workspace