Retrieval and RAGScale and federated operationsPrincipal
How would you fuse ranked results from search services with incompatible scores?
By Amit Kumar3 min readWorked answer includedReviewed 26 Sept 2026
The question
Interview question
Code search, policy search and a vector index each return ten eligible results. Raw-score sorting nearly always removes the policy source, even when it contains the governing rule. Choose and explain a fusion strategy, preserve required-source coverage, and show how your design handles a new source returning one weak hit without treating rank as authority.
Draft your approach first
Take a few minutes before you read the answer. Name the constraint that matters most, the failure you are designing for and how you would know it worked.
Reveal the worked answerWorked answer
A score has meaning inside the system that produced it. BM25 is a lexical ranking method based on matching query terms and corpus statistics. Its values depend on term statistics and fields. A vector similarity may use a different range and orientation. A cross-encoder jointly reads a query and candidate passage to score relevance, potentially on yet another scale. Sorting the raw numbers assumes they are measurements of the same thing, which we have not established. First make the candidate sets eligible: current tenant permissions, product version, document effective time and source scope. Fusion cannot repair a restricted or obsolete source that should not have entered the comparison.
For an initial robust merge, reciprocal rank fusion uses position within each source's ranked list and avoids treating raw scores as commensurate. Elasticsearch's RRF reference shows this rank-based approach. It is a useful baseline, not a proof that rank 1 from an optional incident source has the same authority as rank 1 from the policy source. Keep enough candidates from each required source before the final cutoff. Preserve source identity and coverage so the coordinator knows when a required source is absent or failed.
Reciprocal rank fusion, or RRF, gives a document contributions of 1/(k + rank) from lists in which it appears, then sums those contributions. For a hypothetical k = 60, a document at rank 1 in two lists gets 2/61, about 0.0328. A document at rank 1 in only one gets 1/61, about 0.0164. Agreement improves its fused score without comparing a BM25 number with a cosine score. Candidate depth still matters: a document absent from all supplied windows contributes nothing.
Deduplicate by a stable source identity and revision before treating agreement as independent support. Two services may expose copies of the same document, and repeated chunks can consume the final context budget. This is a ranking contract, not a voting theorem. A copied rumor appearing in several services does not become authoritative policy. Keep source authority, applicable version and mandatory evidence coverage as explicit constraints outside the numerical fusion formula.
If we have representative relevance labels and want controlled weights, normalize or calibrate the component scores on an eligible candidate population, then evaluate the fused result by query type and source. Elastic's linear retriever documentation makes the normalization and weight choices explicit. Per-query min-max scaling can make the best hit in a weak list look strong relative to that list, and a single-item list needs defined handling when minimum equals maximum. The scale also changes when candidate windows change. So I would compare RRF, calibrated combination and source-aware reranking on answer-bearing recall after the context cutoff, unsupported claims and latency. Source authority and required coverage still need explicit rules.
Now add the new source. Its scores and rank distribution are unknown, and a single weak hit can enter a rank-fusion list at rank 1. Do not give it equal influence by default. Start it as a shadow or a bounded candidate lane, label where it actually supplies missing evidence, and canary by query slice. If the policy source times out, a well-merged list of code and incident results cannot justify “no policy exception exists.” The question about a timed-out policy source handles that missing-source case. Fusion is only meaningful after we know which eligible sources actually responded.
Related questions
- How would you diagnose and repartition a hot hybrid-search workload at 10,000 queries per second?Principal
- How would you locate a retrieval regression affecting only newly ingested PDFs?Principal
- How would you migrate embedding models without mixing incompatible vector spaces or losing concurrent updates?Staff
Keep practising retrieval and rag
Follow another question in this area, or search the complete library.
Get my essays on AI engineering and distributed systems by email. Subscribe to ArchCrux