Reranker
A model that rescores the top search results against the query, so the most relevant ones go to the language model first.
A reranker is a model that rescores the top search results against the query, so the most relevant ones reach the language model first. It sits between fast retrieval and the prompt: retrieval casts a wide net, and the reranker picks the few passages worth sending.
Fast retrieval returns, say, 50 candidates by rough similarity. A reranker (a cross-encoder or a small LLM) reads the query and each candidate together, which is slower but much more precise, and keeps the best few. Vector search compares two vectors computed separately; a cross-encoder sees both texts at once, so it catches negations and details that vectors blur. The price is an extra model pass per candidate, which adds latency and is why rerankers only see the top few dozen results. In Anthropic’s Contextual Retrieval tests, adding a reranker lowered the top-20 retrieval failure rate from 2.9% to 1.9%.
Fewer, better passages mean a shorter prompt, lower cost and fewer answers built on the wrong document. Whether a reranker earns its latency shows up in ranking metrics such as MRR and nDCG or in context precision. It cannot rescue a passage that retrieval never found. That is a recall problem, solved by hybrid search or better chunking.
Sources
- Sentence Transformers: Cross-Encoders - Sentence Transformers documentation sbert.net
- Anthropic: Contextual retrieval in AI systems anthropic.com
Related terms
- Hybrid search: Combining keyword search (such as BM25) with vector search, so results match both exact terms and meaning.
- RAG (retrieval-augmented generation): Finding relevant documents first and putting them into the prompt, so the model answers from them.
- Chunking (RAG): Splitting documents into smaller passages before indexing them for search, so retrieval returns the relevant part instead of a whole file.
- MRR and nDCG: Ranking metrics for search: MRR scores how high the first relevant result appears, nDCG scores the order of the whole result list.
- Top-k (retrieval): The number of highest-ranked search results passed on to the next step; in RAG, how many passages go into the prompt.
- Context precision: A RAG retrieval metric: whether the passages relevant to the question are ranked at the top of what was retrieved.
- Recall (AI metric): The share of all correct items that the system actually found: of everything it should have caught, how much it did.
