RAG (Retrieval-Augmented Generation)
An AI framework that improves the quality of LLM-generated responses by grounding the model on external sources of knowledge.
How it works
A RAG pipeline has two stages. At indexing time, documents are split into chunks, encoded into embeddings, and stored in a vector database. At query time, the user's question is encoded into an embedding, and the vector database retrieves the most semantically similar chunks using cosine similarity. These retrieved chunks are then injected into the LLM's context window as additional grounding information, enabling the model to cite specific sources and answer questions it couldn't answer from its training data alone.
Why it matters
RAG addresses the two biggest limitations of LLMs: knowledge cutoffs and hallucination. By grounding responses in retrieved documents, RAG systems can access up-to-date information and cite specific sources that can be verified. This makes LLMs deployable in enterprise settings where factual accuracy is non-negotiable — legal research, medical literature review, internal knowledge bases. RAG is arguably the most impactful LLM application pattern in production today.