Aggregate RAG scores can hide whether a failure originated in retrieval, context construction, generation, or the product workflow.
The table below maps six common retrieval and generation metrics to the failure modes they can diagnose — and the failures they miss entirely. These are diagnostic signals, not universal predictors of user satisfaction.
| Metric | What It Measures | Useful Diagnostic For | What It Misses | When to Use It |
|---|---|---|---|---|
| Precision@k | Fraction of top-k results that are relevant | Noisy top-k retrieval | Missing the single correct chunk; LLM faithfulness | When noisy context is a material failure mode |
| Recall@k | Fraction of all relevant docs returned in top-k | Missing relevant evidence | Ranking order; LLM ignoring retrieved context | Multi-hop queries, regulatory domains |
| MRR (Mean Reciprocal Rank) | Rank of the first relevant result | Late first relevant result | Total coverage; systems needing multiple chunks | Navigational queries, single-answer lookups |
| NDCG@k | Ranking quality weighted by relevance grade | Ranked results with graded relevance | Answer faithfulness; out-of-distribution queries | When ranking order directly affects output quality |
| Relevance Score Distribution | Statistical spread of retriever similarity scores | Score-distribution change that merits investigation | Absolute relevance; user-perceived quality | Ongoing monitoring, post-embedding-model change |
| Answer Faithfulness | Whether the LLM answer is grounded in retrieved context | Claims unsupported by retrieved context | Retrieval coverage; latency; cost | When unsupported claims are a material failure mode |
No single metric is sufficient. Use a small metric set tied to query type, inspect retrieval and generation separately, and validate automated scores against human review and task outcomes.
Why Retrieval Metrics Decouple from User Experience
The fundamental problem with RAG evaluation is that there are two places a system can fail — retrieval and generation — and most teams only measure one of them.
Consider a retriever with strong Precision@k. That sounds like a solid system. But if the generator ignores the retrieved context on a significant fraction of queries — answering from parametric memory instead — user-facing accuracy degrades independently of retrieval quality. Conversely, a perfectly faithful generator cannot compensate for a retriever that misses the one document with the actual answer.
This decoupling is why aggregate “RAG accuracy” scores can be misleading. They average across failure modes that have different root causes and fixes. Poor Recall@10 is evidence to inspect retrieval, chunking, indexing, and labels. Poor faithfulness is evidence to inspect prompt construction, model behavior, and output controls. One score erases that diagnostic detail.
Precision@k and Recall@k: The Foundational Pair
Precision@k and Recall@k come from information retrieval research and often trade off as the cutoff changes. Returning more chunks can improve coverage while adding irrelevant material; returning fewer can improve concentration while missing needed evidence. Measure the actual curve for each query stratum.
For RAG specifically, the trade-off depends on query type:
- Single-answer factual queries (e.g., “What is the SLA on the enterprise plan?”) may emphasize early precision and first-relevant rank.
- Synthesis queries (e.g., “Summarize the compliance requirements across our policy documents”) may emphasize recall at a task-appropriate cutoff because missing evidence can make the answer incomplete.
- Adversarial or ambiguous queries also require abstention or clarification tests; rank metrics alone do not prove that the system handles low-evidence inputs safely.
A retrieval evaluation suite that runs identical metrics across all query types can hide type-specific failure modes behind an aggregate score.
MRR: A Focused Signal for Navigational Retrieval
Mean Reciprocal Rank measures where the first relevant document appears in the ranked list. For navigational queries — where users are looking for a specific document, contract, or policy — the rank of the first correct result is the primary quality signal.
MRR measures only the first relevant result, which makes it useful for known-item and navigational tasks. It does not measure the position of every relevant chunk or prove how a generator will use the assembled prompt. Long-context experiments have shown that answer quality can vary with evidence position, but that is a separate generation-stage effect; see Lost in the Middle.
Treat low MRR on navigational queries as evidence that the first relevant result is arriving too late. Confirm user impact with online behavior or task-success data rather than inferring it from MRR alone. The TREC evaluation notes define reciprocal rank around the first correct response.
NDCG: A Graded-Relevance Ranking Signal
Normalized Discounted Cumulative Gain (NDCG) combines graded relevance with rank discounting. It is useful when assessors can distinguish degrees of relevance and ranking order matters. It is not a universal substitute for recall, known-item retrieval, generation quality, or user outcomes. The original cumulated-gain paper defines the measure and its graded-relevance basis.
A practical approach for enterprise RAG: build binary labels first, ship NDCG as a tracking metric, then progressively improve labels toward graded judgments as you identify the query types where ranking quality matters most.
Relevance Score Distribution: The Early Warning System
Vector retrievers usually produce similarity scores alongside ranked results. Many teams log the top-k results and discard the scores. This is a significant observability gap.
The distribution of similarity scores across retrieved chunks carries diagnostic information that rank-based metrics cannot capture:
- Score compression (scores clustering in a narrower band than the approved baseline) can indicate reduced discrimination, a corpus change, or a scoring/model change. It does not identify the cause by itself.
- Bimodal distribution (one high-score cluster, one low-score cluster) can suggest a threshold candidate. Validate it against relevance labels before filtering results.
- Gradual score drift for a stable probe set indicates that the retrieval system changed. Investigate corpus composition, preprocessing, embedding versions, and score calibration before assigning a cause.
Tracking score distributions per query type can surface retrieval changes before aggregate rank metrics move. Calibrate distributions separately for each retriever because similarity scores are not inherently comparable across models.
Building a Retrieval Evaluation Set That Catches Real Failures
The evaluation set defines what the offline metrics can support. If it omits important query strata and failure cases, its scores do not establish performance on them.
- Stratify by query type: Navigational, informational, multi-hop, and adversarial queries fail differently. Each type needs independent coverage before its metrics are decision-grade.
- Include authorized production-shaped queries: Where privacy and authorization permit, seed the eval set with sanitized production queries. Synthetic-only sets can miss vocabulary and phrasing patterns that appear in use.
- Label at the chunk level, not document level: A document can be partially relevant. Labeling which specific chunks answer the query is more expensive but produces more precise metrics — particularly important for Precision@k.
- Add adversarial examples explicitly: Include out-of-domain queries, ambiguous questions, queries with no correct answer in the corpus, and queries that require external knowledge. A synthetic set will not cover these unless they are designed into it.
- Version the eval set: As the corpus evolves, review evaluation coverage and label new query-document pairs where needed. A stale set can miss regressions on newly added content.
- Track inter-annotator agreement: If multiple people label the eval set, use Cohen's kappa or another agreement measure and review disagreements. Do not apply one universal cutoff: interpret agreement against label prevalence, task stakes, and the decisions the evaluation will support.
- Separate development and test splits: Use the development split to tune retrieval parameters (chunk size, k, hybrid search weights). Reserve the test split for regression detection. Never tune on the test split.
Answer Faithfulness: A Grounding Signal
Retrieval metrics measure what the retriever returns. Answer faithfulness measures whether answer claims are supported by the supplied context. It is one layer of end-to-end evaluation, not a proxy for correctness, completeness, usefulness, latency, or cost.
A faithful answer is one where every claim can be directly traced to a retrieved chunk. An unfaithful answer either introduces information not present in the retrieved context (hallucination) or contradicts the retrieved context (a more subtle failure, often caused by parametric knowledge overriding retrieval).
Faithfulness can be estimated with an LLM judge, an entailment model, or human review. Each method needs calibration against domain experts on representative examples. The RAGAS paper is one primary reference for evaluating retrieval relevance and answer faithfulness as separate dimensions. The self-correcting RAG pipeline post covers one critic-agent implementation pattern.
For offline evaluation, an NLI-based scorer can be another option, but it must be validated on the system’s domain and claim types before its score is used as a release gate.
Measuring Retrieval-Generation Alignment
Beyond faithfulness, a production observability stack needs to measure context utilization — how much of the retrieved context the generator actually used. A system might retrieve 10 chunks but the answer only references 2. That is not necessarily a failure (the other 8 might be partially relevant), but chronic under-utilization signals that your retriever is returning too much noise.
The Pydantic model below formalizes the metrics that belong in a retrieval quality report, with thresholds that trigger downstream alerts.
from pydantic import BaseModel, Field, field_validatorfrom typing import Optionalfrom datetime import datetime
class RetrievalMetrics(BaseModel): precision_at_3: float = Field(..., ge=0.0, le=1.0, description="Precision at k=3") precision_at_5: float = Field(..., ge=0.0, le=1.0, description="Precision at k=5") recall_at_10: float = Field(..., ge=0.0, le=1.0, description="Recall at k=10") mrr: float = Field(..., ge=0.0, le=1.0, description="Mean Reciprocal Rank") ndcg_at_10: float = Field(..., ge=0.0, le=1.0, description="NDCG at k=10")
# Model-specific score distribution. Do not assume every retriever uses [0, 1]. score_p25: float score_p50: float score_p75: float
# End-to-end signal answer_faithfulness: float = Field( ..., ge=0.0, le=1.0, description="Fraction of answer claims supported by retrieved context" ) context_utilization: float = Field( ..., ge=0.0, le=1.0, description="Fraction of retrieved chunks referenced in the answer" )
class RetrievalQualityReport(BaseModel): evaluation_id: str evaluated_at: datetime query_count: int = Field(..., gt=0) query_type: str = Field( ..., description="Query category: navigational | informational | multi_hop | adversarial" ) metrics: RetrievalMetrics baseline_metrics: Optional[RetrievalMetrics] = None
# Derived alert signals — set these floors from your approved baseline. precision_regression: bool = False faithfulness_below_threshold: bool = False score_collapse_detected: bool = False
precision_at_3_floor: float = Field(default=0.0, ge=0.0, le=1.0) mrr_floor: float = Field(default=0.0, ge=0.0, le=1.0) faithfulness_floor: float = Field(default=0.0, ge=0.0, le=1.0) score_spread_min: float = Field(default=0.0, ge=0.0) precision_regression_tolerance: float = Field(default=0.0, ge=0.0, le=1.0)
@field_validator("metrics", mode="after") @classmethod def check_thresholds(cls, v: RetrievalMetrics) -> RetrievalMetrics: return v
def compute_alerts(self) -> dict[str, bool]: spread = self.metrics.score_p75 - self.metrics.score_p25 alerts = { "precision_regression": self.metrics.precision_at_3 < self.precision_at_3_floor, "mrr_below_threshold": self.metrics.mrr < self.mrr_floor, "faithfulness_below_threshold": ( self.metrics.answer_faithfulness < self.faithfulness_floor ), "score_collapse_detected": spread < self.score_spread_min, } if self.baseline_metrics: baseline_delta = ( self.baseline_metrics.precision_at_3 - self.metrics.precision_at_3 ) alerts["precision_regression_vs_baseline"] = ( baseline_delta > self.precision_regression_tolerance ) return alerts
def is_healthy(self) -> bool: return not any(self.compute_alerts().values())The compute_alerts() method encodes the thresholds discussed throughout this post. The baseline comparison can surface degradation that remains above an absolute floor; investigate the underlying sample before assigning a cause.
Online Evaluation: What Production Signals to Collect
Offline evaluation answers the question “does the system work on known queries?” Online evaluation answers “what is actually failing for real users?”
Offline performance can diverge from production behavior when users phrase queries differently, ask about topics missing from the evaluation set, or apply domain expectations that the labels do not represent.
Production signals worth collecting:
- Explicit feedback rate: What fraction of users click thumbs-down or submit a correction? Track this per query type and per document collection.
- Session abandonment after retrieval: Treat immediate reformulation or abandonment as an ambiguous signal worth sampling; it can indicate a poor answer, a changed goal, or normal exploration.
- Source citation click-through: Citation use can reveal which sources users inspect, but low click-through is not a standalone trust measure. Interpret it with task-success and qualitative feedback.
- Query reformulation rate: Frequent rephrasing is another ambiguous signal. Sample sessions to distinguish retrieval failure, answer failure, clarification, and normal exploration.
Feed confirmed failure cases back into the evaluation set. Queries that generate user corrections can be high-value additions because they expose behavior the original dataset may not represent.
When to Alert on Metric Degradation
Monitoring without alerting is inventory without logistics. The metrics above are only useful if they trigger action when they degrade.
A practical alerting architecture for production RAG:
Continuous online monitoring: Compute answer faithfulness on a representative rolling window. Alert when the moving average drops below the threshold defined in
RetrievalQualityReport.Offline regression: Run the full eval set against the current retriever state on a fixed cadence. Alert if any primary metric drops materially from the approved baseline.
Index change detection: Define which material ingestion, preprocessing, schema, or corpus changes trigger a targeted evaluation run. A routine document addition and an embedding migration do not need the same gate.
Embedding model change gate: Before an embedding-model swap, compare the old and candidate systems on the same versioned evaluation set. Approve against pre-declared primary metrics, regression tolerances, latency, and cost constraints rather than a generic “three of five” vote. The enterprise RAG architecture post covers how embedding-model changes propagate through the indexing pipeline.
The production-ready RAG pipeline checklist provides the broader infrastructure context for where these monitoring layers fit in a complete deployment.
Retrieval Quality in Practice: What Changes When You Measure It
One useful review question is whether the team can name both the current retrieval baseline and the current grounding baseline. If the corpus changed while the evaluation set stayed static, rerun labeling coverage checks before trusting the score.
A compact, carefully stratified evaluation set can be more decision-useful than a larger set of near-duplicate synthetic queries. Volume does not compensate for poor coverage of the failure modes the system must detect.
The RetrievalQualityReport model above is a starting point, not a ceiling. Production RAG evaluation evolves with the system: new query types, new document collections, and new failure modes each require evaluation coverage to be extended. The architecture for that extension — labeled eval sets, baseline tracking, layered alerting — scales with the system it measures.
Frequently Asked Questions
What is the difference between offline and online retrieval evaluation in RAG?
Offline evaluation uses a curated, labeled dataset to compare retrieval changes before deployment. Online evaluation samples production behavior through signals such as explicit corrections, task outcomes, and carefully interpreted interaction data. Use both when the deployment needs pre-release regression evidence and post-release coverage of behavior the labeled set may miss.
Why does high Precision@k not guarantee good RAG answers?
Precision@k measures whether retrieved chunks are relevant to the query — it says nothing about whether they contain the specific evidence needed or whether the generator introduces unsupported claims. Pair retrieval metrics with groundedness checks and task-specific outcome measures.
How large does a retrieval evaluation set need to be?
For a domain-specific RAG system, the evaluation set needs enough query-document pairs to detect meaningful regression across query types: navigational queries, informational queries, multi-hop queries, and adversarial queries. A smaller, well-structured evaluation set can catch more real bugs than a larger set of similar queries. Prioritize diversity over volume.
At what threshold should I alert on retrieval metric degradation?
Alert thresholds depend on the approved baseline, failure cost, and action the alert triggers. Define primary metrics by query type, set regression tolerances before evaluating a change, and calibrate automated thresholds against human review. High-stakes uses need stronger evidence and coverage, not a generic universal cutoff.
The Decision Rule
Do not trust aggregate RAG accuracy when retrieval and generation are not measured separately. Use retrieval metrics to locate the missing or noisy context, faithfulness metrics to verify the answer, and baseline regression to catch quality loss before users become the monitoring system.