CLOUD CONCEPT

Reranking

Reranking is a second-stage search process that reorders retrieved candidates using additional relevance signals before results are presented or supplied to a foundation model.

Cloud Concepts Hub →

What is Reranking

An initial retriever efficiently finds potentially relevant documents, and a reranker evaluates that smaller candidate set more closely against the query. In retrieval-augmented generation, this helps place stronger evidence into a limited context window, but it adds processing cost and cannot recover documents that retrieval missed.

Reranking separates finding plausible information from deciding which information best answers a query. A first-stage retriever searches a large collection using keyword matching, vector similarity, or a hybrid of both. A second stage scores the retrieved candidates using richer relevance signals and changes their order. The application then selects the highest-ranked results for a search interface or for the context supplied to a foundation model in a retrieval-augmented generation, or RAG, workflow.

This two-stage design balances retrieval coverage with computational expense. Embedding-based retrieval typically compares a query vector against document vectors calculated during ingestion. A common neural reranker instead uses a cross-encoder that processes the query and each candidate together, allowing closer evaluation of their relationship. Cross-encoders are common implementations, not the definition of reranking: rules, learned ranking models, and other model architectures can also reorder candidates.

For example, an operations assistant receives the question, “How do I rotate production database credentials without downtime?” Hybrid search retrieves 50 passages, combining exact matches for credential terminology with semantically related rotation procedures. A reranker promotes passages describing overlapping credential validity and application connection refresh, while demoting general password policy documents. The application supplies the best five passages to its generation model, subject to its context budget. These candidate and output counts are illustrative tuning choices, not universal defaults.

In a cloud architecture, a managed search service can perform initial retrieval, while a managed reranking API or a custom model endpoint performs second-stage scoring. Apply tenant and document authorization filters before unauthorized content reaches the reranker or generation model. Preserve document identifiers and source metadata through scoring so the final answer can cite its evidence. Treat retrieved text as untrusted input; a relevance score does not establish factual accuracy, authorization, or safety.

Candidate count, passage length, model choice, and final context size affect latency, throughput, and cost. Retrieving more candidates can improve coverage, but scoring them requires additional inference work. Long passages may be truncated according to model limits, potentially removing the relevant evidence. Use bounded candidate sets, appropriate chunking, request timeouts, and an explicit fallback policy, such as using the initial ranking when reranking is unavailable. For custom endpoints, benchmark hardware utilization, batching, concurrency, and autoscaling under realistic traffic.

Evaluate retrieval and reranking separately. Recall at the candidate cutoff helps determine whether the retriever finds the required evidence; metrics such as normalized discounted cumulative gain and mean reciprocal rank measure ranking quality. Also measure answer correctness, citation support, end-to-end latency, and cost. Use representative queries, relevance judgments, and held-out evaluation data. Tune embeddings, chunk boundaries, hybrid retrieval settings, candidate counts, and reranker selection as distinct components rather than changing everything simultaneously.

Reranking is not embedding-model fine-tuning, although both can improve a retrieval pipeline. Improving embeddings can bring previously missed evidence into the candidate set; reranking can only reorder candidates already supplied to it. Hybrid score fusion combines retrieval signals, whereas reranking adds another relevance assessment after candidate retrieval. Reranking also does not guarantee hallucination-free answers: the corpus may lack the answer, the selected passages may be incomplete, or the generation model may fail to follow the evidence.

Key aspects of Reranking

Effective reranking improves the ordering of an authorized candidate set while balancing evidence quality, context limits, inference cost, and operational latency.

Two-stage relevance assessment

Use an efficient retriever to identify candidates, then apply a more detailed relevance assessment to that bounded set. This avoids running an expensive ranking model across the entire corpus for every query.

Candidate recall sets the ceiling

A reranker cannot promote evidence that was never retrieved. Improve embedding quality, keyword coverage, hybrid retrieval, filtering, or candidate depth when relevant documents are missing.

Query-aware scoring

Neural rerankers commonly evaluate queries and candidate passages together, capturing relationships that vector similarity alone may miss. Reranker scores should not be treated as calibrated probabilities that a passage is correct.

Context-budget optimization

Select the strongest evidence before assembling the generation prompt. Tune the final result count and passage lengths to reduce irrelevant context without discarding information needed for a complete answer.

Latency and deployment trade-offs

Candidate volume, input length, and model size affect inference latency and cost. Establish timeouts, capacity limits, monitoring, and a fallback policy appropriate to the application's availability requirements.

Measured quality and secure handling

Evaluate candidate recall, ranking metrics, and downstream answer quality using representative workloads. Enforce access controls before model processing and preserve source metadata for citations and troubleshooting.

Cloud services for Reranking

A typical implementation uses Amazon OpenSearch Service to retrieve candidates through keyword, vector, or hybrid search, then passes authorized passages to an Amazon Bedrock reranker. The application selects the highest-ranked evidence and supplies it to a generation model while retaining source identifiers for citations. Where custom model behavior or deployment control is required, a reranker hosted on Amazon SageMaker AI can perform the second stage instead. Tune retrieval depth and final context size independently, and monitor retrieval recall, ranking quality, answer quality, latency, and inference cost across the complete workflow.

Amazon Bedrock

Amazon Bedrock provides managed reranker models through its Rerank API and supports reranking configurations in Knowledge Bases retrieval workflows. Applications can use these capabilities to reorder retrieved passages before selecting context for generation.

Open Amazon Bedrock →
Amazon OpenSearch Service image Amazon OpenSearch Service

Amazon OpenSearch Service supports keyword, vector, and hybrid retrieval to build the candidate set. Supported OpenSearch versions and configurations also provide reranking through search pipelines; alternatively, an application can send retrieved candidates to an external reranker.

Open Amazon OpenSearch Service →
Amazon SageMaker image Amazon SageMaker

Amazon SageMaker AI can host a custom reranking model on an inference endpoint when teams need control over model selection, tuning, or deployment. Engineers must size compute, configure scaling, and measure latency and cost for the expected candidate volume.

Open Amazon SageMaker →