AI basics7 min read
RAG for business: AI that answers from your own documents, with sources
Retrieval-augmented generation lets a language model answer from your manuals, contracts and policies instead of its general training. How it works, where it breaks and what to check.
Ryze Labs engineering team
Key takeaways
- RAG first searches your own documents for relevant passages and then asks the model to answer only from those passages, citing where each statement came from.
- The quality of a RAG system depends more on document preparation, search quality and permissions than on which language model you choose.
- You should measure a RAG system against a fixed set of real questions with known answers before launch and after every change to documents or settings.
A general-purpose AI model knows a lot about the world but nothing about your price list, your warranty terms or the procedure your warehouse follows for damaged goods. Ask it anyway and it will often produce a confident, plausible answer that is simply wrong. Retrieval-augmented generation, usually shortened to RAG, is the standard way to make a model answer from your own documents instead.
What RAG means in plain words
RAG combines two steps. First, a search system finds the passages in your documents that are most relevant to the question. Second, the language model receives the question together with those passages and is instructed to answer only from them, with a reference to the source.
Think of it as an open-book exam. The model is not expected to remember your handbook; it is handed the right pages and asked to read them carefully. If the pages do not contain the answer, a well-built system says so instead of guessing. This is the main defence against the made-up answers described in our article on why AI models hallucinate.
How a RAG system works, step by step
- Collect the sources. PDFs, Word files, wiki pages, a shared drive, product data from Shopify, tickets from a help desk. Each source keeps its owner, date and access rights.
- Prepare the text. Documents are converted to clean text, scanned pages go through OCR, and tables are kept readable. Duplicates and outdated versions are removed.
- Split into passages. Long documents are cut into sections of a few paragraphs, ideally along headings, so each passage makes sense on its own.
- Index for search. Each passage is stored with an embedding (a numerical representation of its meaning) and usually a keyword index too, because exact terms such as product codes matter.
- Retrieve. For each question, the system finds the best-matching passages, filtered by what the user is allowed to see, and often reranks them.
- Generate with citations. The model answers from the retrieved passages and links each claim to its source, so the reader can check it.
None of these steps is exotic, but each one affects the result. Most quality problems we see in RAG projects come from steps two to five, not from the model in step six.
RAG, fine-tuning or a long prompt?
People often ask whether they should “train the AI on our data”. For answering questions from documents, fine-tuning is rarely the right tool. It changes how a model writes and behaves, but it is a poor way to store facts that change, and it cannot show where an answer came from.
| Approach | Good for | Limits |
|---|---|---|
| RAG | Answers from many documents that change, with sources and access control | Needs good document preparation and search tuning |
| Fine-tuning | Consistent style, format or a narrow specialised task | Facts go stale, no citations, retraining for every update |
| Long prompt | A handful of short documents that rarely change | Gets expensive and less reliable as the material grows |
Where RAG works well
- Internal knowledge: HR policies, IT procedures, quality manuals and onboarding material that staff search through every week.
- Customer support: product documentation, return conditions and troubleshooting guides behind a support chatbot that shows its sources.
- Sales and tenders: finding the right passage in past proposals, technical data sheets and certificates.
- Contracts and legal texts: locating clauses across many agreements, with a person reviewing anything that matters.
- Operations: work instructions, safety sheets and machine manuals, searchable in the language the user asks in.
Example
Illustrative example: a policy assistant
A fictional 120-person manufacturer has its HR and IT policies spread across 60 PDFs and a wiki. Staff ask an internal assistant “How many days of notice do I need to give for unpaid leave?”. The system retrieves the relevant section of the current leave policy, answers in two sentences and links to page 4 of that document. When someone asks about a topic that no policy covers, it replies that it cannot find this in the documents and suggests contacting HR.
Many general workplace assistants can now search company files as well. That is often enough for internal questions; when you need fixed sources, record-level permissions or answers for customers, a dedicated RAG assistant is the better fit, as we explain in ChatGPT or Copilot vs a custom assistant.
Where RAG goes wrong
RAG reduces errors but does not remove them. The typical failures are predictable, which also means they can be tested for and fixed.
- Outdated or conflicting documents. If three versions of the same policy are indexed, the system may quote the wrong one. Document hygiene is covered in our guide to AI and data quality.
- Poor search. The right passage exists but is not retrieved, often because the question uses different words or the passages were split badly.
- Lost structure. Tables, scanned forms and multi-column layouts can turn into unreadable text if they are not processed carefully.
- Questions that need calculation or live data. “What is our stock of item 4471?” belongs to a database query, not to document search.
- Over-confident wording. Without clear instructions, the model may fill gaps in the retrieved text with general knowledge.
Permissions and data protection
A RAG system must respect the same access rights as your file shares. If a junior employee cannot open the salary spreadsheet, the assistant must not quote from it either. In practice this means storing access rights with each passage and filtering search results per user before the model sees them.
Where the documents contain personal data, you will also need a lawful basis for the processing and suitable terms for any transfer outside the EU. Our article on GDPR for AI projects goes through these points at a practical level.
How to tell whether it is any good
A demo with five friendly questions proves very little. Before launch, collect 50 to 200 real questions from the people who will use the system, together with the correct answer and the document it should come from. Run them through the system and check three things for each one.
- Retrieval: did the search return the passage that contains the answer?
- Faithfulness: does the answer say only what the passages support, and are the citations correct?
- Refusal: for questions the documents do not cover, does the system say so instead of inventing an answer?
Keep this question set and rerun it whenever documents, search settings or the model change. It is the closest thing to a regression test for a RAG system.
Next steps: preparing a first RAG project
- Pick one audience and one document set, for example support staff and the product manuals.
- Name an owner for the documents who decides what is current and what gets removed.
- Collect real questions from that audience and write down the expected answers and sources.
- Decide who may see what, and how the system will know who is asking.
- Agree how users report a wrong answer and who fixes the underlying document.
With those five points settled, the technical build is usually the easier part. If you want help designing or building a RAG system on your own documents, see our work on custom AI solutions or talk to us.
General information, not legal, tax or investment advice.