What is retrieval-augmented generation (RAG)?
Retrieval-augmented generation (RAG) is a method in which an AI system first searches a set of documents for relevant passages, then uses them to write its answer.
Retrieval-augmented generation combines search with an AI model. When a question comes in, the system first retrieves the most relevant passages from a chosen collection of material, such as company policies, help articles, or project files, and adds them to the prompt. The model then writes its answer based on those passages rather than relying only on what it learned during training.
An HR team, for example, might set up an internal assistant that answers staff questions about leave, expenses, and benefits. When someone asks how much notice is needed before taking vacation, the system finds the relevant section of the employee handbook and passes it to the model, and the answer can point back to the exact page it came from, so the employee can check it.
RAG is a common way to make AI tools answer from an organization's own, current information without retraining the model. It also works around the context window, since only the relevant passages are sent rather than every document. When a tool offers to chat with files, a knowledge base, or a company wiki, it is often using some form of RAG.
RAG reduces hallucinations but does not eliminate them. If the search step finds the wrong passage, or the documents are out of date or contradict each other, the answer will reflect that. The model can also misread or overstate what a passage says. Keeping source documents current and checking the cited passages make RAG answers more trustworthy.
An example
A support assistant searches the help center for the relevant article before answering a customer's question, and links to that article in its reply.