Skip to content
47% off: the complete course for $79 (reg. $149)Order now →
AI Builder

AI builder glossary

Reranking

A second retrieval pass where a slower, more precise model rescores a shortlist of candidates against the query and reorders them before generation.

First-stage retrieval, whether vector, keyword, or hybrid, is built for speed across a large collection, so its ordering is approximate. A reranker takes the top few dozen candidates and scores each one against the query directly, usually with a cross-encoder that reads query and passage together, and then reorders them. You keep only the best few for the prompt.

Rerankers matter because the model can only use what you send it, and you can only send a handful of passages without bloating the prompt. Pushing the truly relevant passage from position 15 into the top five is often the biggest single quality gain in a RAG pipeline. Hosted reranking APIs and open-weight reranker models exist; an LLM can also act as a reranker, at higher cost and latency.

The trade-off is latency and money per query, so rerank a shortlist, not the whole corpus. Reranker scores are also more meaningful than fusion scores, which makes them useful for deciding that nothing relevant was found.

Retrieve generously in the first stage, typically a few dozen candidates, then rerank down to what fits. Measure whether recall at your final cutoff actually improves.

Example

A knowledge-base assistant retrieves 40 candidates with hybrid search, reranks them, and sends the top 6 to the model. If the best reranked score falls below a tuned floor, it replies that the docs don't cover the question.

Learn more in the course

Related terms

Go from definitions to doing

Learn to build AI-powered apps in 132 practical lessons.