Retrieval-augmented generation, or RAG, combines retrieval of relevant information with generation of an answer. Instead of relying only on patterns stored in model weights, the application supplies selected source material when it asks the model to respond.
Suppose a team needs answers from its current room-booking policy. A RAG application can retrieve the relevant policy section and include it with the user’s question. Updating the source library can change future answers without retraining the generator. The foundational RAG research combines parametric models with an external retrieval mechanism. RAG research paper
The two sides of a RAG system
Preparing the information includes collecting authorized documents, extracting text, preserving useful structure, recording sources and versions, and making the material searchable. Large documents are often divided into smaller chunks so retrieval can select a relevant passage.
Answering a question includes searching, selecting or reranking results, placing appropriate passages in context, and generating an answer that identifies its sources. A final check should determine whether the cited passages actually support the claims.
Search may use keywords, vector similarity, structured queries, or a combination. Embeddings represent inputs as numerical vectors; related content can be close according to a chosen similarity measure. Similarity is a retrieval signal, not a guarantee that a passage answers the question. RAG does not inherently require a vector database. See vector databases and semantic search for the roles of indexes, filters, and ranking.
What makes retrieval agentic?
“Agentic RAG” generally describes a system that can adapt its retrieval process. It might rewrite a query, choose among approved sources, perform a second search, or split a complex question into smaller questions. The amount of autonomy varies between implementations.
For a question about booking and cancellation, a fixed retriever might fetch both sections in one pass. An adaptive system could first find the booking rule, notice that cancellation is still unanswered, and search again. This resembles the observation-and-action loop explored in ReAct. ReAct research
The additional search must earn its cost. A clear single-document question often needs a simple retrieval path. Set search and time limits, and let the system report that it cannot find enough evidence.
Where errors enter
An answer can fail because the correct source was absent, the retriever missed it, the chunk omitted an important exception, or the generator misread the retrieved text. Diagnose those stages separately.
Preserve access permissions during indexing and retrieval. Apply authorization before material reaches the model. A prompt saying “do not reveal confidential documents” does not undo the exposure caused by inserting those documents into context.
Stale and conflicting documents need explicit handling. Keep effective dates and version identifiers. If a question depends on a date, choose the applicable version or explain the conflict.
Test retrieval and answers separately
For a small fictional policy library, create ten questions and mark which source passages should answer each one. Include two questions with no answer in the library and one ambiguous question.
First inspect whether retrieval returns the expected passages. Then score answer correctness, unsupported claims, and citation accuracy. Record when the system should ask a clarifying question or abstain. This avoids blaming the model for information it never received.
Check your understanding
An answer includes a source link. Does that prove the answer is grounded?
See the explanation
No. Open the cited passage and check that it supports the specific claim, including qualifications and dates. A citation can be irrelevant, outdated, or incorrectly attached.