Why raw dense and sparse scores should not be added directly
Talqora uses regional S3 Vectors for dense search and Quickwit BM25 for sparse search. These retrieval methods produce scores with different meanings: a dense-search score reflects vector similarity, while BM25 is driven by term frequency, document frequency, and field-length effects.
Adding those values together without calibration can make one retrieval path dominate for accidental numerical reasons rather than relevance. A score range can also shift as embeddings, indexes, analyzers, or corpus composition change. Rank fusion avoids depending on a shared score scale.
- Use dense retrieval for semantic similarity and paraphrased language.
- Use BM25 for exact phrases, product names, codes, and uncommon terms.
- Treat each retriever's ordered result list as the stable interface for fusion.
Apply Reciprocal Rank Fusion to the two result lists
Request a candidate list from both retrievers for the same query. For every document appearing in either list, assign an RRF contribution based on its position: 1 divided by k plus its rank. Sum the contribution from the dense list and the BM25 list, then sort documents by the combined total.
The constant k reduces the difference between adjacent top ranks and prevents a single rank-one result from overwhelming all other evidence. It is a tuning parameter, not a universal truth; keep it explicit in application configuration and evaluate changes against representative queries.
- RRF score(d) = Σ 1 / (k + rank_i(d)).
- Use one-based ranks: the first result has rank 1.
- A missing document from a list contributes zero for that retriever.
- Deduplicate by a stable document or chunk identifier before returning results.
Retrieve broadly, fuse deterministically, then inspect failures
Choose a candidate depth that gives both systems a chance to contribute. If each retriever returns too few results, a useful item may never reach the fusion step. After fusion, return the top results or pass a bounded set of fused candidates to a later application-specific stage.
Evaluation should include query groups that expose the difference between retrieval styles: exact identifiers, acronym-heavy requests, natural-language questions, and queries with vocabulary mismatch. Review not only whether a relevant item appears, but also whether it appears early enough to be useful.
- Log the dense rank, BM25 rank, and fused rank for returned documents.
- Keep the same filters and access rules on both retrieval paths.
- Test candidate depth and k separately; changing both at once obscures the cause of a result shift.
- Preserve source-specific ranks to diagnose why a document was promoted or demoted.
