Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.lancedb.com/llms.txt

Use this file to discover all available pages before exploring further.

Reciprocal Rank Fusion Reranker

Reciprocal Rank Fusion (RRF) is a model-free way to merge several ranked result lists into a single ordering. Rather than comparing raw similarity scores (which aren’t directly comparable across, say, a vector search and a full-text search), RRF looks only at each document’s rank position in each list. It scores every document with the formula 1 / (rank + K), sums those contributions across the lists, and re-sorts by the total. Documents that rank highly in more than one search rise to the top. Because there’s no model to load or call, it’s fast and cheap, which is why it’s the default reranker for LanceDB hybrid search. The implementation follows the Cormack et al. paper.
Supported query types: hybrid search and multi-vector reranking. Because RRF fuses two or more ranked lists, it can’t rerank a single vector or full-text result set on its own. Calling rerank_vector or rerank_fts on an RRFReranker raises NotImplementedError.

Accepted Arguments

ArgumentTypeDefaultDescription
Kint60A constant used in the RRF formula (default is 60). Experiments indicate that k = 60 was near-optimal, but that the choice is not critical.
return_scorestr"relevance"Options are “relevance” or “all”. The type of score to return. If “relevance”, will return only the _relevance_score. If “all”, will return all scores from the vector and FTS search along with the relevance score.

Multi-vector reranking

RRFReranker can also fuse the results of several vector searches with rerank_multivector, applying the same rank-fusion algorithm across more than two lists. Every input result set must include the _rowid column, so add .with_row_id(True) to each table.search(...) call before reranking, otherwise the call raises a ValueError. See multi-vector reranking for a full example.

Supported Scores for each query type

You can specify the type of scores you want the reranker to return. The following are the supported scores for each query type:
return_scoreStatusDescription
relevance✅ SupportedReturned rows only have the _relevance_score column.
all✅ SupportedReturned rows have vector(_distance) and FTS(score) along with Hybrid Search score(_relevance_score).