Skip to main content
Rerank stage showing cross-encoder model re-scoring search results
The Rerank stage uses cross-encoder models to re-score and reorder search results. Unlike bi-encoder models (used in semantic search), cross-encoders process the query and document together, enabling more accurate relevance scoring at the cost of higher latency.
Stage Category: SORT (Reorders documents)Transformation: N documents → top_k documents (re-ranked by relevance)

When to Use

When NOT to Use

Budget for this stage before you add it. A cross-encoder scores every candidate against the query, so its cost grows with the number of candidates you hand it, not with top_k.Measured on a production pipeline, BAAI__bge_reranker_v2_m3 took p50 3.26s on its own, against a retriever whose search, filter and index stages together took ~38ms. The rerank was 99% of a 4.4s p50.Set top_k on the stage feeding it. Reranking 20 candidates and keeping 10 costs a fraction of reranking 200.

Parameters

Default model

The stage calls BAAI__bge_reranker_v2_m3 when you omit inference_name. A deployment serves only the models it has turned on, so that model may be absent. To find what a deployment serves, save the retriever. If the model is not served, the save returns a 422. Its details.served_alternatives lists the served reranking models, and details.default says whether the refused model was the default. Set inference_name to one of the listed models. With on_error: "skip" the save skips this check. Execution then skips the stage and names the skip in warnings.

Scores after rerank

The stage orders documents by scores.rerank (or your score_field) and leaves score as the retrieval score, so score is not in descending order after this stage. Read or threshold scores.rerank when you want the value that ordered the results. The stage’s metadata names that field as ordered_by, and a score_normalize stage needs it set as its score_field.

Available Models

Availability depends on the deployment, as described in Default model. Jev scores each query and document pair in its own request, so no document affects another document’s score. Pairs run concurrently. Set relevance_criteria to the exact condition you rank on. Jev reads it word for word. With a decision model, stage metadata names the model that scored the documents in model_used and says whether its probabilities are calibrated in probabilities_calibrated. On 100 SciFact claims, reranking the top 30 vector results with Jev raised nDCG@10 from 0.817 to 0.880 at 669 ms per query. The same rerank through mixpeek__decision with gemini-2.5-flash-lite scored 0.806 at 2.1 s. For other models, deploy your own via a custom extractor and reference it with feature_uri.

Text only

Rerank scores text. It reads document_field as a string and never opens an image, a video or a URL. No served reranker scores image content. The exception is the default document_field: when no candidate has content, the stage uses text and says so in warnings. For documents with only an image:
  • Rank them with feature_search on an image embedding. A multimodal embedding takes a text query.
  • Reorder them with maxsim_rerank if they hold token vectors from a multi-vector visual feature.
  • Store a caption or OCR text at ingest, and set document_field to that field.

Configuration Examples

How Cross-Encoders Work

Cross-encoders see the full context of both query and document together, enabling better understanding of semantic relationships.

Two-Stage Retrieval Pattern

The recommended pattern is fast recall followed by precise reranking:
Why this works:
  1. Search stage: Fast, retrieves 100 candidates (< 20ms)
  2. Rerank stage: Slower but precise, picks best 10 (50-100ms)
  3. Total: High-quality results in 70-120ms

Performance

Reranking 1000+ documents is not recommended. Use top_k limits in the search stage to control candidate pool size.

Output

Each returned document includes:

Common Pipeline Patterns

Search + Rerank + Limit

Search + Filter + Rerank

Custom Reranker (BYO Model)

Use your own reranker model deployed as a custom extractor instead of the built-in models. Set feature_uri to route reranking through your extractor’s inference endpoint.

Parameters

Your plugin must accept {pairs: [[query, doc], ...]} and return {scores: [float, ...]}.

Configuration Example

Set inference_type: "rerank" in your plugin’s manifest to declare compatibility with the rerank stage.

Trade-offs