What is RAG?
RAG stands for retrieval-augmented generation. Instead of answering from what the model memorised in training, the system looks things up first. It searches a set of documents, or the web, for material relevant to the question, places what it finds in the prompt and asks the model to answer using that material.
The point is to give a large language model facts it would not otherwise have: recent events, private company documents or anything too specific to have been learned in training.
How does retrieval-augmented generation work?
- Prepare the sources. Documents are split into passages and indexed so they can be searched, often as embeddings, which are numeric representations of meaning.
- Retrieve. When a question arrives, the system searches the index for the passages most relevant to it. On the public web, this step is a search engine query.
- Augment. The retrieved passages are added to the prompt alongside the question.
- Generate. The model writes an answer based on those passages, often citing which source each claim came from.
Answer quality depends on step 2. If retrieval returns the wrong passages, the model writes a confident answer from the wrong material.
RAG vs fine-tuning
| RAG | Fine-tuning | |
|---|---|---|
| What changes | The information given to the model at question time | The model itself, through further training |
| Best for | Facts that change or are private | Style, format and specialised behaviour |
| Updating | Edit the documents | Retrain |
| Sources | Can cite them | Cannot point to where an answer came from |
| Cost to start | Lower | Higher |
They are not rivals. Many systems fine-tune for tone and use RAG for facts.
Does RAG stop hallucinations?
It reduces them and does not remove them. A model with the right passage in front of it is far more likely to answer correctly, but it can still misread a source, blend two sources or fill a gap with a guess. Good systems show citations so a person can check.
Why does RAG matter for marketers?
AI search products work this way. Google's documentation describes AI Overviews and AI Mode issuing several related searches and building a response from the results, and other assistants with web search follow the same pattern. Two things follow.
First, a page must be retrievable: crawlable, indexed and relevant to the query the system runs. Second, the system lifts passages, not whole pages. A paragraph that answers a question completely on its own is easier to retrieve and quote than one that depends on the three before it.