Retrieval-Augmented Generation (RAG)
A technique combining language models with external retrieval. Lets AI systems look up specific documents at query time rather than relying solely on training data.
Retrieval-Augmented Generation (RAG) is the dominant pattern for production AI applications that need to answer questions about specific data — company documents, codebases, recent news, or any corpus that wasn't in the language model's original training set.
In a typical RAG pipeline, source documents are split into chunks and converted to embeddings (numerical vectors capturing meaning) stored in a vector database. At query time, the user's question is embedded, the most semantically similar chunks are retrieved, and they're passed to the language model along with the original question.
RAG dramatically reduces hallucinations and keeps answers grounded in real documents. It's the foundation of customer support bots, internal knowledge tools, AI search engines like Perplexity, and virtually every commercial AI application that needs accurate, up-to-date answers.