A retrieval-augmented generation (RAG) system holds up in production when seven things are right: the documents go in clean, the chunks carry enough context to be understood on their own, retrieval combines meaning and keywords, answers cite their sources, access rights are enforced at retrieval time, the index stays current, and all of it is tested on real questions. When a RAG system gives a wrong answer, the cause is very often that the right passage never reached the model. So most of this guide is about retrieval. We rewrote it in November 2026.

What RAG is, and when to skip it

The term comes from a 2020 paper that combined a language model's built-in knowledge with a searchable external memory, and found the combination produced more specific and factual text than the model alone (Lewis et al., 2020). In a business system it works like this: your documents are split into passages and indexed; a question comes in; the system finds the most relevant passages; the model answers from them.

Before building any of that, check whether you need it. Anthropic points out that a knowledge base smaller than about 200,000 tokens, roughly 500 pages, can be placed in the prompt in full, with no retrieval step to get wrong (Anthropic, September 2024). With prompt caching, described in our guide to cutting LLM costs, that is often affordable. RAG is the right tool when the content is larger, changes often, or has to be filtered by who may see it. If the question is whether to retrain a model instead, see fine-tuning versus RAG.

1. Clean the documents before you index them

Retrieval can only find what ingestion preserved. The unglamorous work here decides the ceiling for everything after it.

2. Make chunks that can stand on their own

Documents are split into chunks because a model can't be handed the whole archive. How you split matters more than most teams expect.

Split along the document's own structure: sections, paragraphs, list items, whole tables. Fixed-length cuts break sentences and separate a rule from its exception. A few hundred tokens per chunk with a small overlap is a common starting point, and the right size is the one that scores best on your own test questions.

The larger problem is lost context. A chunk that reads "the notice period is three months" is useless if nothing in it says which contract type it belongs to. Anthropic's contextual retrieval method addresses this by adding a short, generated description of where each chunk sits in its document before indexing it. In their tests, contextual embeddings reduced the rate of failed retrievals by 35%, adding contextual keyword search brought the reduction to 49%, and adding a reranking step brought it to 67%. You don't have to adopt that exact method. The principle is what matters: carry the document title, section heading and any defining terms into every chunk.

3. Retrieve with meaning and with keywords

There are two ways to find a passage, and they fail in opposite ways.

MethodFindsMisses
Embedding searchPassages with the same meaning in different wordsExact codes, names and rare terms
Keyword search (BM25)Exact terms such as part numbers, error codes and article numbersParaphrases and synonyms
Both, then rerankingThe best of each list, re-ordered by a model that reads question and passage togetherLittle, at the price of an extra step

The same Anthropic study describes keyword search as particularly effective for queries that include unique identifiers or technical terms, and concludes that embeddings combined with BM25 work better than embeddings alone. Business questions are full of identifiers: order numbers, product codes, clause numbers, medication names. A system with embeddings only will keep missing them.

A few further practices carry over to almost every project:

4. Make the answer show its sources

Once the right passages arrive, the instruction to the model is simple and should be strict:

Then show the citations to the user as links to the source document and section. Citations do two jobs. They let people check an answer in seconds, which is what builds trust in the first weeks. And they make failures visible, so they get reported instead of quietly believed. A knowledge assistant that says "I couldn't find this in the handbook" is behaving correctly.

5. Enforce access rights at retrieval time

A RAG system makes everything in its index easy to find, including the things that were only protected by being hard to find. The OWASP Top 10 for LLM applications lists this as its own risk: weak access controls on a vector store can let users reach content they shouldn't see, and in stores shared between groups, one group's content can surface in another group's answers (LLM08:2025). The same entry recommends permission-aware stores, validated data sources and logs of what was retrieved.

6. Keep the index fresh

An assistant that confidently quotes last year's price list does more damage than one that doesn't answer. Freshness needs an owner and a mechanism:

7. Test retrieval and answers separately

Build a set of real questions, and for each one record which passage contains the answer. That allows two separate measurements: did retrieval return that passage, and was the answer faithful to the passages it was given? The Ragas framework formalises the same split between retrieval quality, faithfulness and answer quality (Es et al., 2023). Without it you'll tune the prompt for weeks to fix what is really a chunking problem. Rerun the set whenever you change the chunking, the embedding model, the number of passages or the prompt. The full method is in our guide to evaluating LLM quality.

When it goes wrong: a quick diagnosis

SymptomLikely causeFirst fix
Can't find an exact code or nameEmbedding search onlyAdd keyword search and merge the results
Answers mix up products or contract typesChunks without contextAdd title and section to each chunk
Quotes outdated rulesOld versions still indexedRemove duplicates, re-index on change
Right passage found, wrong answerToo many or badly ordered passages, loose instructionsRerank, send fewer, require citations
Answers reveal restricted contentNo permission filter at retrievalFilter by the user's access rights before ranking

The checklist

  1. Confirm the content is too large or too changeable to simply put in the prompt.
  2. Parse structure, remove noise and duplicates, keep metadata.
  3. Chunk along document structure and carry context into each chunk.
  4. Combine embedding and keyword search, then rerank.
  5. Require cited answers and an honest "not found".
  6. Filter by access rights before ranking, and log retrievals.
  7. Re-index on change and show document dates.
  8. Test retrieval and grounding separately on real questions, on every change.

Done this way, RAG is ordinary engineering: mostly data preparation, search and testing, with a model at the end. Neurova AI builds knowledge assistants on a company's own documents, with access rights and citations designed in. If you have an assistant that people have stopped trusting, the cause is usually in one of the seven steps above, and we can help you find which.

Frequently asked questions

What is retrieval-augmented generation (RAG)? RAG is a way of letting a language model answer from your own documents. When a question comes in, the system first searches a prepared index of your content for the most relevant passages, then gives those passages to the model together with the question and asks it to answer from them. The model's general knowledge is combined with a searchable store you control and can update.

When do I not need RAG? When the material is small enough to fit in the prompt. Anthropic notes that a knowledge base under about 200,000 tokens, roughly 500 pages, can simply be included in full, which removes retrieval as a source of error. RAG earns its place when the content is larger than that, changes often, or must be filtered by who is allowed to see what.

What is hybrid search in RAG? Hybrid search combines two ways of finding passages. Embedding search finds text with a similar meaning, even when the wording differs. Keyword search, usually BM25, finds exact terms such as product codes, names and error numbers. Running both and merging the results, often followed by a reranking step, finds the right passage more reliably than either method alone.

How do I stop a RAG system from making things up? Fix retrieval first, because most wrong answers start with the wrong passages. Then instruct the model to answer only from the supplied passages, to cite the passage for each claim and to say so when the answer is not there. Show the sources to the user, and test grounding on a set of real questions every time you change the system.

Written by Andreas Chitos, founder of Neurova AI. He builds AI systems and medical software from Eindhoven, the Netherlands. Get in touch.