Hybrid retrieval pipeline
Notes on combining keyword and vector candidates before reranking search results.
This prototype combines BM25 and vector retrieval, merges the candidate documents, and sends a smaller set to a cross-encoder reranker.
The public notes do not include a labeled evaluation set or measured retrieval scores.
Candidate retrieval
Keyword search is useful for names, identifiers, and terms that must appear in the result. Vector search adds candidates for queries phrased differently from the source text.
Keep document and chunk IDs consistent across both indexes. Deduplicate merged candidates by those IDs before reranking.
BM25 and vector scores have different scales. Use a rank-based merge or a calibrated score combination; directly adding the raw scores gives an arbitrary weighting.
Reranking
A cross-encoder evaluates query-document pairs. Limit the candidate count and passage length so the additional work stays within the request’s latency budget.
Record where each candidate came from and its rank before and after reranking. That makes a poor result easier to trace to candidate retrieval or final ordering.
Evaluation
Compare keyword-only, vector-only, merged, and reranked results on the same labeled queries. Include exact identifiers, paraphrases, ambiguous terms, and queries with no relevant document.
Track recall at the candidate stage, ranking quality in the final results, and end-to-end latency. Record the corpus revision, chunking, embedding model, and reranker version with each run.
Technologies: BM25, Dense embeddings, Cross-encoder reranking.