Back to Blog
Project Readiness

RAG Evaluation and Monitoring Guide: How to Measure Retrieval Quality, Generation Quality, and Production Drift

A practical RAG evaluation framework — retrieval@K precision/recall, generation faithfulness, citation correctness, refusal correctness, and drift detection — with thresholds, tools, and CI gating practices used by senior teams.

2026-08-31 DevStudio Architects 11 min read
On this page (24)
  1. Direct Answer
  2. TL;DR
  3. What You Will Get From This Page
  4. The Four Qualities, Defined
  5. Retrieval Quality
  6. Generation Quality
  7. Citation Quality
  8. Production Drift
  9. The Minimum Viable Eval Set
  10. Tool Choices
  11. CI Gating in Practice
  12. Four Common Eval-Design Mistakes
  13. Reading the Eval Dashboard
  14. How DevStudio Approaches RAG Eval
  15. FAQs
  16. How is RAG eval different from agent eval?
  17. Can we use synthetic queries to bootstrap the eval set?
  18. How do we eval multilingual RAG?
  19. How often should the production threshold be revisited?
  20. Is LLM-as-judge reliable enough for CI gating?
  21. How do we handle eval cases that have multiple correct answers?
  22. What if our eval scores are good but production user satisfaction is bad?
  23. What is the right eval rubric for an internal AI knowledge base vs a customer-facing one?
  24. Related Reading

Direct Answer

A production-grade RAG evaluation framework measures three orthogonal qualities — retrieval (does the right context come back), generation (is the answer correct given that context), and grounding (did the answer actually use that context) — across a labeled set of 200+ reference questions. Each quality has its own metric set and threshold. Production drift is a separate fourth concern measured continuously against a held-out sample of live traffic. Most RAG pilots fail because they conflate these four into "the answer looks fine" instead of measuring each component independently.

TL;DR

  • Retrieval quality: measured by retrieval@K precision and recall against labeled gold passages. Production threshold: recall@20 ≥95%, precision@5 ≥80%.
  • Generation quality: measured by faithfulness (answer is supported by retrieved context) and answer correctness (matches expected reference). Threshold: faithfulness ≥90%, correctness ≥85%.
  • Citation quality: measured by citation correctness (cited sources actually support the claim) and citation completeness (all factual claims have a citation). Threshold: ≥95% on both.
  • Production drift: measured by sampled live-traffic eval against the held-out reference set. Alert if any quality drops 5+ points week-over-week.
  • CI gating: every code/config change merges only if the eval suite clears the agreed thresholds. No exceptions, including "small fixes."

What You Will Get From This Page

  • An exact metric set for retrieval, generation, citation, and drift, with formulas.
  • Production-tier threshold guidance per metric, calibrated by workflow risk.
  • The minimum viable eval set: 200 reference cases broken down by category coverage.
  • Tool recommendations across hosted (LangSmith, Phoenix), open (RAGAS, DeepEval), and DIY.
  • The four common eval-design mistakes that produce reassuring numbers but no production reliability.

The Four Qualities, Defined

Retrieval Quality

What it measures: for a given query, did the retrieval system return the right context chunks?

Metrics:

  • Recall@K: fraction of gold passages present in the top-K retrieved set. Recall@20 of 95% means 95% of queries had all the right context in the top 20 candidates.
  • Precision@K: fraction of top-K retrieved chunks that are actually relevant. Precision@5 of 80% means 4 out of every 5 chunks the LLM sees are on-topic.
  • MRR (Mean Reciprocal Rank): average of 1/rank-of-first-relevant-result. Higher is better; sensitive to ordering.
  • NDCG@K: rank-aware quality metric that rewards relevant results appearing higher in the ranking.

Production thresholds (high-risk workflows like clinical, legal, financial):

  • Recall@20: ≥98%
  • Precision@5: ≥85%
  • MRR: ≥0.85

Production thresholds (medium-risk workflows like internal search, customer support):

  • Recall@20: ≥95%
  • Precision@5: ≥80%
  • MRR: ≥0.75

If retrieval recall@20 is below 90%, no amount of LLM upgrade will fix the system. The right context simply is not coming back.

Generation Quality

What it measures: given the retrieved context, did the LLM produce a correct, complete, useful answer?

Metrics:

  • Answer correctness: does the answer match the expected reference? Scored binary (correct/incorrect) or 1-5 scale.
  • Faithfulness: are all factual claims in the answer supported by the retrieved context? Scored as fraction of supported claims.
  • Answer completeness: did the answer cover all key points the reference covered? Scored 0-1.
  • Refusal correctness: when the system refused, was the refusal warranted (no relevant context retrieved)?

Production thresholds:

  • Faithfulness: ≥95% (no hallucination tolerance for production)
  • Answer correctness: ≥85% (workflow-dependent; can be ≥95% for narrow domains)
  • Refusal correctness: ≥90% (false refusals waste user time; missed refusals hallucinate)

Faithfulness is the most operationally important metric. A faithful-but-incomplete answer is recoverable (user asks follow-up); an unfaithful answer is a trust-breaking event.

Citation Quality

What it measures: did the answer cite the sources that actually supported each factual claim?

Metrics:

  • Citation correctness: when the answer cites source X for claim Y, does source X actually contain claim Y?
  • Citation completeness: what fraction of factual claims in the answer have at least one citation?
  • Citation specificity: are citations at the chunk level (specific) or document level (vague)?

Production thresholds:

  • Citation correctness: ≥95%
  • Citation completeness: ≥90% for production deployments where citations are user-visible
  • Citation specificity: chunk-level required for high-risk workflows; document-level acceptable for casual search

Without citation enforcement, RAG drifts toward sounding right rather than being right. Citation correctness is the easiest place to put automated guardrails — if the LLM cites a chunk it cannot quote from, fail the response.

Production Drift

What it measures: how is system quality changing in production vs the baseline?

Metrics:

  • Quality drift: weekly eval re-run on the labeled set, alerting if any metric drops 5+ points.
  • Sampled live-quality: 1-5% of production traffic gets human-rated weekly, scored against the eval rubric.
  • Distribution drift: query distribution in production vs training/eval distribution. If 30%+ of production queries fall outside eval coverage, the eval set is stale.
  • Cost drift: cost per query trending up or down, broken down by retrieval and generation contribution.

Operating model:

  • Nightly: full eval re-run, dashboard updated.
  • Weekly: human-rated sample of 50-100 production queries, fed back as new eval cases if novel.
  • Monthly: distribution-drift report; eval set additions / pruning.
  • Quarterly: full eval set review for currency.

The Minimum Viable Eval Set

200 reference cases is the production floor for a serious RAG deployment. Here is what 200 cases should cover:

Category Count Purpose
Common queries (Pareto top 20%) 80 High-traffic accuracy
Long-tail / rare queries 40 Robustness across the question space
Multi-hop / complex queries 30 Reasoning across multiple sources
Edge cases / ambiguity 20 Handling of hard cases
Refusal cases (no relevant info) 15 Refusal correctness
Out-of-scope queries 10 Boundary detection
Adversarial / jailbreak attempts 5 Safety

Each case carries:

  • Query text
  • Expected gold passages (chunks the answer should be drawn from)
  • Expected answer (one or more reference forms)
  • Expected refusal flag (yes/no)
  • Acceptance criteria (key claims that must be present, must be absent)
  • Metadata (category, difficulty, source)

200 cases is the floor. 500-1000 cases is the practical range for mid-market enterprise. 5000+ cases for high-traffic / high-risk deployments.

AI Agent Eval Framework: Why You Need It in Week 1 covers the eval-construction methodology applicable to both RAG and agent systems.

Tool Choices

Hosted SaaS:

  • LangSmith (LangChain) — full eval pipeline + tracing + dashboards. Easy on-ramp; locks you to the LangChain stack patterns.
  • Phoenix (Arize) — open-core observability + eval. Stronger on production drift than on initial eval set construction.
  • Braintrust, Patronus AI — newer tools with sharper UX for prompt/eval iteration.

Open-source frameworks:

  • RAGAS — RAG-specific eval library. Strong on faithfulness and answer correctness.
  • DeepEval — broader LLM eval framework. Good for multi-metric scorecard reporting.
  • Promptfoo — CLI-first eval for CI gating. Fast iteration loop.

DIY:

  • LLM-as-judge with a strong frontier model (GPT-5, Claude, Gemini) scoring against rubric, with human spot-check on 5-10% of judgments.
  • pytest + custom scorer functions for CI integration.

For a production deployment in 2026, the typical stack is: RAGAS (or Promptfoo) for eval logic, LangSmith or Phoenix for production observability and drift detection, and human spot-checks weekly.

CI Gating in Practice

Every code or config change goes through CI eval gating before merge:

PR opened
  → Run eval suite on 200-case set
  → Compute retrieval@K, faithfulness, correctness, citation correctness
  → Compare against current main thresholds
  → If any metric drops below threshold OR drops >2 points from main: BLOCK merge
  → If all metrics ≥ threshold AND drops ≤2 points: APPROVE merge

Two implementation notes:

  1. The eval suite should run in <10 minutes. Slower than that and engineers route around it. Sample down to 50-100 cases for the PR-time check; run the full 200+ nightly.
  2. Threshold drops trigger investigation, not auto-merge. "Faithfulness dropped 3 points but it's still 92%" is the silent way RAG quality degrades. Require an explanation in the PR comment for any drop, even within threshold.

Four Common Eval-Design Mistakes

Mistake 1: All-yes-no eval cases. When every reference case is "the right answer is X," the eval cannot detect refusal-correctness failures. Include refusal cases (15-20% of the eval set) where the right answer is "no relevant information."

Mistake 2: LLM-as-judge with a weaker model than the system under test. Using GPT-3.5 to judge a GPT-5 system's output produces noisy ratings. Use a peer-tier or stronger model as judge, or pair LLM judgment with weekly human spot-checks.

Mistake 3: Eval set built only by engineers, not by domain owners. Engineers know what looks technically correct; domain owners know what looks substantively correct. Co-build the eval set with the user-facing operator who will rate production traffic.

Mistake 4: Stale eval set. A 200-case set built at launch becomes stale within 6 months as workflows evolve, products launch, and policies change. Schedule quarterly review and add 20-30% net-new cases per quarter from production logs.

Reading the Eval Dashboard

A well-designed RAG eval dashboard shows, at a glance:

  • 4 headline metrics (retrieval recall@20, faithfulness, correctness, citation correctness) — current value vs target threshold vs 7-day average.
  • Trend lines for each metric over the last 30 days — flat is good, drifting up is great, drifting down requires investigation.
  • Per-category breakdowns (common vs long-tail vs refusal vs adversarial) so localized regressions surface.
  • Top-10 failing eval cases with diff to last passing run.
  • Cost per query trend over the same window.

If your dashboard does not surface all five, the team is flying partly blind on quality.

How DevStudio Approaches RAG Eval

DevStudio AI ships RAG with Eval Week 1 as the engineering commitment: 200+ reference cases co-built with your domain owner before any production code merges, CI gating wired in week 2, full eval dashboard live by week 4. The 6-month QA window includes quarterly Token Audits and quarterly eval refresh against production logs. We are a Hangzhou-based, ex-Tencent senior engineering team; project rate $14k-$85k over 4-10 weeks for a production-grade RAG.

Read the RAG Development service page or book a Paid Scoping to walk the eval requirements for your specific corpus and workflow.

FAQs

How is RAG eval different from agent eval?

Conceptually similar (both measure correctness, faithfulness, refusal); structurally different. RAG eval has the explicit retrieval-quality component (recall@K, precision@K) which agent eval typically lacks. Agent eval has the explicit tool-call correctness which RAG eval typically lacks. Most production teams shipping both run a unified eval framework (DeepEval, custom) with RAG-specific and agent-specific extensions.

Can we use synthetic queries to bootstrap the eval set?

Yes for early scaffolding, no for production gating. Synthetic queries (LLM-generated reference questions from your corpus) are good for getting to 50-100 cases fast. But they bias toward the LLM's notion of what looks like a good question, which is not the same as what your real users ask. Replace synthetic cases with production-derived cases as soon as you have 30-60 days of real traffic.

How do we eval multilingual RAG?

Per-language eval set. Each language gets its own 100-200 reference cases. Metrics are computed per-language. The eval dashboard shows per-language and overall scores. Cross-language queries (English query, Chinese corpus) need their own eval cases — they exercise different behaviors than monolingual queries.

How often should the production threshold be revisited?

Quarterly, alongside the eval set review. As the system improves, thresholds should ratchet up (better baseline = higher bar for regression). As the corpus expands, thresholds should be re-validated (some metrics naturally degrade with corpus size — recall@20 is harder when there are 50,000 candidates than when there are 5,000).

Is LLM-as-judge reliable enough for CI gating?

For most metrics, yes — with two safeguards. (1) Use a peer-tier or stronger judge model than the system under test. (2) Calibrate against human ratings on 50-100 sample cases at the start of the engagement, and re-calibrate quarterly. Humans should still rate 5-10% of nightly samples to catch judge-model drift.

How do we handle eval cases that have multiple correct answers?

Two patterns. Pattern 1: store all acceptable references in the case, score against the closest match. Pattern 2: rubric-based scoring, where the case carries criteria ("must mention X" / "must not contradict Y") rather than a single reference answer. Pattern 2 is more flexible for open-ended workflows; Pattern 1 is faster to set up and check.

What if our eval scores are good but production user satisfaction is bad?

The eval set is not representative of real production queries. Diagnose by sampling 100 real production queries and rating them by hand against the eval rubric. If the production sample scores significantly lower than the eval set on the same metrics, the eval distribution is stale or skewed. Add the production cases to the eval and retrain priorities.

What is the right eval rubric for an internal AI knowledge base vs a customer-facing one?

Internal: weight faithfulness and answer correctness higher; tolerate citation completeness slightly less strictly. Customer-facing: weight citation correctness and refusal correctness higher; faithfulness becomes a hard threshold (95%+ non-negotiable). The same eval framework works; the thresholds differ by deployment.

Last updated: May 31, 2026

NEXT STEP

Discuss your project scope

Share your current workflow, constraints, and target outcome. We will help you scope a realistic AI delivery path.

Plan Your Build

Get a practical estimate for your AI or software project.

Project inquiry form. Fields marked with an asterisk are required.

Related Articles & Resources