RAG usually fails quietly, and that silence makes it expensive to find. The answer sounds plausible, cites something nearby, and still misses the fact the user needed. Teams then swap models, change prompts, rebuild indexes, or add more chunks, hoping one lever fixes the blob. That is the core production mistake: treating retrieval, context assembly, and generation as one system with one accuracy number.
A production RAG system is three systems in a trench coat. Retrieval must find the right evidence, context assembly must place usable evidence in the prompt, and generation must stay faithful to that evidence. Around those three sit security, permissions, freshness, observability and product fallbacks. If you do not measure those layers separately, every bug looks like "the model hallucinated."
This guide is deliberately diagnostic rather than a catalog of vector databases or a prompt recipe. The useful question is usually not "which model should we use?" It is "which layer failed, how do we know, and what is the cheapest reliable fix?"
The production RAG mental model
The basic pattern is simple: turn a query into embeddings, run vector search, place retrieved chunks into the model's context window, then ask the model to answer from that evidence. In practice, every verb hides choices.
- What gets embedded, and how are documents parsed?
- How are tables represented?
- How are permissions applied?
- How many candidates are retrieved before reranking?
- Does hybrid search catch exact strings?
- Does the answer cite source spans or whole documents?
Those choices matter more than the brand of vector database. A weak pipeline with a strong model still fails if the right passage never reaches the prompt. A strong retrieval pipeline with a vague answer contract still fails if the model treats evidence as optional decoration. A beautiful demo still fails in production if stale documents, duplicate pages, and permission filters are not part of the design.
The simplest operating model is a four-stage pipeline:
Production failures happen when this diagram is only implicit, and a team sees one final answer with one final thumbs-up or thumbs-down. The application did dozens of hidden things before the answer appeared, and the logs do not preserve them. The fix is not "more observability" in the abstract, it is an audit trace that preserves each layer so a bad answer can be replayed.
Debug from left to right, and do not tune answer prompts before you know retrieval recall. Do not add GraphRAG before you know whether ordinary search is missing evidence or finding it and presenting it badly. Do not blame the model before you test the model with the correct evidence already supplied.
RAG is not one technique
RAG is an architecture pattern rather than a single method, and the range it covers is wide. A small FAQ bot, a support copilot over millions of tickets, a legal research assistant, and a biomedical literature tool can all be "RAG" while needing very different retrieval designs.
The naive version is single-shot vector RAG, which embeds the user query, searches a vector index, takes the top few chunks, and asks the model to answer. This is often enough for a demo because demo questions are close to the content and the corpus is clean. It breaks when questions contain exact identifiers, when documents are long and structured, when users ask multi-hop questions, when terms are overloaded, or when the corpus contains stale near-duplicates.
Hybrid RAG combines semantic retrieval with lexical retrieval, and it exists because embeddings are intentionally lossy. They map text into a semantic space, which is useful when users say "refund window" and documents say "return eligibility period." But that same compression can blur SKU numbers, policy ids, contract clause names, error codes, dates, email addresses, and account names. Lexical retrieval catches exact tokens and semantic retrieval catches meaning, so a production system usually needs both.
Reranked RAG adds a second ranking stage, where first-pass retrieval pulls a wide candidate set, often 30 to 100 chunks. A reranker then scores each query-passage pair more carefully and selects the smaller set that enters the prompt. This is a common production upgrade because first-pass retrieval optimizes speed and breadth, while the reranker optimizes relevance under a smaller budget.
Late-interaction retrieval, such as ColBERT-style matching, sits between dense vector search and full cross-encoder reranking. It keeps token-level representations instead of collapsing the whole passage into one vector. That can improve matching when only a small phrase in a passage matters. The trade-off is index size and operational complexity.
Long-context RAG changes the boundary, because instead of aggressively selecting a few chunks, it may place a whole contract, policy bundle, or repository slice in the prompt. This can be better when the artifact is bounded and the user expects global reasoning over one object. It can be worse when the corpus is large, permissions vary, or the model must find a small fact buried in noisy context. Long context is not a free replacement for retrieval. It changes the failure mode from "missing evidence" to "evidence present but unattended or misused."
GraphRAG adds structured relationships, and it is useful when the answer depends on entities and edges rather than isolated passages: ownership chains, compliance dependencies, clinical relationships, procurement networks, fraud rings, or research maps. It is not a default upgrade, because it adds extraction, entity resolution, graph maintenance and graph-specific evaluation.
Agentic retrieval gives the model or controller multiple search steps. It can decompose a question, search several tools, inspect results, and decide what to search next. That helps when the retrieval plan is not obvious from the first user query. It also adds latency, cost, harder reproducibility, and more security surface. Use it when the system must plan, not when a better single retrieval query would work.
The production question is therefore not "should we use RAG?" It is "which retrieval architecture matches the question shape, corpus shape, risk, and latency budget?"
Failure mode 1: the right document was never retrieved
Retrieval failure is the cleanest failure to measure and the easiest to miss. A user asks about a refund exception, the policy exists, and the system retrieves generic billing pages instead. The model cannot answer from facts it never sees, so it either says it does not know or fabricates a likely policy.
The fix starts with a labeled set, so collect 50 to 200 real questions and mark the passages that should answer them. Measure recall at k: how often does the correct passage appear in the top 5, top 10, top 20, or top 50? If recall at 10 is 72 percent, the ceiling on grounded answer accuracy is already low. No prompt can reliably recover evidence that never arrived.
You do not need a perfect dataset to begin. Start with real queries from sales, support, operations, analysts, or internal users. For each query, ask a domain expert to identify the minimum sufficient evidence. That evidence should be a passage or section, not a whole document. If the gold label is "the employee handbook," the retrieval eval will be too forgiving. The answer may need the paragraph under "exceptions for parental leave," not any chunk from the handbook.
Measure multiple retrieval views:
| Metric | What it asks | Why it matters |
|---|---|---|
| Recall at k | Did any gold passage appear in top k? | Establishes the maximum answerable rate. |
| MRR | How high did the first useful passage rank? | Captures whether the answer is likely to survive context trimming. |
| Exact-token success | Did queries with ids, codes, names, and dates retrieve the right source? | Exposes embedding blind spots. |
| Filter loss | Was the gold passage removed by permissions, metadata, or recency filters? | Separates search quality from access logic. |
| Query rewrite loss | Did the rewritten query preserve key nouns and constraints? | Finds rewrites that make questions sound better but retrieve worse. |
Common causes are boring.
- Embeddings blur exact identifiers, so vector search misses part numbers, acronyms, customer-specific vocabulary, and uncommon names.
- Permissions filters remove the right document, or metadata filters are too strict.
- The parser drops table headers.
- A query rewrite drops a noun the match depended on, or a synonym list maps a term too broadly.
- The index is stale.
- The relevant document exists in the source system but never entered the ingestion job.
Hybrid search is the usual first fix because it attacks a real asymmetry: semantic search is good at approximate meaning and lexical search is good at exact evidence. In enterprise corpora users often mix the two: "What changed in SOC2-2025 controls for vendor ABC?" That single query carries semantic intent, an exact control family, a year and a vendor. A pure vector system may retrieve general compliance material. A pure lexical system may miss the wording. A hybrid system can bring both candidate families into the pool before reranking.
Query rewriting helps when user questions are conversational, underspecified, or full of pronouns. It hurts when the rewrite smooths away important constraints. Log the original query and rewritten query side by side. Evaluate both. Good rewrites expand meaning while preserving identifiers, dates, product names, jurisdiction, and negation. Bad rewrites turn "Can EU contractors expense coworking after July 2025?" into "contractor expense policy."
Permissions must be evaluated as retrieval behavior, not only security behavior. If the gold document is restricted and the user lacks access, the correct answer may be a refusal or an escalation path. If the user does have access but the filter removes the document because the ACL sync lagged, the system will look incompetent. Store enough trace data to distinguish "not retrieved because irrelevant" from "not retrieved because filtered."
Failure mode 2: the right chunk was retrieved but unusable
Sometimes the right document is present but the answer still fails, and the culprit is often chunking. A chunk may contain the number but not the condition, and another may contain the condition but not the exception, so the model sees fragments rather than evidence.
Chunking is a lossy transformation that turns authored documents into retrieval units. If it destroys structure on the way, retrieval may technically succeed while generation fails. The model may receive the exact sentence "approval is required after 30 days" but not the heading that says the rule applies only to "temporary equipment loans." It may receive a table cell value but not the column header. It may receive the answer paragraph but not the preceding definition of "eligible employee."
Good chunks preserve semantic units, respecting headings, sections, tables, lists, callouts, page boundaries when relevant, and document metadata. They include enough neighboring context to make a passage interpretable. They avoid huge chunks that bury the answer and tiny chunks that detach evidence from meaning.
Context assembly is its own product surface, deciding which chunks survive, in what order, with what titles, timestamps, permissions, and neighboring text. A retrieved paragraph from a contract is much more useful when the prompt also includes the section heading, document name, effective date, jurisdiction, parties, and the previous paragraph if it defines a term.
Reranking helps when first-pass retrieval finds the answer somewhere in a noisy candidate set. Late-interaction models can improve matching because they compare token-level evidence instead of compressing the whole query and passage into single vectors. But no ranking model can repair a chunking strategy that destroys meaning before indexing.
There are several recurring context assembly bugs:
| Bug | What happens | Fix |
|---|---|---|
| Orphan chunks | A chunk contains a value without its heading or condition. | Attach headings, breadcrumbs, and neighbor windows. |
| Duplicate crowding | Five versions of the same page consume the context budget. | Dedupe by canonical source, version, and semantic similarity. |
| Stale override | An old policy ranks above the current policy because it has more matching words. | Use source timestamps, active flags, and recency-aware ranking. |
| Table flattening | The parser extracts cells without row and column labels. | Serialize tables with headers, row labels, and captions. |
| Citation inflation | The prompt includes whole documents, so citations look authoritative but are vague. | Cite chunk ids, spans, or section ids, not just documents. |
| Bad ordering | The answer passage appears after weaker background context. | Put strongest, freshest, most specific evidence first. |
The phrase "top k" hides an important choice, because there is top k for retrieval candidates, top k after reranking, and top k after prompt packing. These should be different: retrieve wide enough to preserve recall, rerank carefully enough to improve precision, and pack tightly enough to keep only usable evidence. A common production pattern is retrieve 50, rerank to 10, dedupe and compress to 4 to 8 evidence blocks.
Prompt packing should be deterministic wherever possible, and if two chunks are equally relevant, prefer the fresher source, the source with stronger authority, the source the user has explicit permission to access, or the source from the narrower product area. Do not leave any of these decisions to accidental database ordering.
Failure mode 3: the model ignored or distorted evidence
If retrieval and context assembly are strong, the last layer is answer faithfulness. Hallucination enters here, but it is more useful to be specific. Did the model cite a passage that does not support the claim? Did it combine two unrelated snippets, or answer a question the user did not ask? Did it use prior knowledge when the evidence was silent? Did it present an inferred conclusion as a source-backed fact?
Measure this with a controlled eval, giving the model the gold passages directly and asking it to answer. If it still fails then retrieval is not the problem, and you can move on to tuning prompts, citation requirements, refusal behavior, model choice, and evals that score support at the claim level.
The best faithfulness prompt is not a magic paragraph. It is a contract: answer only from supplied evidence, cite exact source ids, say when evidence is missing, avoid unsupported prior knowledge, separate direct quotes from interpretation, and call out contradictions. Then test that contract against adversarial cases where the answer is absent, contradictory, stale, or present only in one small clause.
Claim-level evaluation is much more useful than answer-level evaluation, because an answer can be mostly right while containing one unsupported sentence that changes the business meaning. Break the answer into claims, then ask of each one whether the supplied evidence supports it, contradicts it, or is silent. This mirrors how a reviewer actually catches production mistakes.
Faithfulness failures often come from product pressure, and the pressure is reasonable. Users want concise answers so the model summarizes, they want decisive answers so it resolves ambiguity, and they want helpful answers so it fills gaps. Those behaviors are useful in a general assistant and dangerous in a grounded system, and the application needs a style that is helpful without pretending certainty.
A good answer contract says:
- Answer directly when the supplied evidence is sufficient.
- Cite the specific source id for every factual claim that depends on retrieved content.
- Say "I could not find enough evidence" when the answer is absent or ambiguous.
- Separate facts from recommendations.
- Surface conflicts instead of averaging them.
- Do not use external knowledge unless the product explicitly allows it and labels it.
The "do not use prior knowledge" part is not always absolute. A code assistant may need general programming knowledge plus retrieved repository context. A medical tool may need general terminology but must ground patient-specific recommendations. The product has to define which knowledge is allowed and how it is labeled. Ambiguity here becomes a production bug.
Failure mode 4: the corpus is wrong before retrieval starts
Many teams over-focus on search and under-focus on ingestion, and the retrieval system cannot compensate for a broken corpus. If documents are stale, duplicated, malformed, mislabeled or missing permissions, the model will inherit every one of those defects.
Ingestion is not "load files into a vector database", it is a data pipeline with quality gates. It needs source connectors, change detection, parsing, normalization, chunking, embedding, indexing, access control sync, deletion handling and version tracking, and each of those steps can fail silently.
PDFs are a common trap, because a human sees headings, columns, footnotes, tables and page order where a parser may emit text in the wrong order, skip headers, duplicate footers, merge columns, or detach table values from labels. Slide decks have similar problems: the visual layout carries meaning that plain text extraction may lose. Spreadsheets need row and column context to mean anything at all. Code repositories need file path, symbol, and dependency context. Slack and tickets need author, timestamp, thread, and channel metadata.
Deletion is as important as ingestion, and the failures are quieter. If a policy is removed from the source system but remains in the index, retrieval may find a document users cannot see anywhere else. If a customer account is deleted but its chunks remain, you have both a quality issue and a data retention issue, so build tombstone handling early.
The corpus should have a health dashboard:
| Health check | Question |
|---|---|
| Coverage | Which source systems, folders, repositories, or tables are indexed? |
| Freshness | How long between source update and searchable update? |
| Parse quality | What percentage of documents parse with warnings, empty chunks, or table loss? |
| Version clarity | Can the answer show which version of a source was used? |
| Permission parity | Do search results match the source system ACLs? |
| Duplication | How many near-identical chunks compete for the same query? |
| Deletion lag | How quickly do removed sources leave the index? |
Corpus bugs are often discovered through bad answers, and they should not depend on bad answers.
- Sample documents after ingestion, and render chunks for review.
- Compare source text to indexed text.
- Run canary queries against newly changed documents.
- Alert when a connector stops syncing or parse volume drops unexpectedly.
Failure mode 5: security is treated as a model behavior
RAG imports untrusted text directly into the prompt, which is a security property rather than an inconvenience. That makes prompt injection a first-class security issue, not a red-team footnote. A retrieved web page, customer document, support ticket, PDF, issue comment, or Slack message can contain instructions that try to override the system prompt, reveal hidden data, manipulate citations, or trigger tool calls.
Security guidance from OWASP treats prompt injection as a persistent application risk. Neither retrieval nor fine-tuning removes it, and the reason is structural: the model receives trusted instructions and untrusted data in the same context. The model can be trained and prompted to respect boundaries, but the application should not rely on the model as the only boundary.
The safest pattern here is capability separation, drawn along the same line the permissions already follow. Retrieval can read documents the user is allowed to read and generation can answer from those documents, while write actions, external messages, exports, administrative tools, billing changes, and data mutation sit behind a separate permission path. If the answer proposes an action, the application can show the evidence and ask for approval before executing it.
Defenses should sit outside the model wherever possible.
- Apply permissions before retrieval, and keep tool credentials out of retrieved context.
- Label retrieved text as data rather than instructions, and use allowlisted tools.
- Validate structured outputs, and require human review for sensitive actions.
- Add adversarial eval cases where retrieved documents carry malicious instructions.
- Treat citations as evidence, not as authorization.
Security bugs often arrive through helpful features, which is why they survive review. A system that retrieves from shared drives must preserve document permissions. A system that searches tickets must avoid leaking one customer's incident into another customer's answer. A system that lets the model call tools must ensure retrieved text cannot authorize a tool call. A system that summarizes uploaded PDFs must assume the PDF may contain hidden instructions, not just visible prose.
The practical threat model asks:
- What untrusted content can enter retrieval?
- What secrets or private documents can the model see?
- What tools or actions can the model influence?
- Could retrieved content change tool arguments, recipients, filters, or exports?
- What happens if the model follows malicious retrieved text exactly?
If the answer to the last question is "it sends data, mutates records, or reveals secrets," the architecture needs stronger boundaries. Prompting the model to ignore malicious text is useful but insufficient.
Failure mode 6: evals measure the wrong thing
RAG evals fail when they collapse the system into one score. "Answer accuracy: 78 percent" is not enough, because it does not tell you whether to improve retrieval, chunking, reranking, prompting, model selection, or source data. Modern RAG evaluation practice separates context relevance or recall, groundedness or faithfulness, answer relevance, and task correctness. Ragas, LlamaIndex, and LangSmith all expose versions of this separation.
Think of evaluation as a stack:
Retrieval evals need gold evidence, and they answer whether the retriever can find the right source. They are cheaper and more stable than full generation evals because they do not depend on model style. Use them heavily during indexing, chunking, query rewrite, embedding, hybrid search, and reranker experiments.
Context evals ask whether the selected context is useful. A context can have high recall and low precision, where the right chunk appears but sits buried among irrelevant ones, or high precision and low recall, where all the chunks are relevant background and none contain the answer. Those two cases need different fixes, and we have watched teams apply the wrong one for a quarter.
Groundedness evals compare answer claims to retrieved evidence, catching unsupported claims, weak citations and contradictions. LLM-as-judge can help here, but we calibrate it with human review on a sample before trusting it. Judges can be too lenient when claims sound plausible or when citations are nearby but not actually supportive.
Task evals measure whether the product outcome happened: did a support agent resolve the ticket, did a compliance analyst find the correct exception, did a salesperson prepare a correct account summary. These are the metrics the business cares about, and they are not substitutes for lower-level evals because they do not explain what broke.
Build eval sets by query type:
| Query type | Example risk | Required eval |
|---|---|---|
| Exact lookup | "What is policy FIN-042?" | Lexical recall and exact-token cases. |
| Semantic lookup | "Can I expense a monitor for remote work?" | Vector plus hybrid recall. |
| Conditional answer | "When does the exception apply?" | Chunk completeness and claim support. |
| Multi-hop | "Which vendors are affected by this new control?" | Planning, graph, or agentic retrieval eval. |
| Absent answer | "What is the 2027 policy?" when none exists | Refusal and unsupported-answer eval. |
| Conflicting sources | Old and new policies both indexed | Freshness, authority, and conflict surfacing. |
| Permission boundary | User asks about another account | ACL parity and leakage tests. |
| Injection | Retrieved text says "ignore previous instructions" | Security and tool-boundary eval. |
Do not wait for a huge benchmark, because a 100-query dataset with good labels beats a 5,000-query synthetic set that does not match production. Synthetic queries are useful for coverage, especially before launch, but real query logs should replace or supplement them quickly.
Version every eval run, storing the corpus snapshot, parser version, chunker version, embedding model, retriever config, reranker config, prompt version, model version and judge version. Without versioning you cannot explain why a score moved, and RAG quality is sensitive to small pipeline changes.
The practical levers
Here is the production failure matrix most teams need:
| Symptom | Likely layer | Measurement | First fix |
|---|---|---|---|
| Correct document absent from top results | Retrieval | Recall at k | Hybrid search and query rewrite inspection |
| Correct page present but answer misses condition | Context assembly | Gold passage inspection | Chunk with headings and neighbors |
| Many near-duplicates crowd out evidence | Context assembly | Diversity at k | Deduplicate and rerank |
| Answer cites weak evidence | Faithfulness | Claim support eval | Require source ids and refusals |
| Exact ids fail often | Retrieval | Exact-match query set | Add lexical search |
| Cross-document questions fail | Retrieval or planning | Multi-hop eval | Route to GraphRAG or agentic retrieval |
| Old policy wins over new policy | Corpus and ranking | Freshness eval | Version metadata and authority ranking |
| Private source appears in answer | Security | ACL leakage test | Permission filtering before retrieval |
| Model follows document instructions | Security | Injection eval | Treat retrieved text as data and constrain tools |
These levers stack, and the baseline we reach for is hybrid search, metadata-aware filtering, document-aware chunking, top 50 candidate retrieval, reranking to a smaller set, prompt assembly that preserves source structure, exact citations, and separate evals for retrieval, context, and answer faithfulness.
Anthropic put numbers on that stack in their contextual retrieval benchmarks, measured across codebases, fiction, arXiv papers and science papers:
| Pipeline | Top-20 retrieval failure rate | Precision at 20 |
|---|---|---|
| Standard embedding retrieval | 5.7% | 0.65 |
| Contextual embeddings and contextual BM25, then reranking | 1.9% | 0.89 |
A 67 percent reduction in retrieval failure, with no change to the model. The contextual step is worth understanding on its own: an embedding of "The revenue was $1.2B" is generic, and prepending generated document context turns it into something closer to "Acme Corp Q3 2024 revenue", which lands somewhere useful in the embedding space instead of near every other revenue sentence in the corpus.
Resist the instinct to overfit one bad answer. If a single executive sees a bad result, the team may rush to patch a prompt or pin a source. That may fix the screenshot and leave the system unchanged. Convert the failure into an eval case, classify the failed layer, then decide whether the fix generalizes.
Latency and cost matter because they shape feasible fixes. Reranking 100 candidates may improve quality but break an interactive product. Agentic retrieval may solve multi-hop questions but turn a two-second answer into a 30-second workflow. Long context may reduce retrieval misses but raise token cost and still require faithfulness checks. Treat quality, latency, cost, and risk as a four-way trade-off.
When GraphRAG or long context is better
GraphRAG is useful when the answer depends on relationships across entities, not just a passage match. Compliance ownership, supply chain dependency, fraud rings, research maps, and enterprise architecture questions often need graph traversal because the important fact is an edge between documents.
GraphRAG has real costs, because it requires entity extraction, relation extraction, canonicalization, conflict handling, graph updates, and graph retrieval logic. A bad graph can be worse than no graph because it gives false structure to messy text. Before adopting it, ask whether the failing questions are truly relational. If the failure is "the paragraph never entered top k," fix ordinary retrieval first. If the failure is "the answer requires following five relationships across many documents," a graph may be justified.
Long context is the opposite move: skip aggressive retrieval when the corpus fits and the access pattern justifies it. A small policy set, one contract, an incident timeline, or a project folder may work better by placing the whole artifact in the context window, especially with prompt caching. But long context does not remove the need for answer faithfulness. It changes the retrieval problem into an attention and instruction-following problem.
It also degrades in ways that are easy to miss. Chroma's Context Rot report tested 18 models, including GPT-4.1, Claude 4, Gemini 2.5 and Qwen3, and found reliability falls as input grows even on tasks as simple as retrieval and text replication. The fall is not uniform, and it depends on how similar the target is to the query, how many distractors sit alongside it, and how the surrounding text is structured.
That is the answer to "long context windows make retrieval obsolete": a larger window changes where the difficulty lives without removing it, and a system that stops measuring retrieval because everything now fits has stopped being able to see the failure.
The routing rule is practical:
| Architecture | Use when | Avoid when |
|---|---|---|
| Simple RAG | Large dynamic corpus, mostly single-hop questions | Exact ids and structured data dominate |
| Hybrid plus rerank | Mixed semantic and exact search, noisy corpus | Latency budget cannot support reranking |
| Long context | Bounded artifact, broad reading task, strong permission boundary | Corpus is large, dynamic, or multi-tenant |
| GraphRAG | Relationships are the product | Entity extraction is unreliable or questions are simple |
| Agentic retrieval | Search strategy requires multiple decisions | Determinism, latency, or security is more important |
Many mature products use routing rather than a single architecture, choosing the retrieval design per question type.
- A policy lookup route may use hybrid search.
- A contract review route may use long context.
- A vendor dependency route may use graph retrieval.
- A troubleshooting route may use agentic search over logs, docs, and tickets.
The router can be rule-based at first, and it should be evaluated like any other component.
Operating RAG after launch
RAG quality drifts because the corpus underneath it drifts. Documents change names, policies get superseded, teams upload duplicates, old pages remain indexed, and new vocabulary enters the business. A launch eval is only a starting point, and production systems need ongoing sampling of real queries, failed searches, low-confidence answers, and user corrections.
Logs should preserve the diagnostic layers, which means storing the user query, rewritten query if any, filters applied, retrieved candidates, reranker scores, chunks placed in context, answer, citations, model refusal state, latency, token usage and feedback. Without that trace a bad answer cannot be debugged, and with it the team can usually classify the failure in minutes.
Freshness is another operational issue, because some corpora can re-index nightly while others need near-real-time updates. If a support agent answers from a policy page that changed this morning, stale retrieval is a product bug. Track document version, index time, and source timestamp in the prompt so the model and reviewer can see whether evidence is current.
Feedback must be specific, because a thumbs-down on the final answer is weak. A reviewer marking "missing source," "wrong source," "unsupported claim," "outdated policy," "permission leak," "bad refusal," or "too vague" creates training data for the right subsystem, and that taxonomy turns subjective complaints into engineering work.
The operating dashboard should separate business health from retrieval health. Business health asks whether users are getting useful answers, whether tickets deflect, whether analysts save time, and whether escalation rates fall. Retrieval health asks whether the right evidence is found, whether source freshness is acceptable, whether restricted documents stay restricted, and whether answer claims are supported. If those metrics are mixed together, a product win can hide a technical regression, or a technical improvement can hide that users still do not trust the system.
A mature RAG system also has a designed fallback path. When retrieval confidence is low, the product can ask a clarifying question, search a broader corpus, route to long context, hand off to a human, or say exactly what evidence is missing. The fallback should be designed, not improvised by the model. Users forgive "I could not find the current policy for that account" more readily than a confident answer with a weak citation.
Fallbacks are also measurement surfaces, so track how often they fire, which corpus caused them, whether users resolved the task after the fallback, and whether the fallback prevented unsupported answers. A high refusal rate may mean the system is cautious, and it may equally mean retrieval is weak, so you need layer metrics to tell the difference.
A launch checklist that survives production
Before a RAG system handles real users, it should answer these questions:
| Area | Minimum bar |
|---|---|
| Corpus | Sources, versions, permissions, deletion behavior, and freshness are known. |
| Parsing | Tables, headings, lists, and document metadata survive ingestion checks. |
| Retrieval | A labeled eval set measures recall at k across query types. |
| Context | Reranking, dedupe, ordering, and prompt packing are deterministic enough to replay. |
| Faithfulness | Claim-level groundedness evals include absent, conflicting, and stale evidence cases. |
| Security | Prompt injection, ACL leakage, and tool-boundary tests are part of evaluation. |
| Observability | Logs preserve query, rewrite, filters, candidates, scores, context, answer, and citations. |
| Fallback | Low-confidence behavior is explicit and measured. |
| Ownership | Someone owns corpus health, eval health, and production triage. |
This checklist is intentionally unglamorous, because production RAG is mostly disciplined information retrieval, data engineering, security engineering and product design. The model matters, and it is only one component among those.
Production takeaways
Do not debug RAG as one blob, and build separate evals for retrieval recall, context usefulness, answer faithfulness, and task outcome. Start with hybrid search, sane chunking, reranking, and clear citation contracts before adopting more complex architectures. Route to long context, GraphRAG, or agentic retrieval only when the failure mode demands it.
Most production RAG systems fail because nobody can say which layer failed. Once the layers are visible, the fixes become much less mysterious.
Sources and further reading
The six failure modes above were arrived at from our own engagements. They map closely onto the taxonomy in Barnett et al., Seven Failure Points When Engineering a Retrieval Augmented Generation System (IEEE/ACM CAIN 2024), which studied research, education and biomedical deployments:
| Their failure point | Where it appears here |
|---|---|
| FP1 Missing content | Failure mode 4, the corpus is wrong before retrieval starts |
| FP2 Missed top-ranked documents | Failure mode 1, the right document was never retrieved |
| FP3 Not in context, consolidation limits | Failure mode 2, retrieved but unusable |
| FP4 Not extracted | Failure mode 3, the model ignored or distorted evidence |
| FP5 Wrong format, FP6 incorrect specificity, FP7 incomplete | Failure mode 6, evals measure the wrong thing |
Two of their conclusions are worth quoting in full, because they name the operating constraint precisely. "Validation of a RAG system is only feasible during operation." And "the robustness of a RAG system evolves rather than [being] designed in at the start." Both are the peer-reviewed version of the operating argument this guide makes: you cannot certify a RAG system before launch, so the eval harness and the monitoring are the design, not a follow-up to it.
This guide also leans on current evaluation and security practice from the RAG ecosystem:
- Ragas metrics documentation separates context precision, context recall, response relevancy, faithfulness, and related RAG metrics.
- LangSmith RAG evaluation documentation separates correctness, response relevance, groundedness, and retrieval relevance.
- LlamaIndex evaluation documentation covers response and retrieval evaluation patterns for RAG systems.
- OWASP LLM01:2025 Prompt Injection describes direct and indirect prompt injection, including why RAG and fine-tuning do not fully mitigate it.
- RAGAS: Automated Evaluation of Retrieval Augmented Generation frames RAG evaluation across retrieval quality, faithful use of passages, and generation quality.
- Towards Understanding Retrieval Accuracy and Prompt Quality in RAG Systems studies how retrieval recall, document selection, and prompting affect RAG correctness.
- Graph Retrieval-Augmented Generation: A Survey and Retrieval-Augmented Generation with Graphs survey where graph-based retrieval helps and what new design problems it introduces.