Retrieval-augmented generation (RAG) is a way to make an AI model answer questions from your own data. When someone asks a question, the system first searches your documents for the most relevant passages, then gives those passages to the model with the question so it can answer from them and cite sources. RAG keeps answers current and grounded without retraining the model, and it is the usual approach for internal knowledge assistants and support bots.
- ✓RAG retrieves relevant passages first, then asks the model to answer from them
- ✓It grounds answers in your data and lets the AI cite sources
- ✓No model retraining needed; update the documents instead
- ✓Most failures come from poor retrieval, not the model
- ✓Measure retrieval quality and answer accuracy separately
What is RAG?
Large language models know a lot, but not your price list, your policies or last week’s project notes. They can also produce confident answers that are wrong. Retrieval-augmented generation solves both problems by adding a search step: before the model answers, the system retrieves the most relevant passages from your own content and includes them in the prompt. The model then answers from that material. The approach was described in a 2020 research paper by Patrick Lewis and colleagues, and it has since become the standard pattern for business AI assistants.
- Split documents into chunks
- Create embeddings
- Store in a search index
- Search for relevant chunks
- Rank and select the best
- Model reads the passages
- Writes an answer with citations
Why use RAG instead of training a model?
- Answers from current documents
- Update by changing the content
- Can cite the source of each answer
- Cheaper and faster to set up
- ✓Changes the model’s behaviour or style
- ✓Needs retraining to add new facts
- ✓Hard to trace where an answer came from
- ✓Better for tone, format or specialised tasks
For most knowledge questions, RAG is the better fit. Fine-tuning is useful for teaching a model a style or a narrow task, and the two can be combined. Large context windows help too, but sending every document with every question is slow and expensive; retrieval keeps prompts focused.
What are the parts of a RAG system?
Vector stores are covered in our guide to vector databases.
What is RAG used for?
Where does RAG go wrong?
- Poor chunking splits answers across passages or mixes unrelated topics
- Retrieval misses the right passage, so the model answers from the wrong one
- Outdated or duplicate documents give conflicting answers
- The model adds facts not in the passages; instruct it to say when the answer is not found
- Access control is ignored, so people see content they should not
Most problems are retrieval problems. Improving document quality, chunking and search usually helps more than switching models.
What does a RAG assistant look like in practice?
A 200-person company builds an HR assistant in Microsoft Teams. Its knowledge base holds the employee handbook, leave policy, benefits guide and expense rules, each split into sections by heading. When an employee asks “how many days of paternity leave do I get?”, the system retrieves the matching sections from the leave policy, and the model answers in two sentences with a link to the policy page. If the question is about something the documents do not cover, the assistant says so and suggests contacting HR. The HR team updates a policy by editing the document, and the assistant reflects the change after the next re-index.
How do you improve retrieval?
- Clean the source content: remove duplicates and outdated versions
- Chunk by meaning, such as headings and sections, not fixed lengths alone
- Combine keyword and semantic search for names, codes and numbers
- Add a reranking step to put the best passages first
- Include document titles and section names with each chunk
- Filter results by the user’s permissions
Agents can use RAG as one of their tools, which is part of how AI agent memory works.
How do you measure quality?
-
1
Build a test setCollect 50 real questions with known correct answers and source documents.
-
2
Measure retrievalCheck whether the right passage appears in the top results.
-
3
Measure answersScore correctness and whether citations support the answer.
-
4
Fix and re-testImprove content, chunking or prompts, then re-run the test set.
Not sure whether you need RAG at all? Read fine-tuning vs RAG vs prompting.
For a worked example that pairs RAG with dashboards, read pairing Power BI with an Azure OpenAI assistant and Power BI Q&A vs a custom assistant.
How UIUX Studio helps
We design and build RAG assistants, from content preparation and retrieval to the chat interface and evaluation. Talk to our Agentic AI & Automation and product engineering teams.
