RAG (Retrieval-Augmented Generation)

A pattern where an LLM is given relevant retrieved context at inference time rather than relying solely on its training data.

Retrieval-Augmented Generation pairs a search/retrieval system with an LLM. At inference time, the user query is first sent to a retrieval API to fetch relevant documents or passages; those are then concatenated into the LLM's context window before generation. RAG addresses two LLM weaknesses at once: hallucinated facts (the model fabricates content) and stale knowledge (training cutoff). Most production AI products today use some form of RAG.