Reranking is the process of re-ordering search results to improve relevance, often using a different model than the one used for the initial search. LanceDB has built-in support for reranking with models from Cohere, Sentence-Transformers, and more.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.
Quickstart
To use a reranker, you perform a search and then pass the results to thererank() method.
Supported Rerankers
LanceDB supports several rerankers out of the box. Here are a few examples:| Reranker | Default Model |
|---|---|
CohereReranker | rerank-english-v2.0 |
CrossEncoderReranker | cross-encoder/ms-marco-MiniLM-L-6-v2 |
ColbertReranker | colbert-ir/colbertv2.0 |
Multi-vector reranking
Most rerankers support reranking based on multiple vectors. To rerank based on multiple vectors, you can pass a list of vectors to thererank method. Here’s an example of how to rerank based on multiple vector columns using the CrossEncoderReranker:
Creating Custom Rerankers
LanceDB also allows you to create custom rerankers by extending the baseReranker class. The custom reranker
should implement the rerank method that takes a list of search results and returns a reranked list of
search results. This is covered in more detail in the creating custom rerankers section.