Overview

15 Production RAG: Metrics, agentic systems, and continuous improvement

This chapter shifts from RAG as a collection of techniques to RAG as a production system that must be measured, tuned, and improved over time. It highlights the idea that the generator, not just the retriever, often determines whether retrieval helps or hurts, especially at scale. Using RAGGED as a key reference point, it shows that some models are robust to extra context while others become more fragile as more passages are added, so production teams need metrics that capture stability and scalability rather than assuming more retrieval is always better.

The chapter then describes agentic RAG as the next step in the field: systems that decide at runtime whether to retrieve, reformulate, plan, or stop instead of following a fixed pipeline. Reflection, planning, tool use, and multi-agent collaboration are presented as recurring design patterns, along with practical pipeline structures such as routing and orchestrator-worker setups. It also shows how fine-tuning can be folded into the RAG lifecycle, especially by unifying ranking and generation in a single model and by adapting either the retriever or the reader to reduce noise and improve domain performance.

Finally, the chapter emphasizes continuous improvement in production through logging, evaluation, versioning, and targeted remediation based on failure modes. It frames RAG tuning as a diagnostic process: if content is missing, expand retrieval; if the right passage is present but poorly ranked, rerank; if the generator ignores useful context or hallucinates, improve reader robustness or use self-reflection; if the domain is specialized, fine-tune with synthetic or labeled examples. The chapter closes by stressing that real-world RAG systems should be routed by query complexity, monitored like living software, and extended with image-based retrieval or page-level answering when text extraction is unreliable.

Two distinct reader scaling behaviors from RAGGED.
The orchestrator-workers pattern for agentic RAG.
Three stages of self-improvement in RAG systems.
Diagnostic decision tree for RAG technique selection.

Summary

  • RAGGED showed that some reader models degrade with more retrieved passages (peak-then-decline) while others improve and plateau. The RAG Stability Score (RSS) and RAG Scalability Coefficient (RSC) capture these dimensions separately, enabling targeted optimization of retrieval depth per model.
  • Agentic RAG generalizes adaptive retrieval into autonomous pipelines. Four design patterns (reflection, planning, tool use, and multi-agent collaboration) compose into workflow architectures that decide at runtime which retrieval techniques to apply. These systems improve quality on complex queries but add latency in proportion to the number of extra model calls, which is what query-based routing is for.
  • Fine-tuning and RAG are complementary, not competing. RankRAG demonstrated that instruction-tuning a single LLM for both context ranking and answer generation outperforms separate specialist models, with a small fraction of ranking data producing outsized improvements. Domain-specific adapter training further improves noise robustness and retrieval precision.
  • Self-improving RAG systems learn progressively deeper forms of trust in retrieval. Adaptive kNN-MT learns when to trust retrieval through a lightweight gate network. SKILL-RAG learns which retrieved sentences to trust by modeling the LLM's self-knowledge boundaries. SimRAG teaches the model to internalize domain-specific retrieval skills through self-generated training data with round-trip consistency filtering.
  • When the parser fails, send the page. Figure text in PDFs routinely decodes to garbage, and no retriever recovers what was lost before retrieval ran. Rendering the page region at 200 dpi and passing it as an image block lets the model read what the parser destroyed, with no change to the index. A full page-image retrieval index (ColPali and its descendants) wins in a single stage and loses to text-plus-reranker once a reranker is in play, at 2,312 times the storage. Concatenating the top results from a text and a visual retriever beats either alone.
  • Technique selection should be driven by failure point diagnosis. Map your system's measured failures (FP1-FP7) to specific techniques from this book, starting with low-complexity interventions (hybrid search, reranking) and adding high-complexity ones (Self-RAG, agentic orchestration) only when simpler approaches fall short.
  • Production RAG requires pipeline versioning, continuous evaluation, and a three-level testing pyramid. Log full retrieval contexts, track pipeline configurations as versioned artifacts, and run component, integration, and regression tests at appropriate frequencies. Framework choice (LangChain, LlamaIndex, Haystack, DSPy, or direct implementation) should match your abstraction preferences and pipeline complexity.
  • Domain-specific agentic RAG demonstrates measurable gains with latency costs. The fintech case study showed retrieval accuracy rising from 54.12% to 62.35% at Hit@5, about 8 points, with average latency rising from 0.79 to 5.02 seconds for the same queries. That is a 6.4x slowdown bought with 8 points, on 85 questions, which is the trade you are actually being offered. The authors name sub-query generation as the largest contributor from qualitative inspection rather than an ablation.

FAQ

What does the RAGGED framework reveal about the main bottleneck in production RAG systems?RAGGED shows that reader robustness to noise is often more important than retriever quality. In many cases, improving the retriever helps less than expected if the generator cannot ignore irrelevant passages. This reframes production RAG design: a strong reader that can filter noise may matter more than a slightly better retriever.
What is the difference between a noise-robust reader and a noise-sensitive reader?A noise-robust reader keeps performance steady as more passages are retrieved, typically improving and then plateauing. A noise-sensitive reader reaches a peak at a small retrieval depth and then degrades as more irrelevant context is added. The first can safely use larger k, while the second needs careful retrieval depth tuning.
What do RSS and RSC measure in RAG evaluation?RSS, or RAG Stability Score, measures how consistently a model performs near its optimal retrieval depth. RSC, or RAG Scalability Coefficient, measures whether performance continues to improve as more passages are added. Together they capture stability and scalability separately, which traditional evaluation metrics often miss.
Why can retrieving more documents sometimes hurt answer quality?Because more retrieval can add noise that overwhelms the generator. If the reader model is not good at filtering irrelevant passages, adding context beyond the optimal retrieval depth can reduce answer quality instead of improving it. In those systems, retrieving 20 passages “just to be safe” may be a poor choice.
What is agentic RAG?Agentic RAG is a retrieval system that decides at runtime what to do next instead of following a fixed pipeline. It can choose whether to retrieve, reformulate the query, plan multi-step retrieval, evaluate an answer, or use additional tools. This makes the system more autonomous and better suited to complex queries.
What are the four main design patterns in agentic RAG?The four patterns are reflection, planning, tool use, and multi-agent collaboration. Reflection lets the system critique and improve its own answers. Planning breaks complex questions into sub-queries. Tool use extends retrieval beyond vector search. Multi-agent collaboration assigns different subtasks to specialized agents.
When is agentic RAG worth the extra latency?It is most worthwhile for complex, fragmented knowledge tasks where a single retrieval pass is not enough. It can improve retrieval accuracy and answer quality for hard enterprise questions, but it is usually too slow for simple factual lookups. The chapter emphasizes using it selectively, not everywhere.
How does RankRAG unify ranking and generation?RankRAG folds context ranking and answer generation into a single instruction-tuned model. The same model judges whether passages are relevant and then generates the answer from the top-scoring passages. This reduces pipeline complexity and aligns ranking with generation more closely than separate components do.
What is the main idea behind self-improving RAG systems?Self-improving RAG systems use their own signals and experience to get better over time. They collect logs and feedback, evaluate failures, apply targeted fixes, and redeploy improved configurations. Examples include learned gating, self-knowledge filtering, and synthetic data generation for domain adaptation.
How should teams choose between RAG techniques in production?Start by diagnosing the failure mode with evaluation metrics, then choose the lightest technique that addresses the problem. Use reranking or hybrid search for retrieval issues, context compression for noisy contexts, Self-RAG or CRAG for hallucination or faithfulness issues, and agentic or multi-step approaches for complex queries. The chapter’s guidance is to measure first, then intervene surgically.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Retrieval Augmented Generation, The Foundational Ideas ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Retrieval Augmented Generation, The Foundational Ideas ebook for free