API glossary

Reranking

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Reranking is a second-stage process that reorders an initial list of search results to put the most relevant ones first. A fast first-stage retriever pulls a broad set of candidate results, and the reranker then scores each candidate more carefully against the query (using a slower but more accurate model) and sorts them by that score. Reranking is the precision step that comes after the recall step.

In short: reranking takes a rough first set of results and reorders them with a more accurate model, so the best matches for a query rise to the top.

How reranking works

Reranking is the second half of a two-stage retrieval pipeline:

  1. First-stage retrieval: A fast method such as keyword search, vector search, or hybrid search returns a broad set of candidates, often the top 50 or 100, favoring recall over precision.
  2. Scoring: A reranking model, often a cross-encoder, reads the query and each candidate document together and outputs a relevance score. Because it evaluates the pair jointly at query time, a reranker can often judge relevance more accurately on top candidates than first-stage retrieval alone, though gains depend on model quality, domain fit, and candidate-set recall.
  3. Reordering: The candidates are sorted by their new scores, and only the top few are kept.
  4. Use: The reordered results are returned to the user or passed to the next step, such as the context handed to an LLM.

The defining tradeoff is accuracy versus cost: reranking tools are often more precise than first-stage retrievers on shortlisted results, but they can also be slower, which is why they run only over a small candidate set rather than the entire index.

Reranking vs. retrieval and ranking

  • First-stage retrieval casts a wide net quickly to find candidate results; reranking refines that small set with a more expensive model. Retrieval favors recall, reranking favors precision.
  • A bi-encoder (used in retrieval) encodes the query and documents separately and ahead of time; a cross-encoder (used in reranking) encodes each query-document pair together at query time, trading speed for accuracy.
  • Initial ranking is the order a search system returns by default; reranking is an added pass that reorders those results, often tailored to a specific application or query.

Where reranking is used

  • Search engines: Reranking is a long-standing part of building a search engine: the index and first-stage retrieval optimize for speed and recall, while a reranking stage sharpens the precision of the top results before they are shown.
  • RAG pipelines: Reranking retrieved chunks before they reach the model means fewer, higher-quality passages fill the context window, which improves answers and cuts noise.
  • Search APIs: Results from a search API can be reranked for a specific use case before being used, and reranking itself can be offered as an API designed to sit on top of many first-stage retrieval systems, subject to constraints like input format, language/domain fit, length limits, modality support, and latency/cost targets.
  • Latency-sensitive systems: Because reranking adds latency, teams tune how many candidates to rerank, or skip it when first-stage precision is already high.

Reranking matters most when the first set of results is good but not perfectly ordered, and where getting the very best match into the top spot is worth a second, more careful look.

Hybrid search, semantic search, cross-encoder, bi-encoder, two-stage retrieval, retrieval-augmented generation (RAG), latency, chunking, context window.