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

Parameters

Available Models

The built-in reranker is BAAI__bge_reranker_v2_m3 (multilingual cross-encoder). For other models, deploy your own via a custom extractor and reference it with feature_uri.

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