Reranking
Reranking in vector search re-scores the top retrieved candidates with a cross-encoder that jointly encodes query and document, producing a more accurate relevance ordering than bi-encoder similarity.
What is Reranking?
Reranking in vector search re-scores the top retrieved candidates with a cross-encoder that jointly encodes query and document, producing a more accurate relevance ordering than bi-encoder similarity.
Reranking in vector search re-scores the top retrieved candidates with a cross-encoder that jointly encodes query and document, producing a more accurate relevance ordering than bi-encoder similarity.
Where is it used?
Cohere Rerank API, `BAAI/bge-reranker-v2-m3`, and `sentence-transformers` cross-encoders are applied after HNSW or IVF search in LlamaIndex and Haystack pipelines.
How to build it
Retrieve top-50 with dense search, load `CrossEncoder('BAAI/bge-reranker-base')`, call `model.rank(query, docs, top_k=5)`, and return the top-5 re-scored documents for generation.