AI Space

AI Models & Assistants / Knowledge library

Reranking

Rescoring retrieved candidates with a more precise relevance model

Second-stage retrieval

Why learn Reranking?

Reranking improves the ordering of plausible candidates without scoring the entire corpus expensively. It cannot recover a relevant document omitted by first-stage retrieval.

Where it came from

Two-stage retrieval first gathers candidates quickly, then applies a costlier reranker to a smaller set. Cross-encoders can jointly inspect query and document tokens for more precise relevance scoring.

Build your understanding

Work through these exercises in order. Try the task before opening a reference.

  1. Locate reranking in retrieval: When does a reranker normally run?
  2. Contrast a cross-encoder: Why can a cross-encoder reranker be more accurate than independent embeddings?
  3. Recognize the ceiling: The correct document is absent from the top 100 retrieved candidates. Can a reranker place it first?
  4. Set candidate depth: What is the main tradeoff when increasing reranker candidate depth?
  5. Measure ordering quality: Which metric rewards putting highly relevant results near the top with graded judgments?

Documentation and sources

Connect the ideas

Explore next

Semantic SearchRetrieval-Augmented GenerationEmbeddings

Real World Example

Illustrative business scenario · AI-generated from linked documentation · Not a measured customer case study

Precision Enhancement for Legal Discovery Systems

Corporate legal departments managing massive document repositories for litigation discovery.

The business problem

Initial keyword-based retrieval often returns large sets of documents that are topically relevant but contextually misaligned with the specific legal query, forcing attorneys to manually filter through irrelevant noise.

How this topic solves it

Implementing a two-stage retrieval pipeline where a high-recall initial search retrieves a broad candidate set, followed by a BERT-based reranker that evaluates the semantic relationship between the query and each candidate document to assign a precise relevance score.

  1. Execute an initial retrieval query using traditional BM25 or vector search to fetch the top 100 candidate documents.
  2. Pass the original user query and each candidate document text as a concatenated input pair into a pre-trained BERT model.
  3. Compute a relevance score for each pair using the model's classification head.
  4. Sort the candidate list in descending order based on these refined scores.
  5. Return the top-ranked subset to the user interface for review.
Two-Stage Retrieval Pipeline · Process flow

The flow from user query to final ranked results.

User Query

Input search string

Initial Retrieval

High-recall search engine

Candidate Pool

Set of 100 documents

BERT Reranker

Semantic scoring model

Final Results

Sorted document list

  • User Query → initiates → Initial Retrieval
  • Initial Retrieval → populates → Candidate Pool
  • Candidate Pool → scores pairs → BERT Reranker
  • BERT Reranker → sorts → Final Results

Expected business outcome

Users receive a highly curated list of documents where the most contextually significant information appears at the top, significantly reducing the time spent on manual document review.

Limitations and checks

The primary limitation is computational latency; because the reranker processes every candidate document individually, it is significantly slower than the initial retrieval stage. To check for this, monitor the p99 latency of the request-response cycle as the candidate pool size increases.

Sources

Generated 2026-10-18 with gemini-3.1-flash-lite. Your assessment includes two questions about this example.

Catalog source: technology-maxxing. This page reproduces the existing catalog’s learning material and source links.