feat(search): implement normalized weighted score fusion for hybrid retrieval - #23
Merged
Merged
Conversation
added 8 commits
September 17, 2026 23:35
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
This PR replaces Qdrant server-side Reciprocal Rank Fusion ($\alpha \cdot \text{Dense} + (1 - \alpha) \cdot \text{Sparse}$ , with default $\alpha = 0.7$ ).
Fusion.RRF) with Normalized Linear Weighted Fusion (Problem
Previously, Qdrant hybrid search used Reciprocal Rank Fusion (
Fusion.RRF). Because RRF calculates scores strictly from reciprocal rank fractions ($1 / (1 + \text{rank})$), top-ranked results scored in the 0.20 – 0.50 range (e.g.RRF Score: 0.3333). In the UI and MCP tools, this appeared counter-intuitively low (as if relevance was only 33%), and diverged from single-vector cosine scoring in pgvector and Chroma (0.70 – 0.95). Furthermore, candidate prefetch was capped atlimit * 2, which caused cross-modality cutoff mismatches.Solution
client.query_batch_pointsin a single network roundtrip.[0.0, 1.0].HYBRID_DENSE_WEIGHTenvironment variable.[0.0, 1.0].Score: XX.X% (X.XXXX)(e.g.,Score: 80.5% (0.8049)).search_code,search_docs) updated toRelevance Score: X.XXXX (XX.X%).Dense + BM25 Normalized Weighted Fusion.frontend/dist.REQUIREMENTS.md(934 automated tests baseline).Verification
test_requirements_sync.pypassed (100%).