AI basics
What is retrieval-augmented generation (RAG)? A plain guide
Retrieval-augmented generation lets an AI look up relevant documents before it answers. Learn how RAG works, why it reduces made-up answers, and where it fails.

Retrieval-augmented generation, usually shortened to RAG, is a way of making AI answers more accurate by letting the model look things up before it replies. Instead of relying only on what it absorbed in training, the system first retrieves relevant passages from a set of documents, then uses them to write the answer.
This guide explains what retrieval-augmented generation is, how it works step by step, where you already meet it, why it helps, and the ways it can still go wrong. It is useful background for anyone using AI with company files, help centres or web search.
What problem does RAG solve?
A language model on its own has two big gaps. Its knowledge stops at a training cut-off, and it knows nothing about private material like your company handbook, your product manuals or yesterday’s meeting notes. When asked about those, it may guess and produce a confident but invented answer.
Retraining a model every time a document changes would be slow and costly. RAG avoids that. The model stays the same, and fresh or private information is supplied at the moment of the question, like handing someone the right pages before asking them to answer.
The result is often described as an open-book exam rather than a closed-book one.
How does retrieval-augmented generation work?
A typical RAG system has two phases. Preparation happens once, or whenever documents change. Answering happens each time someone asks a question.
The search step often uses embeddings, which represent meaning as numbers so that a question and a passage with different wording can still match. Many systems combine this with classic keyword search to catch exact names and codes.
- Collect the documents: web pages, PDFs, manuals, tickets, notes.
- Split them into chunks of a few paragraphs each.
- Index the chunks so they can be searched quickly, often by converting each into an embedding.
- When a question arrives, search the index for the most relevant chunks.
- Place those chunks into the model’s prompt along with the question and instructions such as “answer using only these sources”.
- The model writes an answer, ideally with references to the chunks it used.
A citation proves a source was retrieved, not that the sentence next to it is faithful.
Where do you already meet RAG?
Any AI assistant that searches the web and shows sources next to its answer is using a form of retrieval-augmented generation. So is a help-centre chatbot that answers from a company’s support articles, or a workplace tool that lets you ask questions about shared drives.
When you upload a long document to an AI chat assistant and ask about it, the tool may also use retrieval behind the scenes, pulling out the most relevant sections rather than reading the whole file every time.
Clues that RAG is involved include numbered citations, links to source pages, and answers that mention specific documents by name.
Why does RAG make answers more reliable?
Grounding the model in real text reduces invented facts, because the right answer is sitting in front of it. It also allows up-to-date answers without retraining: update the documents and the next answer reflects the change.
Citations are another big benefit. When the answer points to its sources, you can check them in seconds. That turns the AI from an oracle you have to trust into a research assistant whose work you can verify.
RAG also helps with permissions. A company system can retrieve only documents the person asking is allowed to see, which is hard to achieve if the knowledge is baked into a model.
What can go wrong with RAG?
RAG is only as good as its retrieval. If the search pulls the wrong chunks, the model answers from the wrong material, or falls back on guessing. Questions phrased very differently from the documents, or answers split across many places, are common failure points.
The model can also misread a correct source, merge details from two documents, or add claims the source does not make while still showing a citation. A citation proves a source was retrieved, not that the sentence next to it is faithful.
Outdated or contradictory documents cause trouble too. If the knowledge base holds three versions of a policy, the AI may quote the old one.
How can you get better results from RAG-based tools?
Use the words your documents use. If the handbook says “annual leave”, ask about annual leave rather than vacation days. Ask one focused question at a time instead of bundling several.
Click through to the cited source for anything that matters, and check the passage actually says what the answer claims. If the tool lets you choose which files to search, narrow it to the relevant ones.
If you manage the documents, keep them current, remove old versions, and use clear headings. Well-organised source material improves answers more than any prompt trick.
Is RAG the same as fine-tuning?
No. Fine-tuning changes the model itself by training it on extra examples, which is good for teaching a style, format or specialised skill. RAG leaves the model unchanged and feeds it information at question time, which is better for facts that change or must be traceable.
Many real systems use both: a model fine-tuned to follow a company’s tone and format, plus retrieval to supply the facts.
Frequently asked questions
What does RAG stand for in AI?
+
RAG stands for retrieval-augmented generation. It means the AI retrieves relevant information from a set of documents or the web and then generates an answer based on it.
Does RAG stop AI hallucinations?
+
It reduces them a lot but does not eliminate them. The AI can still misread sources, combine details wrongly, or guess when retrieval finds nothing useful. Checking the cited passages is still wise.
What is the difference between RAG and fine-tuning?
+
Fine-tuning retrains the model to change its behaviour or skills. RAG supplies information at the time of the question without changing the model. RAG suits changing facts; fine-tuning suits style and format.
Is an AI chatbot with web search using RAG?
+
Broadly, yes. It searches the web, pulls relevant page content into the model’s context, and writes an answer from it, often with links. That is retrieval-augmented generation applied to the web.
What is a knowledge base in AI?
+
It is the collection of documents a RAG system searches, such as manuals, policies, articles or notes. The quality and freshness of the knowledge base largely decide the quality of the answers.
Do I need a vector database for RAG?
+
Not always. Vector databases are common because they make meaning-based search fast, but small projects can use simpler search, and many tools handle storage for you behind the scenes.
Retrieval-augmented generation gives AI an open book. It works best when the book is accurate and well organised, and when you still glance at the page it quotes.
How we research: Guides are written from established sources and checked for accuracy. They are general information, not professional advice.
Written by
Cortexpost Editorial Team
Artificial intelligence
Our writers work with AI tools every day and explain them plainly, without hype or doom.


