Retrieval-augmented generation, or RAG, gives a language model relevant external material when it answers a question. The retrieval system finds evidence; the model uses that evidence as context for generating a response.
Follow a question through the pipeline
Suppose a customer asks, “Can I return shoes after 20 days?” The application searches the store’s policy documents. It might retrieve a passage allowing unworn shoes to be returned within 30 days, along with a separate rule excluding final-sale items.
The application places those passages and the question in the model’s context. A useful answer explains both the time limit and the conditions, with a reference to the policy. If the search returns only the 30-day passage, the model may give an incomplete answer even if it faithfully repeats what it received.
The card shows a common implementation: embed the query, retrieve similar document chunks from a vector store, add them to the prompt, and generate an answer. RAG can also use keyword search, a hybrid search system, or other retrievers. A vector database is an implementation choice, not the definition of RAG.
What changes, and what stays fixed?
In a typical application, updating the document index changes the evidence available at query time without changing the model’s weights. That makes RAG useful for internal documentation or information that changes frequently.
This does not mean fine-tuning and retrieval are mutually exclusive. A model can be trained to use retrieved evidence better and still rely on retrieval for current facts. Compare RAG and fine-tuning by the problem each is supposed to solve.
Where a RAG system can fail
Check retrieval and answer generation separately. Did the right passage appear in the results? Was the source current? Did the model preserve its exceptions? Does each citation actually support the attached claim? A citation-looking string is not proof of grounding.
Access control belongs in the retrieval path too. A model should not receive a confidential passage just because its wording matches the query. The permission-aware RAG card covers that boundary.
Source: Lewis et al., Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks. Next, examine chunking and retrieval embeddings.