Skip to main content

Command Palette

Search for a command to run...

Where RAG Fails: Understanding the Limitations

Updated
9 min readView as Markdown
Where RAG Fails: Understanding the Limitations
D
Software Engineer

Why LLMs Alone Aren't Enough

Large Language Models (LLMs) like GPT or Claude are trained on massive amounts of text data, but that data has a cutoff date. Ask an LLM about something that happened after its training ended, or about your company's internal documentation, and it simply doesn't know. Worse, instead of saying "I don't know," it might confidently make something up. This is called hallucination.

There's a second problem too: even for things the model does know, it's recalling information from statistical patterns learned during training — not looking anything up. That's a bit like asking someone to answer a question purely from memory, with no notes, no textbook, and no way to double-check.

This is the gap that Retrieval-Augmented Generation (RAG) was built to close.


What Is RAG, and Why Was It Introduced?

RAG is a technique that gives an LLM access to external, up-to-date, or private information before it generates an answer. Instead of relying purely on what it memorized during training, the model is handed relevant documents or snippets of text at the moment of the question, and asked to answer using that information.

Think of the difference between:

  • A student answering an exam question purely from memory, versus

  • A student who's allowed to open a textbook to the right page first.

The second student is far more likely to get the answer right — not because they're smarter, but because they have the right context in front of them.

That's the core idea of RAG: retrieve relevant information, then generate an answer grounded in it.


1. How a Basic RAG Pipeline Works

A simple RAG system has a few key steps:

Step by step:

  1. The user asks a question.

  2. The system searches a knowledge base (documents, PDFs, wikis, databases) to find pieces of text that are related to the question. This is usually done using semantic search over a vector database.

  3. The most relevant chunks of text are retrieved and attached to the user's question.

  4. The LLM reads both the question and the retrieved context, then generates an answer based on it.

This is why RAG is often described as "open-book" generation — the model isn't guessing from memory, it's answering with reference material in front of it.


2. Common Scenarios Where RAG Works Well

RAG tends to shine when:

  • The knowledge base is well-organized and specific. Example: a support chatbot answering questions from a company's product documentation.

  • The information changes over time. Example: pulling in today's stock price or a recently updated policy document, instead of relying on stale training data.

  • The domain is narrow and well-defined. Example: a legal assistant retrieving clauses from a specific set of contracts.

  • Facts need to be traceable. Since RAG retrieves actual source documents, you can often show the user where the answer came from.

In these cases, RAG significantly reduces hallucination and improves accuracy, because the model has real, relevant text to work with instead of guessing.


3. Why RAG Sometimes Gives Incorrect Answers

Here's the important caveat that this article is really about: RAG improves the odds of a correct answer — it does not guarantee one.

RAG only works well if two things go right:

  1. The right information is retrieved, and

  2. The LLM correctly uses that information to generate a response.

If either step fails, the final answer can be wrong — sometimes confidently and convincingly wrong. Let's go through the common failure points.


4. Poor Retrieval and Missing Context

The most common failure in RAG systems is simple: the system retrieves the wrong information, or doesn't retrieve enough of the right information.

Good Retrieval:
Query: "What is the refund window for damaged items?"
   --> Retrieves: "Damaged items can be refunded within 30 days..."
   --> LLM answers correctly using this exact passage.

Poor Retrieval:
Query: "What is the refund window for damaged items?"
   --> Retrieves: "General return policy overview..." (too vague)
   --> Misses: "Damaged items: 30-day window" (buried elsewhere)
   --> LLM guesses, or gives an incomplete/incorrect answer.

This can happen because:

  • The search only finds documents that are superficially similar in wording, not necessarily the ones that actually answer the question.

  • The knowledge base doesn't contain the answer at all, but the retriever still returns "close enough" results, and the model tries to answer anyway.

  • The query itself is ambiguous, so the retriever pulls in the wrong topic entirely.

If the retrieved context is irrelevant or incomplete, the LLM is left to fill in gaps — which is exactly when hallucination creeps back in.


5. Poor Chunking and Its Impact on Responses

Before any retrieval happens, documents are split into smaller pieces called chunks. How this splitting is done has a huge effect on answer quality.

Original text:
"Employees are eligible for health insurance after 90 days
of employment. Coverage includes dental and vision, but
excludes cosmetic procedures."

Bad chunking (cuts mid-thought):
Chunk A: "Employees are eligible for health insurance after 90 days"
Chunk B: "of employment. Coverage includes dental and vision, but"
Chunk C: "excludes cosmetic procedures."

Good chunking (keeps full idea together):
Chunk A: "Employees are eligible for health insurance after 90 days
           of employment. Coverage includes dental and vision, but
           excludes cosmetic procedures."

If chunks are cut awkwardly — splitting a sentence, separating a table from its header, or breaking a rule from its exception — the retrieved text may look relevant but be missing a crucial detail. The LLM then answers based on a half-truth, not because it hallucinated, but because the source material it was given was itself incomplete.

This is why chunking strategy (chunk size, overlap, and structure-awareness) is one of the most underestimated parts of building a good RAG system.


6. Context Window Limitations

Every LLM has a maximum amount of text it can process at once — the context window. Even if retrieval works perfectly, there's a limit to how many chunks can be stuffed in before something has to be left out — or gets "lost" in the middle.

Two issues show up here:

  • Too much retrieved content can push out other important information, or exceed the model's limit entirely.

  • Position matters. Research has shown LLMs tend to pay more attention to information at the beginning and end of the context window, and can under-weight facts buried in the middle — even if that information was retrieved correctly.

So even a technically successful retrieval can still lead to a wrong answer, simply because of how the model processes long context.


7. Hallucinations Even With RAG

A common misconception is that RAG eliminates hallucination. It doesn't — it reduces the chances of it, but the LLM is still a generative model at its core.

Even with correct, relevant context, an LLM can:

  • Blend retrieved facts with its own prior knowledge, mixing them in a way that produces a plausible-sounding but incorrect statement.

  • Over-generalize from a specific example into a broader claim that isn't supported by the source.

  • Fill in gaps when the retrieved context almost answers the question but not quite, rather than admitting uncertainty.

In other words, RAG gives the model better raw material, but doesn't force it to stick strictly to that material. Prompting and guardrails help, but they don't remove this risk entirely.


8. Keeping Knowledge Bases Up to Date

RAG is only as good as the knowledge base behind it. This introduces an ongoing, often underestimated maintenance burden:

  • Stale documents lead to confidently wrong answers (e.g., an outdated pricing page still being retrieved and quoted as current).

  • Duplicate or conflicting information across documents can cause the retriever to pull contradictory chunks, leaving the LLM to arbitrate between them — not something it's naturally good at.

  • Re-indexing costs: every time source documents change, embeddings and indexes often need to be updated, which isn't always automated in real-world systems.

A RAG system connected to a knowledge base that hasn't been updated in a year isn't "wrong" from a technical standpoint — it's simply confidently repeating outdated truth.


9. When RAG Is Not the Right Solution

RAG isn't a universal fix. It tends to struggle when:

  • The task requires reasoning or computation, not lookup. Example: multi-step math problems or complex logical deductions — retrieval doesn't help here, since there's no "answer chunk" to find.

  • The knowledge base is small or low-quality. If there isn't good source material to retrieve from, RAG adds complexity without adding value.

  • The question requires synthesizing across an entire dataset rather than a few relevant chunks (e.g., "summarize trends across all 10,000 support tickets from last year"). Retrieval-based approaches aren't designed for this kind of aggregate analysis.

  • Real-time precision is critical and the underlying knowledge base can't be kept current enough (e.g., live financial trading data).

In these cases, other approaches — fine-tuning, structured databases with direct querying, agentic tool use, or hybrid systems — are often better suited.


Summary

RAG was introduced to solve a real problem: LLMs don't know what they weren't trained on, and they can't cite sources for what they do know. By retrieving relevant information before generating a response, RAG gives models something concrete to reason from, which meaningfully reduces hallucination and improves accuracy for many real-world tasks.

But RAG is not magic. It can fail at multiple points along the pipeline:

  • Retrieval can pull the wrong or incomplete information.

  • Chunking can strip away necessary context.

  • Context windows can cut off or de-prioritize retrieved facts.

  • The LLM can still hallucinate, even with good context.

  • Knowledge bases can go stale without anyone noticing.

  • Some problems simply aren't retrieval problems at all.

Understanding these failure points isn't a reason to avoid RAG — it's what separates a RAG system that sounds reliable from one that actually is reliable. Knowing where it can fail is the first step toward designing around those weaknesses.

Backend Series

Part 1 of 2

Backend Series is a technical blog series focused on modern backend development concepts, authentication systems, APIs, databases, and scalable server-side architecture. The series is designed to simplify complex backend topics through practical explanations, real-world examples, and developer-friendly guides. From JWT authentication and REST APIs to security best practices and database management, Backend Series helps developers strengthen their backend engineering skills and build production-ready applications.

Up next

JWT Authentication: Access Token and Refresh Token Flow Explained

In today's interconnected digital landscape, secure and seamless user authentication is paramount. Behind every successful login and persistent session lies a sophisticated interplay of cryptographic