The short answer
RAG, retrieval-augmented generation, is a way of getting an AI model to answer from your own documents instead of from memory. When someone asks a question, the system first searches your documents for the passages most likely to hold the answer, then hands those passages to the model with the question and asks it to answer from them, ideally citing which passage says what.
The name comes from a 2020 research paper, Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks by Patrick Lewis and colleagues. The idea has since become the standard way businesses build AI assistants over their own policies, contracts, manuals and files.
Why plain AI models need it
A language model on its own knows only what was in its training data. It has never seen your price list, your procedures manual or last month's policy change, and when asked about them it may produce a confident answer that is simply wrong. RAG addresses both problems at once: the model is given the relevant text at the moment of the question, so it can answer from your current documents, and its answer can point back to the passage it came from so a person can check it.
How RAG works, step by step
- Collect the documents. Policies, contracts, manuals, tickets, wiki pages: whatever the assistant should answer from.
- Split them into passages. Long documents are cut into smaller pieces, ideally along their own structure (sections, headings, table rows) rather than at an arbitrary number of words.
- Index the passages. Each passage is turned into a numerical representation of its meaning (an embedding) and stored so it can be found by meaning, often alongside an ordinary keyword index so exact terms such as product codes are not missed.
- Retrieve at question time. The question is matched against the index and the most relevant passages are pulled back, often re-ranked in a second pass for precision.
- Apply permissions. Passages the person asking is not allowed to see are removed before the model ever sees them.
- Generate the answer from the retrieved passages, with a citation for each claim, and say "I don't know" when the passages do not contain the answer.
- Keep the index current. When documents change, the affected passages are re-indexed, or the assistant answers from yesterday's version.
RAG compared with the alternatives
| RAG | Fine-tuning | A bigger prompt | |
|---|---|---|---|
| What it does | Finds the relevant passages and gives them to the model at question time | Trains the model further on your examples | Pastes whole documents into every request |
| Good for | Answering from many documents that change | Teaching a style, a format or a narrow task | A handful of short documents |
| Citations | Yes, to the passage used | No; the knowledge is blended into the model | Possible, but costly to repeat on every request |
| When documents change | Re-index the changed passages | Train again | Change the prompt |
For answering questions from a company's own documents, RAG is usually the right starting point. Fine-tuning is for changing how a model behaves, not for keeping it up to date.
What RAG is good for in a business
- Internal policies and procedures. Staff ask how to handle a refund, a leave request or a safety incident and get the answer with the policy section cited.
- Contracts and precedents. Finding the clause, the term or the earlier matter that answers a question, with the source document linked.
- Support and service. Agents answer from the manuals and past tickets instead of searching folders.
- Onboarding. New staff ask the questions they would otherwise ask a busy colleague.
- Regulated work. Where an answer must be traceable to a source, a citation on every claim makes review possible.
Where RAG goes wrong
- Retrieval misses the passage. If the search step does not find the right text, the model cannot answer from it. Most RAG failures are retrieval failures, not model failures.
- Bad splitting. A table cut in half or a clause separated from its heading loses its meaning.
- Citations that do not support the claim. A citation placed next to an answer is not proof the passage says that. It has to be checked.
- Leaked permissions. If access rules are not applied when passages are retrieved, the assistant can quote a document the person asking should never see.
- Stale documents. An index built once and never updated answers from old versions.
- No measurement. Without a fixed set of real questions with known answers, scored before launch and again over time, no one knows whether the assistant is right.
How to measure a RAG system
Build a set of real questions your staff ask, with the correct answer and the document that holds it. Run the assistant against the set before launch, and score two things separately: did it find the right passage, and did its answer match the passage it cited? Count a made-up or mismatched citation as a failure. Then re-run the same set on a schedule, because documents, models and questions all drift. Our article on why self-graded AI accuracy isn't accuracy explains why the score has to come from labelled answers, not from the model marking its own work.
Questions to ask before you buy or build one
Many products now promise "chat with your documents". The demos look alike; these questions separate them:
- Which documents, exactly? File types, scanned pages, tables, spreadsheets, wikis, email. Ask to test with your own messiest files, not the vendor's samples.
- How are documents split and searched? Splitting along headings and tables, and combining meaning-based search with keyword search, matters more than which model writes the answer.
- Does every claim carry a citation, and is the citation checked? A link next to an answer is not the same as a passage that supports it.
- How are permissions applied? The answer must only ever draw on documents the person asking is allowed to open, enforced when passages are retrieved, not filtered afterwards.
- What happens when the answer is not there? A useful system says it does not know. One that always answers will sometimes make things up.
- How is accuracy measured, and on whose questions? Ask for the score on a labelled set of your own questions, before and after launch.
- How quickly do changes show up? When a policy changes this morning, when does the assistant stop quoting the old one?
- Where do the index and the model run? Region, provider, and whether your documents are used to train anyone's model.
Start with one department and one collection of documents, measure it against real questions, and widen it only when the numbers hold.
Where the data goes
A RAG system holds copies of your documents in its index and sends passages to a model to answer each question. For a Canadian business, where the index and the model run decides where that data goes, and it matters for privacy law and for clients' contracts. The rules are in where your data goes.
How we build it
We build AI knowledge bases that answer from your own documents, with a citation on every claim, your existing permissions enforced at retrieval, and an honest "I don't know" when the answer is not in the documents. Accuracy is scored against a labelled question set, and a fabricated or mismatched citation counts as a failure. Every price is on our AI knowledge base page:
- Departmental assistant: from CAD $24,000, five to seven weeks, for one document collection and one access tier.
- Multi-source and permissioned: $52,000, nine to twelve weeks.
- Hosting and care: from $2,200 a month, in a Canadian or U.S. region, or run it in your own cloud account.
To start, book a scoping call.