Retrieval-augmented generation (RAG)
Retrieval-augmented generation (RAG) is a method in which a large language model first retrieves passages from a chosen set of documents and then writes its answer from those passages, usually with references to them. It ties answers to a document set and lets the content change without retraining the model.
What it is
Retrieval-augmented generation (RAG) is a way of answering questions with a large language model in which the system first looks up relevant passages in a chosen document set and then asks the model to compose its answer from those passages. The facts come from the retrieved text, not from what the model absorbed in training. A well-built system also shows which passages it used.
The parts of a RAG system are:
- Document store: the approved material, split into passages and indexed for search.
- Retriever: the search step that matches the question to the most relevant passages, by meaning, by keywords or by both.
- Prompt assembly: the question and the retrieved passages, packed into one instruction for the model.
- Generator: the large language model that writes the answer.
- References: links from each statement in the answer back to the passage behind it.
Why it matters
A large language model on its own writes fluent text that can contain statements with no support, a failure known as hallucination. In finance, an invented clause or a misread definition can reach a client, a regulator or a decision.
RAG narrows that gap by tying the answer to documents a reader can open and check. The Irving Fisher Committee bulletin on data science in central banking, published by the BIS, describes it as a way to improve the accuracy and reliability of model output by drawing on verified sources. It does not remove errors: the retriever can miss the right passage, and the model can still misstate what it found.
A second benefit is maintenance. When a policy changes, the owner updates the document store. The model is not retrained.
Worked example
Illustrative numbers. A policy library holds 200 documents, split into 2,000 passages. An analyst asks which approval a certain type of client request needs. The retriever returns the 3 passages that match best, and the model answers from them, citing passage 2.
To test the system, the team prepares 20 questions with known answers. For 18 of them, the passage that holds the answer is among the 3 returned. The retrieval hit rate is 18 divided by 20, which is 90 percent.
The 2 failures are traced to a policy written under a different title from the one used in the question. The owner adds that wording to the document, and the test is run again.
Assumptions
- The document store is accurate, complete for the question asked and kept under change control.
- Access rights carry over: the retriever returns only passages the asker may read.
- The retriever finds the right passage. When it does not, the model answers from weaker material or from its training.
- A person checks cited passages for decisions that carry consequences.
Who uses it
- AI business analysts define the use case, choose the document sets and agree how answers are reviewed.
- AI transformation analysts in banking assess where a RAG assistant fits a process and what controls surround it.
- Data scientists build the retriever, tune passage size and measure retrieval and answer quality.
- Quantitative developers integrate the pieces into applications and manage indexing, access and logging.
Common confusions
- RAG is not fine-tuning. Fine-tuning changes the model’s weights; RAG leaves the model unchanged and supplies documents at the moment of the question.
- A cited answer is not a verified answer. The citation shows where the model looked, not that it read the passage correctly.
- RAG does not make a document set trustworthy. Outdated or contradictory documents produce outdated or contradictory answers.
- Searching an index is not RAG by itself. The generation step, which writes a fresh answer from the passages, is what the name adds.