Give the model a library card
The five problems RAG solves
RAG addresses context window limits, knowledge gaps, hallucinations, freshness (documents can be updated without retraining), and lack of sources (you can trace answers back to specific documents).
How RAG works at a high level
You take your documents, embed them into numerical representations, store those in a vector database, and when a user asks a question, you embed their query, find the most relevant documents by distance, and inject those documents into the prompt alongside the question.
Developer control without retraining
RAG sits on top of the model — you never modify its weights. You control what documents it can see, what prompt template it uses, and what instructions it follows. If a new report comes in, you add it to the database and the system is immediately up to date.
The medical example
A user asks about drug side effects. RAG retrieves the latest safety documents from a medical database, injects them into the prompt with instructions to cite specific pages, and the model produces a sourced, current answer instead of a potentially hallucinated one.
You are building a legal Q&A tool for a law firm. A lawyer reports that the system confidently cited a case that does not exist. What would you check first, and what would RAG change?