Data and retrieval

Reranking

Reranking is a second retrieval step in which a more precise model rescores the top results from a first, faster search and reorders them by relevance to the query, so the best passages reach the user or language model first.

A fast search over thousands or millions of passages has to cut corners to return results in milliseconds. Reranking adds a second, slower but more careful pass over just the top candidates, typically the first few dozen, and puts them in a better order. In a RAG system, where only a handful of passages are passed to the model, getting the right passage into that handful is often the single largest improvement in answer quality.

How it works

First-stage retrieval, whether keyword, semantic or hybrid search, compares the query with pre-computed representations of each document. It never reads the query and passage together. A reranker does: it takes each query and passage pair and scores how well the passage answers the query. The common design is a cross-encoder model trained for exactly this task, offered by several providers as an API and available as open models. Some builds use a general language model as the reranker instead, which is more flexible but slower and costlier.

An example: an employee asks "Can I carry unused leave into next year?". The first search returns twenty passages about leave, including policies on sick leave and parental leave. The reranker reads each one against the question and moves the paragraph on carry-over to the top, so the model answering the question sees it first.

What it means for cost

Reranking is usually a modest addition to a retrieval build: one extra API call or model per query and some tuning of how many candidates to rerank. It adds latency, since every candidate has to be scored, and a per-query running cost when a hosted reranker is used. In return it often allows fewer passages to be sent to the language model, which can lower generation costs.

Ask a builder whether reranking is included, how many candidates are rescored, and what measured difference it made on a test set of real questions; see evals. If the retrieval results are already good on that test set, reranking may not be needed. Live figures are on the document search and RAG cost page.

Common questions

Because it is too slow. A reranker reads every query and passage pair together, which is fine for fifty candidates and impractical for a million. The fast first stage narrows the field, and the reranker sorts the shortlist.

Does reranking help if retrieval misses the right passage?

No. Reranking can only reorder what the first stage returns. If the correct passage is not among the candidates, the fix lies earlier, in chunking, the embedding model or adding keyword search.

Related terms

Pricing a build that involves Reranking? Send the brief and get a fixed price set next to the market range.Get a quote