fix(search): rank episode_mentions_reranker by descending mention count (#1342)#1640
Open
Kayvan-Zahiri wants to merge 1 commit into
Open
fix(search): rank episode_mentions_reranker by descending mention count (#1342)#1640Kayvan-Zahiri wants to merge 1 commit into
Kayvan-Zahiri wants to merge 1 commit into
Conversation
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA behalf on myself, e-mail: kzahiri@dons.usfca.edu |
…nt (getzep#1342) episode_mentions_reranker scored nodes by mention count (higher = more relevant) but sorted ascending, so the least-mentioned nodes ranked highest. Unmentioned nodes also defaulted to inf, which would rank them first once the order is corrected. Sort descending to match rrf/mmr (higher score = better) and default unmentioned nodes to 0 so they rank last. Adds regression tests. Fixes getzep#1342.
Kayvan-Zahiri
force-pushed
the
fix/mentions-reranker
branch
from
July 9, 2026 00:25
ae98702 to
2fb7ec8
Compare
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.
episode_mentions_rerankerscores nodes by how many episodes mention them (higher = more relevant) but sorts ascending, so the least-mentioned nodes rank highest — the opposite of the reranker's intent. Unmentioned nodes also defaulted tofloat('inf'), which would rank them first once the ordering is corrected.Fix
reverse=True) to matchrrfand the MMR reranker, where a higher score means more relevant. (node_distance_rerankersorts ascending correctly because there lower distance is better — this function had copied that pattern, including the misleading# shortest path/# shortest distancecomments, now corrected.)0instead ofinf, so they rank last.Tests
Two regression tests added in
tests/utils/search/search_utils_test.py. Onmainthe first fails (['few', 'many'] != ['many', 'few']); with the fix both pass.Fixes #1342.