RAG (retrieval-augmented generation)
Where it sits in the kitchen
Before cooking, someone fetches the few cookbook pages that matter for this order and lays them on the counter, and the chef answers from them.
Definition
Retrieving relevant passages from a knowledge base and adding them to the prompt before the model answers. It gives the model current or private facts without retraining, and lets answers point to their sources.
Detailed technical description
A typical pipeline splits documents into chunks, stores their embeddings in a vector database, embeds the question at request time, fetches the nearest chunks, optionally reranks them, and puts the best few into the context.
Quality depends mostly on retrieval: chunk size, hybrid search, reranking and good metadata. When the wrong passage is retrieved, a fluent answer can still be wrong, so evaluate retrieval separately from generation.