Skip to content

feat: retrival eval title fallback add fuzzy matching#434

Merged
e06084 merged 3 commits into
MigoXLab:devfrom
e06084:dev
Jun 15, 2026
Merged

feat: retrival eval title fallback add fuzzy matching#434
e06084 merged 3 commits into
MigoXLab:devfrom
e06084:dev

Conversation

@e06084

@e06084 e06084 commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces fuzzy title matching capabilities and fallback metrics computation to the retrieval evaluation pipeline. Specifically, it adds configuration options and CLI arguments for fuzzy matching, implements character n-gram prefiltering to optimize candidate selection, and updates the hit resolution logic to use SequenceMatcher. Additionally, it expands standard retrieval metrics (adding NDCG@100, Recall@20, Precision@10, and MAP@10) and introduces a fallback mechanism to compute metrics from search traces when MTEB results are empty or tasks fail. The review feedback suggests a valuable performance optimization in the fuzzy matching loop of resolve_hit by leveraging real_quick_ratio() and quick_ratio() to skip expensive similarity computations for unlikely candidates.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +173 to +180
for candidate_norm, candidate_ids in iterable_candidates:
score = SequenceMatcher(None, norm, candidate_norm).ratio()
if score > best_score:
second_score = best_score
best_score = score
best_ids = candidate_ids
elif score > second_score:
second_score = score

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using SequenceMatcher.ratio() in a loop over hundreds of candidates for every search hit can be extremely slow and lead to significant performance bottlenecks. We can optimize this by leveraging real_quick_ratio() and quick_ratio(), which are fast-to-compute upper bounds of the true ratio. If these upper bounds are less than or equal to the current second_score, we can safely skip the expensive ratio() computation.

        for candidate_norm, candidate_ids in iterable_candidates:
            matcher = SequenceMatcher(None, norm, candidate_norm)
            if matcher.real_quick_ratio() <= second_score:
                continue
            if matcher.quick_ratio() <= second_score:
                continue
            score = matcher.ratio()
            if score > best_score:
                second_score = best_score
                best_score = score
                best_ids = candidate_ids
            elif score > second_score:
                second_score = score

@e06084 e06084 merged commit f65bb62 into MigoXLab:dev Jun 15, 2026
2 checks passed
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.

2 participants