5,406,277 AI resources indexedWorking toward the world’s largest AI resource index.

Retrieve then rerank with Sentence Transformers

A local retrieval recipe that searches with a fast first stage and rescores candidate pairs with a cross-encoder.

Published by Sentence Transformers contributors

PDF
No ratings yet

How to use it

Encode corpus passages once and fetch an initial set of candidates for each query. Send the candidate pairs through the cross-encoder and return the highest-scoring passages.

Log both rankings on a small judged query set. The first stage controls what can be recovered, while the reranker only changes the order of the candidates it receives.

Compatibility
Python, Sentence Transformers, PyTorch
Components
Two-stage retrieval, Cross-encoder reranking, Embedding search
Access
Local Python recipe. Download the selected model weights before offline runs.
Official resource