RAG retrieves relevant documents, usually through embedding similarity search, and places them in the prompt so the model can answer from current or private data. Access control has to be enforced at retrieval time, because the model will use whatever text it is handed.
Read in this order
- ArticleEmbeddings: What they are and why they matter (Simon Willison)Start here: a plain explanation of embeddings and similarity search.
- ArticleContextual retrieval (Anthropic)A practical technique for improving what a retrieval system finds.
- PaperRetrieval-Augmented Generation for Knowledge-Intensive NLP TasksThe paper that introduced RAG, for the original design.