Explainer · Updated November 28, 2026 · 3 minute read
What is retrieval-augmented generation (RAG)?
The short answer
Retrieval-augmented generation (RAG) is a technique in which an AI system looks up relevant documents before it answers and gives them to the language model along with the question. The model then writes its answer from that material, which lets it use current or private information that was never part of its training.
How RAG works
A language model on its own answers from what it absorbed during training. That knowledge stops at a cutoff date and does not include a company's internal files. RAG adds a search step in front of the model.
When a question comes in, the system searches a collection of documents for passages that look relevant. It places the best matches in the prompt, together with the question and an instruction to answer from them. The model reads all of it and writes a reply, often with citations that point back to the sources.
Where RAG is used
RAG sits behind many products that answer questions about specific material.
- AI search tools such as Perplexity retrieve web pages and cite them in the answer.
- Company assistants answer staff questions from internal policies and manuals.
- Customer support bots answer from a product's help pages.
- Coding assistants often search a project for relevant files before they suggest a change.
How it compares with fine-tuning
Fine-tuning changes the model itself through extra training. RAG leaves the model untouched and changes what it is shown at the moment of the question. Updating a RAG system means updating the document collection, which can be done at any time and needs no training.
RAG suits questions that depend on specific facts or documents. Fine-tuning is the better choice when the model already has the information and the problem is how it responds, such as tone or output format. Some applications skip retrieval and place whole documents in the prompt, which a long context window allows but which costs more per question as the material grows.
Limits
RAG reduces made-up answers, known as hallucinations, but does not remove them. If the search step returns the wrong passages, the model may answer confidently from poor material, or ignore the documents and fall back on its training. Retrieved pages can also contain text written to manipulate the model, a problem known as prompt injection.
Common questions
What does RAG stand for?
RAG stands for retrieval-augmented generation. Retrieval is the search step, and generation is the model writing the answer.
Do you need a vector database for RAG?
No. Retrieval can run on any search system, including ordinary keyword search or a web search engine. Vector databases are common because they find passages by meaning when the wording differs.
Is RAG the same as an AI searching the web?
Not exactly. A chatbot that searches the web before it replies is doing one form of RAG, and the same approach works over any collection of text, such as a company's private documents.