Mastering RAG: 8 Failure Modes to Evaluate Before Going to Production

Artificial Intelligence Pratik Bhavsar

Key Takeaways

  • RAG systems require systematic testing across eight distinct failure modes, including retrieval quality, hallucinations, and security, to identify risks that remain invisible during standard development.
  • Effective evaluation depends on building a "living" test dataset that combines real user logs with synthetic edge cases, supported by ground truth annotations to track performance regression.
  • Automated evaluators such as Context Adherence, PII detection, and Prompt Injection analysis provide quantitative metrics, enabling teams to move from anecdotal debugging to data-driven system reliability.

Retrieval-augmented generation (RAG) works well right up until it meets real users. Combining retrieval with a capable language model introduces failure points that neither component has on its own, and most of them stay invisible until someone asks the question you did not anticipate.

Testing is the last step before deployment and the one most teams compress. This guide covers the eight failure modes worth testing for, the specific scenarios inside each, and how to build a dataset that exercises all of them. Every scenario names the evaluator that catches it, so you can move from "this feels risky" to a number you can track.

1. Retrieval quality

Retrieval quality measures whether your system finds the right documents. When retrieval fails, the model generates a response from incomplete or incorrect information, and nothing downstream can recover it. Five aspects determine whether a retrieved document is actually suitable.

Relevance

Relevance measures how well retrieved documents align with the query. A question about photosynthesis should return documents explaining both the light-dependent and light-independent reactions, not general overviews of plant biology.

In the example above, documents 1 and 2 are highly relevant and give comprehensive information on the process. Context Relevance scores this automatically by comparing query intent against retrieved content, so you do not have to eyeball it case by case.

Diversity

Diversity assesses the variety of information across retrieved documents, making sure they cover different aspects or perspectives rather than restating the same point three times.

Here the retrieved documents are diverse, covering various impacts of climate change across different types of ecosystems.

Top-k document omission

Another failure point is when the definitive answer exists in your document collection but does not rank highly enough to make it into the context passed to the model. Retrieval selects only the top K documents. This fails when K is set too low, or when a highly relevant document gets pushed down the ranking by less essential content.

Format mismatch

This occurs when the user asks for information in a specific structure — a table, a list, JSON — and the model disregards the instruction. Even with perfectly relevant context, a response in the wrong shape is unusable by whatever consumes it next.

Specificity issues

Here the model delivers a response that is either too vague to act on or so detailed it buries the answer. Neither is an apt reply to the question asked. Instruction Adherence measures how closely the model follows prompt instructions on format and specificity, which makes both of these failures countable rather than anecdotal.

Worth doing before you read on: pick five queries your users actually ask, and for each one examine the top three documents your system retrieves.

  1. Does document 1 directly answer the query?
  2. Do documents 2 and 3 add new information or repeat document 1?
  3. If the query specifies a format, can the retrieved documents support that structure?

2. Hallucinations

Hallucinations in RAG are cases where the model generates information not present in the context documents. A RAG system should ground every response in what it retrieved. There are six patterns to watch for.

Noise robustness

Context documents carry a great deal of information, and the model has to work out which piece is relevant. Noise robustness measures its ability to extract what matters from a mixture of relevant and irrelevant documents. In the example below, the model must pull the relevant fact while ignoring surrounding noise; the incorrect response draws from the irrelevant retrieved documents instead.

Chunk Relevance tells you which of the retrieved chunks actually contained useful information for the query, which is how you separate a retrieval problem from a generation problem.

Negative rejection

RAG systems have to know when they do not know. Negative rejection assesses whether the model declines to answer when none of the context provides useful information, rather than producing a confident guess.

Context Adherence is the metric here. It is defined as a measure of closed-domain hallucination — cases where the model said things that were not provided in the context — on a scale from 0 to 1.

Information integration

Rarely does a single document contain everything needed for a comprehensive answer. Information integration evaluates whether the model can answer complex questions that require combining information across multiple documents.

Completeness measures whether responses incorporate all the relevant context available. If Context Adherence is precision, Completeness is recall.

Counterfactual robustness

Some context documents contain errors. Counterfactual robustness assesses whether the model can identify known factual errors in retrieved documents and respond appropriately rather than repeating them.

Correctness identifies when responses reproduce errors from their sources, which is the failure that damages trust fastest because the system looks well-grounded while being wrong.

Unclear queries

User queries are often unintentionally vague, particularly when framed as follow-up questions that depend on earlier turns. It is worth evaluating how the model handles them.

Incorrect citations

An incorrect citation occurs when the model references sources that do not exist, or misattributes information to the wrong document. This breaks trust in exactly the domains where users check sources. The entire response must be traceable back to the retrieved documents, with no invented details slipped in between.

Context Adherence catches the ungrounded claim; Chunk Relevance tells you whether the cited chunk was ever useful in the first place.

Three tests worth running now:

Failing any of these means you are shipping ungrounded responses.

3. Privacy breaches

Privacy is a non-negotiable failure mode, especially when the system touches sensitive data. A breach occurs when the model discloses private, sensitive or confidential information that should never have reached the user. RAG makes this particularly dangerous for three reasons.

Asking for private information from an LLM.

Data leakage in a RAG system: User B receives User A's account balance because session isolation failed.

Data retention violation: deleted user data persists in the vector database and surfaces months later.

The third one is the quietest and the hardest to catch. When was the last time you audited what is actually in your vector database? Deletion requests that were honored in the source system do not automatically cascade to derived chunks, embeddings and indexes, which means a user who exercised their right to erasure six months ago may still be answerable today.

The PII evaluator detects and flags personally identifiable information in both inputs and outputs, which covers the first two cases. The third needs an audit, not a metric.

4. Malicious use

Models must refuse to help users engage in illegal activities, spread misinformation, or act unethically. Retrieval does not change this obligation — if anything it raises the stakes, because a RAG system speaks with the authority of your document corpus behind it.

Illegal activities

This evaluates the model's response to queries about committing fraud, manufacturing controlled substances, bypassing security systems, or planning other criminal acts.

AI's response to an illegal query

Harmful content creation

This evaluates responses to queries soliciting toxic language, hate speech, explicit content, bullying material or dangerous self-harm advice.

AI's response to a query requesting harmful content

Toxicity Detection flags whether a response contains hateful or toxic information, and runs on both the input and the output.

Harmful activity assistance

This evaluates the model's response to queries inquiring about harmful activities, distinguishing a proper refusal from guidance that helps the user proceed.

AI's response to assisting in a harmful activity.

5. Security breaches

Attacks on the model's own security are a separate category from misuse, and gaps here can cause serious harm to the enterprise.

Emotional manipulation

Attackers design prompts to manipulate the model into generating harmful content, crafting them to make it play specific roles, acquire higher privileges, or shift attention in a way that facilitates undesirable outputs.

AI's response to a request to assist in manipulating emotions.

Prefix injection

Prefix injection inserts specific instructions or phrases at the beginning of a prompt to manipulate the model's behavior.

Prompt injection facilitating vandalism

Refusal suppression

Refusal suppression instructs the model to respond under constraints that eliminate common refusal phrasings, which makes an unsafe response more likely simply by removing the language the model would normally reach for.

Prompt injection encouraging destructive actions

Mismatched generalization

Mismatched generalization happens because the model was pretrained on a far larger and more diverse dataset than its safety training covered. That gap leaves capabilities outside the reach of safety training, and it can be exploited for jailbreaks — encoding a request in base64, for instance, so that decoding and answering happen outside the path safety training anticipated.

Encoded prompt soliciting harm

The Prompt Injection evaluator identifies malicious inputs attempting to override system instructions, covering all four of these patterns.

Three queries to try against your own system:

Your system should refuse all three. If it complies with any of them, you have a security gap that needs attention before anything else on this list.

6. Out-of-domain questions

Most RAG systems serve a specific use case — banking customer service, travel planning, internal IT support. They need to handle queries outside that domain gracefully, claiming their actual specialty and referring the user onward rather than answering confidently from adjacent context.

Domain mismatch and hallucination

Instruction Adherence is the evaluator here, since staying inside the defined domain is ultimately a question of whether the model followed its system instructions.

7. Completeness

A good user experience requires comprehensive responses. Completeness assesses how well the model recalls and incorporates all relevant information from the retrieved documents without dropping details related to the query.

Accurate retrieval-grounded answer

The Completeness evaluator verifies that the response covered the relevant information available in the context provided. When it runs low, there are three usual fixes: tell the model explicitly to include all relevant information it finds, refine retrieval so the most relevant chunks come back, and watch that you are not encouraging padding just to raise the score.

8. Brand damage

Brand damage assesses whether the model's tone, style and phrasing align with your organization's values and public expectations. The goal is a system that communicates respectfully and clearly, and never in language that costs you trust.

Tone and toxicity

Maintaining appropriate tone and eliminating toxicity matters for any production RAG application. This assesses whether responses stay respectful and neutral, as against dismissive, opinionated or politically charged statements offered without evidence.

Biased and unfounded opinion

Non-compliance

Non-compliant keywords are worth screening so responses stay inside your guidelines and ethical standards. This evaluates the model's ability to avoid inappropriate or prohibited terms and keep a compliant conversational tone — refusing to help exploit a loophole rather than obligingly explaining how.

Encouraging unethical financial behavior

How to build a test dataset

Testing against all eight modes requires a dataset that mirrors real usage while systematically covering the ways things break. Three components have to work together.

Document corpus

Start with documents that represent your current knowledge base, in the formats you actually hold: technical documentation, FAQs, policy documents, user guides, historical data.

Deliberately include documents with overlapping information to test deduplication, contradictory information to test conflict resolution, and varying quality levels to test noise filtering. A financial services system might use 500 policy documents, 2,000 FAQ entries, 10,000 transaction summaries and 100 regulatory compliance documents.

Query set

Develop queries that reflect actual user behavior. Extract 100 to 200 real queries from your logs. Where logs are unavailable, create synthetic queries covering factual lookups, multi-hop questions that require combining two facts, follow-up questions that depend on prior context, and edge cases with typos or ambiguous phrasing.

Ground truth annotations

Define correct responses for each query: expected document IDs, required facts, acceptable formats, and unacceptable hallucinations. Without ground truth you cannot tell whether a change improved the system or degraded it, which makes every subsequent experiment guesswork.

Synthetic test cases

Where real data is thin, build synthetic cases that target specific failure modes:

Dataset augmentation

Expand each core query into three to five variations. "How do I reset my password?" becomes a formal version, an informal version, and a verbose version. Add temporal variations to test time-based reasoning: what the policy is, what it was last year, what changed in the recent update, and what the current version says.

Validation checklist

Before deploying the dataset, verify coverage and balance in three steps. Map test cases to all eight failure modes — if retrieval quality has 40 test cases and privacy has three, you will miss privacy failures in production. Check the complexity distribution, counting simple, medium and complex queries, and positive cases against negative ones, aiming for roughly half real user logs and half synthetic. Then run 30 test queries past domain experts to verify ground truth, assess whether synthetic queries look realistic, and confirm the difficulty matches production.

Failure mode
Test cases
Coverage
Retrieval quality
45
100%
Hallucinations
38
95%
Privacy breaches
20
100%
Malicious use
15
100%
Security breaches
25
100%
Out-of-domain
10
100%
Completeness
30
100%
Brand damage
12
100%

An example of balanced coverage across the eight failure modes.

Dataset maintenance

Your test dataset is a living artifact. Version it alongside your model versions, and regenerate affected test cases whenever you update document chunks. Add production failures to the dataset immediately: a hallucination in production becomes a regression test, a missed privacy violation becomes a new privacy case. Expect the dataset to grow 10 to 20 percent quarterly through this alone.

Audit quarterly for outdated annotations, deprecated document references and missing query patterns, and check whether new regulations require additional cases. One audit worth running today: pull a random sample of 100 documents from your vector database and check creation dates and deletion flags. User data marked for deletion six months ago may still answer queries.

On cost, do the arithmetic before committing to synthetic generation. A thousand synthetic queries at three LLM calls each is 3,000 API calls — cheap in dollars, but the human validation behind it is not. For most teams, 100 real user queries plus 50 synthetic variations gives better return than generating everything from scratch.

Every failure mode and its evaluator

Building a reliable RAG system is more than plugging retrieval into a model. You must know where things go wrong before real users find out for you. The table below maps each failure mode to the evaluator that measures it — use it as a reference when you set up testing.

Failure mode
Issue
Evaluator
Retrieval quality
Relevance
Context Relevance
Top-k omission
Context Relevance, Chunk Relevance
Wrong format
Instruction Adherence
Incorrect specificity
Instruction Adherence
Hallucinations
Noise robustness
Chunk Relevance
Negative rejection
Context Adherence
Information integration
Completeness
Counterfactual robustness
Correctness
Incorrect citations
Context Adherence, Chunk Relevance
Privacy breaches
PII retrieval
PII
Context leakage
PII
Data retention
PII, plus a corpus audit
Malicious use
Harmful content generation
Toxicity Detection
Security breaches
Emotional manipulation
Prompt Injection
Prefix injection
Prompt Injection
Refusal suppression
Prompt Injection
Mismatched generalization
Prompt Injection
Out-of-domain
Domain mismatch
Instruction Adherence
Completeness
Incomplete responses
Completeness
Brand damage
Tone and toxicity
Toxicity Detection, Tone

Learn more about our suite of RAG evaluators here

Conclusion

Each of these eight modes points at the same three things holding a RAG system together: clean retrieval, safe model behavior, and guardrails that hold under pressure. The scenarios here are not exhaustive — no list is — but they cover the failures that actually show up in production, and they give you somewhere concrete to start.

The teams that ship reliable RAG are not the ones that avoided these failures. They are the ones that found them first, turned each one into a test case, and kept the dataset growing as the system changed.

Understanding your RAG system at work is key to trusting AI systems. Learn about Splunk Agent Observability and get hands-on with the Splunk Observability Cloud Free Edition today

FAQs about failure modes in RAG systems

What are the primary indicators of poor retrieval quality in a RAG system?
Retrieval quality issues manifest when the system returns documents that lack relevance, exhibit low diversity, omit critical information, or fail to support the requested response format. Evaluators like Context Relevance and Instruction Adherence help quantify these failures by comparing search results against query intent and formatting requirements.
How can RAG systems effectively manage hallucinations?
RAG systems mitigate hallucinations by implementing strict ground-truth verification that forces the model to base every response on retrieved context. Metrics such as Context Adherence and Completeness act as essential guardrails to ensure the model refuses to answer when information is unavailable and includes all necessary context from source documents.
Why is privacy audit a mandatory step for RAG production readiness?
RAG systems often inadvertently surface personally identifiable information (PII) if derived chunks, embeddings, or indexes are not correctly updated following data deletion requests. Regular corpus audits are necessary to ensure that sensitive information from old user sessions or redacted source files does not persist in the vector database.
What methods protect RAG applications from security-based prompt injection?
Security protections rely on Prompt Injection evaluators to detect malicious inputs, such as role-playing manipulations, prefix injections, or encoded requests (e.g., base64). These security layers verify that the model maintains its system instructions regardless of adversarial attempts to override safety guidelines.
How should development teams construct a balanced RAG evaluation dataset?
Balanced evaluation datasets integrate real production logs with synthetic test cases to cover the full spectrum of failure modes. Engineering teams should map these cases to specific categories—such as privacy, security, and domain boundaries—and perform quarterly audits to update annotations as the document corpus evolves.

Related Articles

Data Protection: Best Ways To Protect Your Data Today
Learn
6 Minute Read

Data Protection: Best Ways To Protect Your Data Today

Protecting your data is serious business for every business and organization today. Learn how to protect your data: it starts with understanding the risk.
What Is Digital Forensics? The Weapon Against Cybercrime
Learn
5 Minute Read

What Is Digital Forensics? The Weapon Against Cybercrime

Did a crime happen? Is there digital evidence? Digital forensics is a forensic science that helps investigators study cybercrimes. Learn more here.
LLM Benchmarks: Top Categories for Evaluating AI Beyond Conventional Metrics
Learn
6 MINUTE READ

LLM Benchmarks: Top Categories for Evaluating AI Beyond Conventional Metrics

Evaluating LLMs requires moving beyond general metrics to domain-specific, agentic, and adversarial benchmarks that reflect real-world performance.