Retrieval-augmented generation RAG

A pattern where relevant documents are fetched first and pasted into the prompt, so the model answers from your data rather than its training.

RAG splits the problem in two. A retrieval step finds passages relevant to the question, usually by comparing embeddings in a vector-database. A generation step hands those passages to the model along with the question and asks it to answer from them.

The appeal is that it needs no training. Your documents can change hourly, the model stays the same, and answers can cite the passage they came from, which makes them checkable.

Most RAG systems fail at retrieval, not generation. If the right passage is not fetched, no prompt saves the answer. Chunk size, how documents are split, and whether keyword search runs alongside vector search matter more than which model writes the final text.

Where this comes up

Prompts, configs and tutorials in the library that touch this term.