Background: RAG Quality Degradation Often Isn’t the Generation Model’s Fault
After a RAG system goes live, teams tend to focus on two symptoms: the model answers incorrectly, or the answer fails to cite the correct source. Intuitively, this points to an insufficiently powerful LLM, poorly crafted prompts, or a vector index that failed to retrieve relevant documents. However, within the production pipeline, there’s one frequently underestimated component: whether the Reranker has ranked the truly useful candidate passages to the top.
A typical RAG pipeline can be broken down into four steps:
- The first-stage retriever fetches
candidate_kcandidate passages from the large corpus. - The Reranker re-scores and re-ranks the candidate passages.
- The system inserts the top
top_npassages into the context. - The LLM generates the final answer.
If the Reranker ranks a highly relevant passage at position 8, but the system only takes the top 5, the final answer will appear as if “the model didn’t read the source material.”
The Cohere Rerank API documentation describes reranking as: inputting a query and a set of texts, outputting an ordered list with relevance scores; the interface also provides parameters like top_n, max_tokens_per_doc, and priority. This illustrates that a Reranker is not an abstract “quality enhancer,” but a production component with constraints on input size, truncation, ranking, cost, and priority.
Therefore, launching a Reranker cannot rely on just a few manual Q&A tests. It requires an independent evaluation mechanism: a golden query set, relevant passage annotations, ranking metrics, a latency budget, canary release gates, and a rollback strategy.
Core Principle: The Reranker Solves “Candidate Ranking,” Not “Full-Corpus Retrieval”
First-Stage Retrieval Determines the Upper Bound
A Reranker typically only processes the candidate passages returned by the first-stage retriever. If the correct passage doesn’t make it into the candidate_k set, no amount of Reranker strength can rank it higher. This dictates that evaluation must not only look at the top_n after reranking but also record the first-stage retriever’s Recall@K.
For example:
query: How to apply for enterprise admin permissions?
first_stage_candidate_k: 50
rerank_top_n: 8
reference_context_ids: [doc_acl_003, doc_acl_004]
If doc_acl_003 and doc_acl_004 never entered the top 50 candidates, the problem lies in retrieval. If they entered the top 50 but were ranked 20th and 31st by the Reranker, the issue is more likely in the reranking. If they were ranked in the top 8 but the generated answer was still wrong, then the investigation should move to context assembly, prompts, and the generation model.
The Reranker Improves Ranking Density
In RAG, what truly matters isn’t “whether the relevant document exists in the candidate set,” but “whether the relevant document appears in the first few context slots visible to the model.” This is why nDCG@K, MRR, Precision@K, and Context Precision are far more diagnostic than simply looking at one answer manually.
The LlamaIndex Retrieval Evaluation example uses hit-rate, MRR, Precision, Recall, AP, and nDCG as retriever evaluation metrics, comparing retrieval results against ground-truth context. The Ragas Context Precision documentation emphasizes that it evaluates whether relevant chunks in the retrieved context are ranked higher, calculated based on Precision@K.
For production RAG, it’s recommended to split metrics into three layers:
| Layer | Metrics | Purpose |
|---|---|---|
| Retrieval Layer | recall_at_20, recall_at_50, missing_reference_context_rate | Determine if the candidate set contains the correct answer |
| Rerank Layer | ndcg_at_5, ndcg_at_10, mrr, context_precision_at_5 | Determine if reranking moved key passages higher |
| Generation Layer | answer_groundedness, citation_hit_rate, refusal_or_fallback_rate | Determine final answer quality |
The value of this approach is: when online quality degrades, you can quickly pinpoint whether the problem is in retrieval, reranking, or generation, instead of attributing all issues to the LLM.
Engineering Implementation: Build the Golden Query Set First, Then Talk Model Replacement
The Golden Query Set Must Reflect Real Business Distribution
The first step in Reranker evaluation isn’t tuning a model; it’s building a golden query set. This dataset should include at least four types of questions:
- High-Frequency Standard Questions: e.g., “How to reset password?”, “How to apply for a refund?”
- Low-Frequency but High-Risk Questions: e.g., permissions, contracts, compensation, compliance clauses.
- Easily Confusable Questions: e.g., two product versions, two similar processes, identically named fields.
- Online Failure Samples: e.g., user downvotes, human agent escalations, answers without citations.
Each sample should store at least the following fields:
query_id: q_20260706_001
query: "How can an enterprise admin bulk-import employees?"
query_type: "permission_and_operations"
expected_answer_intent: "Explain the entry point, template, field validation, and error handling"
reference_context_ids:
- "admin_guide_12"
- "employee_import_faq_03"
negative_context_ids:
- "personal_user_import_01"
- "legacy_import_doc_07"
priority: "high"
The negative_context_ids field is crucial. The most common Reranker problem isn’t failing to find relevant material entirely, but ranking a passage that “looks similar but has the wrong answer boundary” to the top. Without hard negatives, the evaluation set can be overly optimistic.
Fix the Candidate Set to Compare Rerankers
When comparing two Rerankers, the first-stage retrieval candidate set must be fixed as much as possible. Otherwise, model A runs on one batch of candidates, model B runs on another, and metric differences could stem from the retriever, index version, chunking strategy, or data updates, not the Reranker itself.
The recommended offline evaluation workflow is:
- Fix
corpus_snapshot_id - Fix
index_version - Fix
first_stage_retriever_config - Generate candidate sets for the golden query set
- Save
query_id -> candidate_context_ids - Reuse the same candidate set for multiple Reranker versions
- Calculate ranking metrics and latency/cost
The candidate set can be saved as an evaluation artifact:
{
"eval_run_id": "rerank-eval-20260706-001",
"corpus_snapshot_id": "kb-20260705-1800",
"index_version": "vector-index-v42",
"candidate_k": 50,
"queries": [
{
"query_id": "q_001",
"candidate_context_ids": ["doc_7", "doc_2", "doc_91"],
"reference_context_ids": ["doc_2"]
}
]
}
Don’t Just Look at the Average Score
An average nDCG improvement can mask high-risk problems. A safer approach is to look at both overall metrics and bucketed metrics:
metric_report:
overall:
ndcg_at_5: 0.74
mrr: 0.68
recall_at_50: 0.91
by_query_type:
permission_and_acl:
ndcg_at_5: 0.61
regression_cases: 12
billing:
ndcg_at_5: 0.79
regression_cases: 3
product_howto:
ndcg_at_5: 0.82
regression_cases: 1
What production systems truly care about is whether the new Reranker causes regressions in critical scenarios. A model that improves by 3% overall but degrades on permission, billing, medical, financial, or contract clause queries should not be fully released.
Candidate Set Budget: Bigger candidate_k Isn’t Always Better
Many teams default to increasing candidate_k from 20 to 100, handing it to the Reranker, hoping “more candidates will always be better.” This is unstable in terms of both cost and effectiveness.
The BEIR paper reminds us that BM25 is a strong baseline, and reranking and late-interaction architectures generally have good zero-shot performance but come with higher computational costs. Other research specifically discusses the consequences of scaling Reranker inference: as the Reranker scores more and more documents, the returns may diminish, and in some cases, quality can even decrease. Therefore, production systems need to treat candidate_k as a budget-constrained parameter, not something that’s always better when larger.
It’s recommended to run at least three candidate set configurations for each Reranker evaluation:
| Configuration | candidate_k | top_n |
|---|---|---|
| Small Candidate Set | 20 | 5 |
| Medium Candidate Set | 50 | 5 |
| Large Candidate Set | 100 | 8 |
Record latency and cost metrics during evaluation:
cost_latency_metrics:
- p50_rerank_latency_ms
- p95_rerank_latency_ms
- timeout_rate
- avg_docs_reranked_per_query
- avg_tokens_per_doc_after_truncation
- cost_per_1k_queries
The final choice isn’t the highest nDCG, but the most stable combination within the SLO. For example, if candidate_k=100 has an nDCG@5 that is 1% higher than candidate_k=50, but its p95 latency increases by 300ms and the timeout rate rises, it may not be suitable for default online traffic.
Latency Governance: The Reranker Needs a Degradation Path
The Reranker sits between retrieval and generation. If it times out, it directly increases user-perceived latency. The production pipeline needs at least three degradation strategies.
Budget-Aware Cutoff
When candidate documents are too long, trim them based on passage length, source priority, and initial retrieval score to prevent long documents from hitting the Reranker’s token limit. The Cohere documentation mentions that long documents are truncated according to max_tokens_per_doc. This behavior must be included in the evaluation; otherwise, offline you see the full document, but online the Reranker scores a truncated one.
Timeout Fallback
If the Reranker times out, fall back to the first-stage retrieval order, but mark rerank_fallback=true in the logs to avoid confusion in subsequent quality analysis.
Query-Class Routing
Not all queries are worth the expensive Reranker. For example, navigational queries, exact ID lookups, or fixed FAQ hits can use a lightweight strategy. Only multi-hop, long-tail, or similar-clause-confusion queries should go through the strong Reranker.
rerank_policy:
default:
enabled: true
candidate_k: 50
top_n: 6
timeout_ms: 350
exact_id_query:
enabled: false
reason: "metadata filter is enough"
high_risk_policy_query:
enabled: true
candidate_k: 100
top_n: 8
timeout_ms: 600
fallback:
on_timeout: "use_first_stage_order"
log_event: true
Canary Release: Use Gates to Prevent “Smarter-Looking” Regressions
Reranker changes often come with model version, prompt, chunking strategy, index field, and filter condition changes. The release gates should be divided into three layers: offline, shadow, and canary.
Offline Gate
The offline gate requires the new version to surpass the baseline on the fixed evaluation set:
offline_gate:
baseline: "reranker-v1"
candidate: "reranker-v2"
pass_rules:
ndcg_at_5_delta: ">= 0.02"
mrr_delta: ">= 0"
high_priority_regression_count: "<= 3"
p95_latency_ms: "<= 450"
Shadow Traffic
The shadow phase doesn’t affect real answers. It sends the online query to both the old and new Rerankers simultaneously and compares the differences in the top top_n. Focus on:
shadow_metrics:
- top_5_overlap_rate
- reference_doc_drop_rate
- rerank_score_distribution_shift
- timeout_rate
- long_doc_truncation_rate
If the top_5 overlap is very low, it doesn’t necessarily mean it’s bad, but it indicates a significant change in ranking behavior that requires manual sampling and review.
Small-Traffic Canary
The canary phase must be tied to user experience metrics, such as citation hit rate, follow-up question rate, human escalation rate, and downvote rate. It’s not recommended to look only at answer satisfaction, as it’s heavily influenced by generation model fluctuations. A more stable approach is to simultaneously record retrieval diagnostic fields:
{
"query_id": "online_q_abc",
"reranker_version": "v2",
"candidate_k": 50,
"top_context_ids": ["doc_11", "doc_08", "doc_19"],
"rerank_latency_ms": 286,
"fallback": false,
"citation_hit": true,
"user_feedback": "thumb_up"
}
This way, online problems can be replayed into the same evaluation framework, rather than being stuck at “the user thinks the answer is bad.”
Common Pitfalls
Pitfall 1: Comparing Reranker Scores Across Queries
Many Rerankers output a relevance_score, but across different queries, candidate sets, and model versions, the scores may not have a stable global meaning. A safer practice is to use the score as a ranking criterion within the same query, not as a fixed threshold for global filtering.
Pitfall 2: Evaluating Only the Final Answer, Not the Context Ranking
Final answer quality is a mix of multiple variables. To diagnose the Reranker, you must save the candidate set, ranking results, reference contexts, top_n assembly results, and the final answer. Otherwise, when a problem occurs, you can only guess.
Pitfall 3: Reusing Old Evaluation Results After Online Chunking Changes
Once the chunking strategy, metadata, or index version changes, the candidate texts the Reranker sees are different. Evaluation reports must record corpus_snapshot_id, chunking_version, index_version, and retriever_config.
Pitfall 4: Ignoring Long Document Truncation
If the Reranker automatically truncates long documents, relevant evidence might be cut off. During evaluation, track the truncation_rate and spot-check documents that were truncated but still scored highly.
Launch Checklist
Before launching, confirm at least the following:
Dataset
- Golden query set covers high-risk scenarios
- Hard negative contexts are annotated
- Online failure samples are backfilled
Reproducibility
corpus_snapshot_idis recorded- Candidate set is saved
- Reranker version is fixed
- Prompt or instruction version is fixed
Metrics
recall_at_kis reportedndcg_at_kis reportedmrris reported- Latency and timeout metrics are reported
Production Readiness
- Timeout fallback mechanism is in place
- Fallback events are logged
- Shadow comparison is enabled
- Rollback switch is ready
Summary
Production evaluation of an LLM Reranker is not about “running a few cases to see if the answer looks good.” It is a systematic engineering process involving a golden query set, ranking metrics, candidate set budgets, latency governance, and canary release gates. Only by establishing an independent reranking evaluation system can a team quickly pinpoint whether a problem during model iteration lies in retrieval, reranking, or generation, making data-driven decisions rather than relying on subjective feelings.