What is RAG and why connect a model to a knowledge base?
RAG (retrieval-augmented generation) means the model first looks up relevant passages in your own documents and only then writes the answer, using those passages as its source. Instead of relying only on what it memorised during training, it gets fresh, specific material in the prompt.
A typical setup has three steps:
- your documents are split into chunks and indexed, usually as vector embeddings;
- for each question, a retriever pulls the few chunks that match it best;
- the model answers from those chunks and can cite them.
Why connect a model to a knowledge base? Training data has a cut-off date and does not include your internal files, price lists or manuals. With RAG you update the knowledge base, not the model, and every answer can point to its source, which makes mistakes easier to catch. The method was described in 2020 by Patrick Lewis and colleagues (Facebook AI Research, UCL, NYU). RAG lowers the risk of invented answers but does not remove it: if retrieval brings the wrong passage, the answer will be wrong too.
Sources
Lewis et al.: Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks (arXiv, 2020)
Checked on 30 October 2026.