A language model only knows what it was trained on. RAG closes that gap by retrieving relevant passages from your own material at question time and passing them to the model as context.
How it works
- Documents are split into passages and indexed, usually as embeddings in a vector database.
- A question is embedded and used to retrieve the closest passages.
- Those passages are placed in the prompt alongside the question.
- The model answers from the supplied context, and can cite which passage it used.
Where it goes wrong
Almost always in the corpus, not the model. Point RAG at every shared drive a company has ever had and it will faithfully retrieve the superseded policy next to the current one. Curation and recency filtering matter more than the choice of vector store.