RAG
A model only knows what it saw in training, so it cannot answer about your private or recent documents and may confidently guess. Retrieval-augmented generation fixes this by fetching real text first.
Your documents are split into chunks and turned into embeddings stored in a vector database. At query time the question is embedded too, and nearest-neighbour search pulls the most similar chunks. Those chunks are pasted into the prompt, so the model answers from retrieved evidence instead of memory. Turn retrieval off and it falls back to a vague guess.
query: What is the refund window?
You can request a refund within 30 days of purchase.
Check yourself
The model never saw your refund policy in training. With retrieval on, how does it state the exact 30-day window?
Go deeper (free): Hugging Face — RAG explained ↗