RAG stands for retrieval augmented generation. It sounds technical and it is not hard to explain. It means a language model is given the answer at the moment it writes, by looking up your own documents first, instead of answering from memory.
Most business owners meet the idea through a demo. A chatbot appears to know the business inside out: the refund policy, the warranty terms, the price list. Some of those demos are genuinely useful. Others are wired to a document folder nobody has updated since last year, and the bot answers confidently from the wrong file.
Here is the plain version, including the parts that go wrong.
What the model knows, and what it does not
A language model stores patterns from a huge amount of text. It does not hold your price list, your policies or the notes from last week's sales call. It has never seen any of it. You cannot paste it all into the prompt either, because prompts have a size limit and most businesses hold more reference material than a model can read in one go.
Retrieval augmented generation is the workaround. The system finds the relevant part of your material first, gives only that to the model, and the model writes the answer from it.
What happens under the hood
Five steps sit between the question and the answer.
- Chunking. Your documents are split into pieces. Too large and the model gets noise. Too small and it loses the context that makes a rule meaningful.
- Indexing. Each chunk is turned into a list of numbers, called an embedding, and stored. A vector database such as Pinecone does this job, and database extensions do the same thing inside Postgres.
- Search. The question is turned into a list of numbers too, and the closest chunks are pulled back. Good systems mix this with keyword search, because part numbers need exact matching.
- Generation. The question and the retrieved chunks go to the model, with instructions to answer only from the supplied material and to say so when the answer is not in the documents.
- Citing. The system returns the source passage. This is not decoration. It is the difference between an answer you can check and one you have to take on faith.
Why the retrieval part is the hard part
The model is the easy part. Modern models write clean answers from supplied text.
Retrieval is where systems go wrong. A question about the warranty for model B can pull the paragraph about model A, because the two documents share most of their wording. The model then answers confidently from the wrong chunk. No amount of prompt writing fixes a chunk that was never the right one.
Where RAG earns its place
In my experience it pays off in a narrow set of cases.
- An internal assistant. Staff ask a question whose answer is written down somewhere, and getting it means searching a wiki, two drives and a colleague.
- Support. Answers come from past tickets, product manuals and policy notes, and a person approves anything that reaches a customer.
- Sales and consulting. A colleague asks what to say when a client raises a particular point, and the answer comes from your own proposals and call notes.
- Compliance and audit. Staff need the current policy text and the source of it, not a summary written from memory.
The common feature is that the answer exists in writing, and finding it is the slow part.
Where it goes wrong
I would rather say this than sell the idea.
Stale documents. Retrieval is very good at finding old guidance. If your procedure changed and the files did not, you have built a fast way to give the wrong answer.
Questions the material cannot answer. If the answer is not in the documents, a good system says so. A lazy one invents it. You need to test that case deliberately.
Permission blindness. A naive index holds every document in one pile, including the ones a given person must not see. Access rules belong in the retrieval layer, not in the prompt.
No evaluation. A system with no test set cannot tell you when it gets worse. I keep a set of real questions and check them after any change to the chunking, the search or the prompt.
When a normal search box is enough
If people can already find the document, RAG is decoration. A well organised knowledge base with good titles, sensible folders and links between pages often beats a chatbot, and it never gives a confident wrong answer.
Before building anything, I ask for the real questions. If most are answered by finding the right page, the fix is better internal links, not a language model.
A sensible way to start
Pick one set of questions that people ask repeatedly and that have written answers.
- Collect fifty real questions from the team.
- Find the documents that answer them.
- Build the smallest version: chunk, index, search, answer, cite.
- Test against the fifty questions, including the awkward ones.
Keep a human in the loop for anything that reaches a customer.
What I would look at first
If you want a straight read on whether RAG fits your setup, the AI agent development service explains how I build and hand over the parts around the model. I have also written up how the projects on this site were built, and you can ask for a free project review to look at your own documents first. My pricing page sets out how this work is scoped and priced.
If you want the commercial side of it, the AI agents service covers how I build and hand them over.
The AI agents service covers how I build this, and the pricing page explains what decides the cost.
For the commercial side of it, the AI agents service covers how I build and hand over this, and the pricing page explains what decides the cost.