RAG: finding the source before writing the answer
How retrieval supplies source material to a language model, when it helps and what to test when answers go wrong.
For a short document, putting the text directly into a model’s context may be enough. For a changing collection of manuals, policies or product sheets, it can be more useful to search first and send selected passages to the model. That pattern is retrieval-augmented generation.
What retrieval-augmented generation does
RAG combines a retrieval step with an answer-generation step. The search system looks for relevant material; the language model receives that material alongside the question and instructions. Retrieval may use keywords, embeddings or a combination.
This does not train the document collection into the model. The source index can be updated independently, and answers can link back to the passages supplied.
Where it helps
A reusable index is useful when many questions refer to a larger collection. Supplying fewer passages can reduce input size, but latency and cost depend on the retrieval pipeline, caching and model. RAG is not automatically faster or cheaper for every task.
Where it fails
- The right document is missing, outdated or unreadable.
- Search retrieves a related passage but misses the one containing the answer.
- A chunk loses context such as a table heading, unit or exception.
- The model adds a claim that the retrieved source does not support.
Test whether retrieval finds the right passage before judging the final answer. Include questions with no answer in the collection and make uncertainty an acceptable result.
In my technical-document work, comparing Icelandic queries against English sources and checking citations mattered more than adding another model to the pipeline. The server walkthrough describes that setup.