Why raw scores are difficult to combine
A dense retrieval score and a BM25 score are produced by different models and scoring systems. Their numeric ranges, distributions, and sensitivity to query length can differ substantially. A score of 0.7 from one retriever is not inherently comparable to a score of 0.7 from another.
Min-max normalization or hand-tuned weighted sums can appear to work for a small evaluation set, then behave unpredictably as the corpus, embedding model, or query mix changes. The underlying problem is that score calibration is a separate modeling task.
- Dense retrieval helps with semantic similarity and paraphrases.
- BM25 preserves lexical precision for names, codes, and exact phrases.
- Raw-score fusion assumes comparability that may not exist.
- Rank positions are often more stable than score magnitudes.
Fuse ranked lists with RRF
RRF combines result lists using position rather than the original retrieval score. For each document, add a contribution from every list in which it appears: 1 divided by k plus its rank. The constant k reduces the difference between adjacent top positions and prevents the first rank from overwhelming all other evidence.
For a query, retrieve a candidate list from dense search and another from BM25, then compute a fused score for the union of document IDs. Sort by that fused score and return the top results. A document that ranks well in both lists will naturally rise, while a strong result unique to one retrieval method can still remain visible.
- Formula: RRF(d) = Σ 1 / (k + rank_i(d)).
- Use one-based ranks: the first result has rank 1.
- Choose a fixed k and validate it on representative queries.
- Deduplicate by a stable document or chunk identifier before returning results.
Apply the pattern in a Talqora retrieval pipeline
Talqora uses regional S3 Vectors for dense search and Quickwit BM25 for sparse search. An application can treat these as two candidate generators: issue the dense query using the embedded user query, issue the sparse query using the text query, and perform RRF in the application layer before passing the final context to an answer-generation or ranking stage.
Keep retrieval metadata consistent across both paths. Each indexed chunk should carry the same stable ID, source reference, tenant boundary, and filtering attributes where applicable. Consistent identity is what lets the fusion step recognize that two results refer to the same chunk rather than treating them as separate documents.
- Retrieve a bounded candidate set from each path.
- Apply required access-control and tenant filters before fusion.
- Log dense rank, BM25 rank, and fused rank for debugging.
- Evaluate with queries containing both semantic intent and exact terminology.
