How does a RAG system find the right paragraph?
AWS walks through the stages in this order [1].
- Prepare the data Your documents are the external data, meaning information outside the model's original training set. It can come from APIs, databases or document repositories [1].
- Store it as numbers An embedding model converts the text into numerical representations and keeps them in a vector database [1].
- Retrieve what is relevant The customer's question is converted to a vector and matched against the vector database [1].
- Add it to the prompt The system adds the retrieved text to the user's question, using prompt engineering techniques to talk to the model clearly [1]. The model then writes the answer from that text.
The match uses vector representations [1] and not only exact words, so "how long to get my money back" can find a paragraph titled "Refund policy".
Why use RAG instead of retraining a model on my business?
AWS calls RAG a cost-effective way to introduce new data to a model, because the model does not need to be retrained [1]. When your prices change, you update the document. You do not train anything again.
The original paper starts from the same gap. Pre-trained models store facts in their parameters, but their ability to access and precisely manipulate knowledge is limited, so on knowledge-heavy tasks they lag behind purpose-built systems [2]. The authors combined the model's built-in memory with a non-parametric memory that can be searched [2].
RAG also gives you something to check. When an answer comes from a named document, a person can open that document and confirm it. That helps against hallucination. Anthropic's guidance on reducing false answers also recommends grounding a response in direct quotes and checking claims with citations [3].
What would RAG look like for a Singapore tuition centre?
A worked example
Say a tuition centre in Bishan has a 6-page fee schedule, a 2-page refund policy and a term calendar, all as PDFs. A parent asks the website chat, "Can I switch from Saturday to Sunday classes mid-term?" The system finds the two paragraphs about class changes, adds them to the question, and the model replies from those paragraphs and names the document. If nothing relevant is found, a well-set system hands the parent to a person instead of guessing.
| Question | Without RAG | With RAG |
|---|---|---|
| Does the model know your fees? | No, it only has training data | Yes, if the fee document is in the knowledge base [1] |
| What happens when fees change? | Wrong answers until retrained | Edit the document; no retraining [1] |
| Can you show where an answer came from? | Not reliably | Yes, the retrieved passage is known |
Quality depends on the documents. Old, contradictory or badly written files produce old, contradictory answers. The AI chatbot guide covers setting one up, and the AI workshop walks through building a small one.
Questions people ask
What does RAG stand for in AI?
RAG stands for retrieval-augmented generation. The model retrieves information from a knowledge base outside its training data, then generates its response using it [1]. A 2020 paper by Lewis and colleagues described RAG models [2].
Is RAG the same as fine-tuning?
No. RAG fetches your documents at question time and adds them to the prompt, with no retraining [1]. Fine-tuning changes the model itself by training it on extra examples. See the Fine-tuning entry.
Does RAG stop an AI from making things up?
It can help, because grounding answers in quotes from your documents reduces hallucinations [3]. It does not remove the problem: the model can still misread a passage, or the search can return the wrong one. AWS describes RAG as keeping output relevant, accurate and useful, not as a guarantee [1].
Pages that link here
AI agent, Chatbot, Embedding, Fine-tuning, Generative AI, Hallucination, Large language model, OCR, Prompt engineering, Token, Vector database
See also
- Large language model A large language model (LLM) is an AI system trained on huge amounts of text to predict the next piece of text, which lets it write, summarise and answer questions.
- Hallucination A hallucination is when an AI model states something false as if it were true, such as an invented fact, quote or source.
- Vector database A vector database stores numerical representations of text, images or audio, called embeddings, and finds the ones closest in meaning to a query.
- Embedding An embedding is a list of numbers that represents a piece of text, or an image, so software can measure how close in meaning two things are.
- Prompt engineering Prompt engineering is the practice of writing clear instructions and examples for an AI model so it reliably produces the output you need.
- Fine-tuning Fine-tuning is training an existing AI model further on your own example inputs and outputs, so it handles your task more consistently than the base model.
References
- What is RAG (Retrieval-Augmented Generation)?, Amazon Web Services. Read 27/11/2026.
Retrieval-Augmented Generation (RAG) is the process of optimizing the output of a large language model, so it references an authoritative knowledge base outside of its training data sources
- Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks (Lewis et al., 2020), arXiv. Read 27/11/2026.
We explore a general-purpose fine-tuning recipe for retrieval-augmented generation (RAG) -- models which combine pre-trained parametric and non-parametric memory for language generation.
- Reduce hallucinations, Anthropic. Read 27/11/2026.
Minimize hallucinations in Claude’s outputs by allowing uncertainty, grounding responses in direct quotes, and verifying claims with citations.