Retrieval-augmented generation is the default architecture for putting an LLM in front of a company's own knowledge, and for good reason: it grounds answers in real documents, keeps data out of model weights and updates as fast as your content does. It's also the architecture behind most "the AI made something up" incidents we get called in to fix. When we dig in, the model is rarely the culprit. The retrieval step handed it the wrong context, or no context, and the model did what models do — filled the gap fluently. If you are building one, see our RAG development services.
Here's what separates RAG systems that earn trust from the ones that quietly lose it.
Where RAG systems actually fail
Before tuning anything, it helps to name the ways a RAG answer goes wrong, because each one has a different fix:
- The document isn't in the index. The answer exists somewhere, but it was never ingested, failed parsing or sits behind a permission the pipeline couldn't read. No amount of prompt work fixes a missing source.
- The right chunk exists but isn't retrieved. The question uses different words than the document, or the relevant passage was split across two chunks and neither matches well on its own.
- The right chunk is retrieved but ranked too low. It sits at position twelve and never reaches the model's context.
- The context is correct but too noisy. Ten loosely related passages dilute the one that matters, and models can overlook details buried in the middle of a long prompt.
- The content is stale or contradictory. Two versions of a policy are both retrieved, and the model blends them into an answer that matches neither.
- The model ignores the context. Rarer than the others, but real when instructions are vague about whether the model may use its own background knowledge.
Knowing which of these you're facing is the difference between a one-day fix and a month of guessing.
Start with the corpus, not the vector database
Enterprise knowledge is not clean markdown. It's PDFs with tables that shatter on extraction, slide decks where the meaning lives in the diagram, ten versions of the same policy with one still in force, and pages where the title is the only thing that identifies the product. Before choosing an embedding model, spend the time on ingestion: layout-aware parsing, table preservation, deduplication, version resolution and metadata (owner, date, product, region) attached to every chunk. A RAG system is only as good as the worst document it retrieves from with confidence.
Chunk for meaning, and keep the breadcrumbs
Fixed 500-token windows are easy and wrong. Chunks should follow the document's own structure — sections, clauses, table rows — and each one should carry the headings above it so "the fee is 2%" doesn't lose which plan it belongs to. Two techniques pay off repeatedly: store small chunks for precise matching but return the surrounding parent section to the model, and prepend a one-line generated summary of the document to each chunk so context travels with it.
Choose embeddings and indexes on your own data
Public leaderboards are a starting point, not a decision. Embedding models differ in how they handle domain vocabulary, long passages, code, tables and non-English text, and the only reliable way to choose is to run the shortlist against your golden set and compare retrieval quality, latency and cost per million tokens. Dimension size matters too: larger vectors can improve recall but raise storage and query cost, so measure what you actually gain.
Plan for change. Embedding models get replaced, and a vector index built with one model can't be queried with another. Store the model name and version alongside every vector, keep the source text so you can re-embed, and design ingestion so a full re-index is a routine job rather than a migration project.
Hybrid search is the baseline, not the upgrade
Pure vector search misses exact identifiers — part numbers, error codes, people's names, clause references — that keyword search nails, while keyword search misses paraphrases that embeddings catch. Production systems run both and fuse the results, then apply a reranker to the top candidates. Add metadata filtering (the right region, the current version, documents this user is allowed to see) before semantic ranking, not after. Access control at retrieval time isn't optional in an enterprise; the model must never see a document the user couldn't open.
Fix the question before you search
Users don't write queries; they write fragments. "What about for contractors?" means nothing without the previous turn, and "the Q3 policy" may mean three documents. Production systems add a query-understanding step before retrieval:
- Rewrite follow-ups into standalone questions using the conversation so far.
- Expand abbreviations and internal jargon using a glossary your own teams maintain.
- Decompose compound questions ("compare the refund terms for plans A and B") into separate retrievals, then combine the results.
- Route by intent to the right source: policy library, ticket history, product docs or a structured database, rather than searching everything every time.
- Skip retrieval when it isn't needed. Greetings and simple clarifications don't need a search, and a needless retrieval only adds latency and noise.
Make the model show its work
Grounding is a contract between retrieval and generation: answer only from the supplied passages, cite which ones, and say "I don't have that" when they don't cover the question. Enforce it in the prompt, verify it after — a lightweight check that every claim in the answer is supported by a cited chunk catches most hallucinations before the user does. Citations aren't a UX nicety; they're how a user with a compliance question decides whether to trust the answer, and how you debug the ones they didn't.
Teach the system to say "I don't know"
An assistant that always answers will eventually answer something it shouldn't. Build abstention in deliberately: when the top retrieval scores fall below a threshold you've tuned on real queries, or no retrieved passage supports the answer, the system should say so plainly and offer a next step, such as a link to the right team, a search page or a human handoff. Users forgive "I couldn't find that" far more readily than a confident wrong answer, and each abstention is a labelled signal about a gap in your content.
Evaluate retrieval separately from generation
When an answer is wrong, you need to know which half failed. Build a golden set of real questions with the passages that should be retrieved, and track retrieval metrics (did the right chunk make the top five?) independently from answer metrics (faithfulness, completeness, correctness). Run it on every change to chunking, embeddings, prompts or the corpus itself. This is the same evaluation-first discipline we insist on for agents, applied one layer down — and in our experience it's the single change that turns RAG from a demo into a product.
Watch the long tail after launch
The questions users actually ask are not the ones in your test set. Log every query, retrieved passage set and answer; review the ones with low confidence, no citations or thumbs-down; and feed them back into the golden set and the ingestion backlog. Half of "the AI is wrong" tickets turn out to be "the document is missing or outdated" — which is a content-operations fix, not a model fix, and a much cheaper one.
Frequently asked questions
How big should RAG chunks be?
There is no universal size. Start from the document's own structure (sections, clauses, table rows), keep chunks small enough to match precisely, and return the parent section to the model for context. Then test two or three configurations against your golden set and keep the one that retrieves best.
Do I need a vector database for RAG?
Not necessarily. Many teams add vector search to an existing database such as Postgres with pgvector, and it is often enough for moderate corpus sizes. A dedicated vector store earns its place at larger scale or when you need specialised filtering and performance. Retrieval quality depends far more on parsing, chunking and hybrid search than on which store you pick.
When should we fine-tune instead of using RAG?
They solve different problems. RAG supplies current, citable knowledge at query time; fine-tuning changes how a model behaves, such as tone, format or a narrow task. If the problem is that answers are missing or outdated, fix retrieval. If outputs have the right facts but the wrong style or structure, consider fine-tuning, and often combine the two.
How do we measure whether RAG is working?
Track retrieval and generation separately. For retrieval, measure whether the right passage appears in the top results on a golden set of real questions. For generation, measure faithfulness to the cited passages, completeness and correctness. Add production signals such as thumbs-down rate, no-citation answers and abstention rate.
The short version
RAG that survives production is mostly retrieval engineering: a clean, versioned corpus with rich metadata; structure-aware chunking; hybrid search with permissions and reranking; enforced grounding with citations; and separate evaluation of retrieval and generation, fed by real query logs. Get retrieval right and the model looks brilliant. Get it wrong and no model can save you.
Got a knowledge assistant that users stopped trusting? Tell us about it — it's usually fixable. Or see our RAG development services.