Part of the AI visibility glossary
What is Retrieval-augmented generation (RAG)?
Retrieval-augmented generation, or RAG, is a method in which a language model first looks up documents relevant to a question, from the web, a database or uploaded files, and then writes its answer with those passages in view. The answer can draw on information that was never part of the model’s training data.
Also called: RAG, Retrieval augmented generation
How it works
A RAG system runs in three steps:
- Retrieve. A search component finds passages that match the question.
- Augment. Those passages are added to the model’s input next to the question.
- Generate. The model writes an answer that can use both the passages and what it learned in training.
AWS describes RAG as making a model reference an authoritative knowledge base outside its training data before it responds, without the need to retrain the model. Wikipedia’s summary notes that the retrieved text can come from databases, uploaded documents or web sources.
Where the term comes from
The name comes from a 2020 research paper by Patrick Lewis and colleagues, "Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks". The paper describes models that combine two kinds of memory: what is stored in the model’s parameters, and an external index that is searched at answer time. Today the term is widely used for systems that search first and write second.
Why it matters for brands
When an AI assistant searches the web before answering, it is doing a form of retrieval. Your pages can only shape the retrieved part of that answer if the retrieval step can reach them and finds a passage that matches the question. A page that is blocked, hard to parse or vague about the facts gives the model little to work with, and the answer falls back on other pages or on what the model already believed.
Retrieval also explains why answers change. When the pages that rank for a question change, the passages a RAG system picks up change with them, even if the model stays the same.
How to check it yourself
- Ask an AI assistant a question your pages answer, with web search turned on, and note which pages it cites.
- Ask the same question with web search turned off, where the product allows it, and compare the two answers.
- If the search-on answer is more accurate about you, retrieval is working in your favour. If both answers are wrong, check whether your page states the fact plainly in a short, quotable passage.
- Confirm that your important pages are reachable by search crawlers and load their main text without needing scripts.
How this page was made
AI agents drafted this entry from the public sources listed below, and automated checks ran on it before it was published. Read our editorial policy.
Questions
Is RAG the same as fine-tuning?
No. Fine-tuning changes the model itself by training it further on new examples. RAG leaves the model unchanged and hands it relevant documents at the moment it answers, so new information can be added by updating the documents.
Does RAG stop a model from making things up?
It lowers the risk but does not remove it. The model can still misread a passage, combine two sources wrongly or fill gaps with a guess. Answers built on retrieved text are easier to check, because you can open the passages they used.
Do AI search engines use RAG?
AI search features that look up web pages before answering follow the same retrieve-then-generate pattern, even when they do not use the name. The details of each system, such as how pages are chosen and ranked, differ between products.
Sources
- What is RAG (Retrieval-Augmented Generation)? · Amazon Web Services
- Retrieval-augmented generation · Wikipedia
- Retrieval-augmented generation · Wikipedia
- Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks · arXiv