What is RAG (retrieval-augmented generation)?
RAG, or retrieval-augmented generation, is a method where an AI system first searches your own documents for relevant passages, then answers using those passages.
Retrieval-augmented generation, usually shortened to RAG, is how most business AI assistants answer questions from your own information. When a question comes in, the system first retrieves the most relevant passages from your documents, then gives those passages to the language model and asks it to answer from them.
Why it matters
A general AI model knows nothing about your refund policy, your price list or the fix for your product’s most common error. Without RAG it will guess, and guesses sound confident. With RAG, a support agent can draft replies grounded in your own help articles, and an internal assistant can answer staff questions from your handbook, with links to the source.
How it works
- Prepare documents: collect help articles, policies and guides, and split them into short passages.
- Index them: each passage is converted into a numeric representation (an embedding) and stored in a vector database or search index.
- Retrieve: a question is matched to the most relevant passages, filtered by what the user is allowed to see.
- Generate: the model answers using only those passages and cites them.
- Check: answers are tested against a set of real questions, and low-confidence answers go to a person.
| Choice | Simpler option | When to go further |
|---|---|---|
| Search | Keyword or vector search | Mix both when exact terms matter |
| Permissions | One shared knowledge base | Per-user filtering for private data |
| Review | Every answer approved | Auto-answer proven topics |
Typical cost and time
A focused RAG setup over a few hundred documents usually takes one to four weeks, mostly spent on cleaning content and testing. At Relaywork, AI integration work starts at $500, and RAG-backed AI support agents start at $400. Embedding and model costs depend on volume.
Common mistakes
- Indexing outdated or conflicting documents. The answers will be outdated or conflicting too.
- Ignoring permissions. A user should never get an answer drawn from data they cannot access.
- Trusting retrieved text. Documents can carry prompt injection, so treat them as data.
- No test set. Without real questions to check against, you cannot tell if a change made it better or worse.
For how retrieval fits with logging and data controls, read how to keep AI automations safe.
Quick answers
Is RAG the same as training a model on our data?
No. RAG leaves the model unchanged and looks up your documents at the moment of each question. Updating an answer means updating the document.
Does RAG stop AI from making things up?
It reduces it by giving the model the right source text, but does not remove it. Showing sources and testing on real questions is still needed.
What documents work well with RAG?
Help articles, policies, product docs, past support replies and internal guides that are current, clearly written and not contradicting each other.