RAG, short for retrieval-augmented generation, is a way of making an AI model look things up in your own documents before it answers.
Instead of relying only on what it learned in training, the system first finds the right documents, then hands them to the model with the question, so the answer is grounded in your real information rather than a confident guess.
The problem: a model only knows its training data
Ask a chat model 'What's our vacation policy?' or 'How do I reset the build server?' and it has a problem. Those answers live in your company's documents, which the model never saw during training. It may also have a cut-off date, so even public facts can be out of date.
A model in that position doesn't usually say 'I don't know'. It predicts a plausible answer, which is how you get confident nonsense, the problem covered in AI hallucinations.
RAG's fix is simple to say: don't just answer. Go look it up first.
The three steps
The name lists the steps in order.
- Retrieval. When a question comes in, the system searches the right documents for the passages most likely to answer it: HR policies, support tickets, manuals, legal files, that sacred folder of PDFs.
- Augmentation. It takes the user's question and the useful snippets and puts them together into the prompt. Now the model has context.
- Generation. The model writes an answer grounded in that retrieved information.
The model is still the writer. The documents are the notes on the desk.
Here is one question going through all three steps:
A question going through retrieval, augmentation and generation
Step 1 of 7: You ask what the vacation policy is.
Wondering how this was made? How we make these