Retrieval Augmented Generation, usually called RAG, is a pattern in which a model retrieves relevant outside material before generating an answer. Instead of relying only on what the model absorbed during training, a RAG system brings in fresh or domain-specific documents at the moment a user asks a question. This makes it especially useful for enterprise knowledge bases, product documentation, internal policies, and research collections.
How RAG Works
A typical RAG system follows a few steps. A user query is turned into an embedding, the system searches for similar documents through vector search, the top results are collected, and those results are inserted into the model's prompt as context. The model then answers using both its general training and the retrieved evidence.
This is why RAG is closely tied to concepts such as vector databases, chunking, metadata, reranking, and grounding. Good retrieval is not just about finding anything relevant. It is about finding the right passages, preserving context, and making sure the generation step uses them effectively.
Why People Use RAG
RAG is popular because it often improves freshness, traceability, and relevance without requiring a full model retrain. If a handbook changes, a RAG system can update its index instead of waiting for a new foundation model. It also helps reduce some kinds of hallucination by giving the model concrete material to work from.
Still, RAG is not a magic truth machine. If retrieval misses the right documents, if the stored content is wrong, or if the context is too long or poorly structured, the answer can still fail. Strong RAG systems need careful retrieval design, clear prompts, good permissions, and evaluation against real questions.
Related concepts: Embedding, Vector Database, Vector Search, Grounding, and Hallucination.