Skip to content

Reranking

Reranking is a second, more discerning relevance pass that runs after retrieval and before the answer is generated. Vector similarity is fast but coarse: it’s a good first guess at relevance, not a final verdict. The top-K chunks it returns often include near-duplicates, tangential matches, or passages that mention the query terms without answering the question. A reranker re-scores those candidates against the question and keeps only the highest-precision few, so the model sees fewer, better chunks instead of more, noisier ones.

You’d reach for this page when RAG answers feel “almost right but padded with irrelevant context,” when you want to shrink the prompt (and its token cost) without losing the chunk that actually answers the question, or when you’ve standardized on a cloud stack and want a managed reranker rather than a self-hosted one.

The single most important property to know up front: reranking is fail-open. Turning it on can only help or be neutral: it can never make retrieval worse.


Query ──► Hybrid retrieval (BM25 + vector, fused by RRF) ──► top-N candidates
│
▼
Reranker re-scores against the query
│
▼
keep top-K ──► LLM prompt

Reranking operates on whatever the retrieval stage hands it. In Viglet Turing that’s hybrid retrieval: a vector pass and a BM25 keyword pass run in parallel and are fused by Reciprocal Rank Fusion (RRF, k=60) before the reranker ever sees them. The reranker then narrows that fused pool to the best few. See What is RAG? for the full retrieval flow and Search Engine for the BM25 backings.


  1. Open Administration → Settings → Global Settings, RAG Reranker section.
  2. Toggle Enable Reranker on.
  3. Pick a Strategy (start with LLM, no extra infrastructure).
  4. Set Top-K kept: how many of the highest-ranked chunks survive into the prompt (default 20).
  5. Save and ask a RAG question. The reranker now narrows the candidate pool before the model answers.

If anything goes wrong with the chosen strategy, you won’t see an error: you’ll see the original retrieval order. That’s the fail-open guarantee at work.


Turing treats reranking as a selectable strategy so you can match cost, latency, and precision to your deployment. All strategies share the same fail-open facade.

StrategyWhat it isAuthWhen to use
LLM (default)Asks the configured chat model to rank the candidate snippets.(uses the chat model)Quick start; small candidate pools; you already pay for a chat model.
LLM_LOGPROBSOpenAI-only confidence reranker: a per-candidate yes/no relevance classification with top_logprobs, whose calibrated P(relevant) is blended with the retrieval rank.OpenAI keyYou want calibrated confidence, not just an ordering, on an OpenAI model.
CROSS_ENCODERA self-hosted cross-encoder over an HTTP /rerank endpoint (Text Embeddings Inference, Infinity, or a Jina-compatible server, e.g. BAAI/bge-reranker-v2-m3).endpoint URLBest precision-per-cost. Local, free, fast (sub-100 ms). Recommended for production.
COHEREThe managed Cohere Rerank API (https://api.cohere.com/v2/rerank, default rerank-v3.5).API keyZero-ops managed reranker.
VOYAGEThe managed Voyage AI Rerank API (https://api.voyageai.com/v1/rerank, rerank-2.5), the retrieval specialist Anthropic recommends.API keyZero-ops; pairs naturally with Voyage embeddings.
BEDROCKThe managed AWS Bedrock Rerank API. Model is the ARN or a bare id (e.g. amazon.rerank-v1:0) expanded for the region.AWS IAMCloud-native AWS deployments; no self-hosted model.
VERTEX_AIThe managed Google Vertex AI Ranking API (Discovery Engine rankingConfigs:rank, default semantic-ranker-default-004).GCP service account / ADCCloud-native GCP deployments.

Reranking is wrapped in a single fail-open facade (TurRagReranker). If the chosen strategy errors, times out, isn’t configured, or returns nothing usable, Turing silently falls back to the original retrieval order. A corrupt strategy value parses leniently back to LLM rather than throwing. The net effect: enabling reranking can only improve or be neutral: it can never degrade results below the no-rerank baseline.

flowchart TD
R[Retrieved candidates] --> S{Reranker strategy}
S -->|success| K[Keep top-K by new score]
S -.->|error / timeout / empty / not configured.-> O[Original retrieval order]
K --> P[LLM prompt]
O --> P

For repeated queries, the rerank scores can be cached. When GLOBAL_RAG_SN_RERANK_CACHE_ENABLED is on, the ordered doc-id list is cached keyed by (strategy, model, query, hash of candidate ids+text, topK) and re-mapped to live documents on read (serialization-safe across a Hazelcast cluster). The rerank-config setters evict the cache, and content edits self-invalidate via the candidate hash. Default off → byte-for-byte the uncached path.


All reranker settings live in Global Settings (/api/system/global-settings) and persist as config vars:

Setting keyDefaultApplies toDescription
GLOBAL_RAG_SN_RERANK_ENABLEDfalseallMaster on/off for the rerank pass
GLOBAL_RAG_SN_RERANK_STRATEGYLLMallWhich strategy runs
GLOBAL_RAG_SN_RERANK_TOP_N20allHow many top-ranked chunks survive into the prompt
GLOBAL_RAG_SN_RERANK_ENDPOINT(blank)cross-encoderThe self-hosted /rerank server URL
GLOBAL_RAG_SN_RERANK_MODEL(blank)cross-encoder / Cohere / Voyage / BedrockModel name or ARN
GLOBAL_RAG_SN_RERANK_API_KEY(blank, encrypted)Cohere / Voyage / Vertex SAWrite-only; blank means “not configured”; a saved key is preserved on edit
GLOBAL_RAG_SN_RERANK_REGIONus-east-1BedrockAWS region for the Bedrock Rerank API
GLOBAL_RAG_SN_RERANK_VERTEX_PROJECT(blank)Vertex AIGCP project id
GLOBAL_RAG_SN_RERANK_VERTEX_LOCATIONglobalVertex AIVertex ranking location
GLOBAL_RAG_SN_RERANK_CACHE_ENABLEDfalseallCache ordered rerank results

PageDescription
What is RAG?The full retrieval → rerank → generate pipeline
Search EngineBM25 backings (EMBEDDED vs SE_INSTANCE) for hybrid retrieval
Embedding ModelsVoyage/Cohere models that pair with their rerankers
Embedding StoresWhere the vector half of hybrid retrieval lives
LLM InstancesVendor auth (Cohere / Voyage / Bedrock IAM / Vertex GCP)
Configuration ReferenceSetting keys and defaults