Ask a general AI assistant “How many days’ notice do our employees need to give for holidays?” and it will answer confidently. But it has never seen your staff handbook. At best it gives a general answer; at worst it invents one.
Retrieval-augmented generation, or RAG, is the most common way to fix this. It doesn’t change the AI model: it gives the model the right pages of your documents at the moment you ask. This guide explains how it works, what it is useful for in a small business, the options from simple to advanced, and what to check before you rely on it.
The problem: AI doesn’t know your documents
Language models learn from a huge amount of public text, up to a training cut-off date (see What is a large language model?). Your internal documents are not part of that: your procedures, price lists, product manuals, contracts, HR policies, meeting notes.
So when you ask about them, the model has two choices. It can say it doesn’t know, or it can produce a plausible answer from general patterns. The second is what we call a hallucination, explained in our guide AI hallucinations.
Pasting a document into the conversation works for one or two files. It doesn’t work for hundreds of documents, because there is a limit to how much text a model can read at once, and because sending everything for every question is slow and costly.
What is retrieval-augmented generation (RAG)?
RAG combines a search engine with a language model. The idea was described in a 2020 research paper by Patrick Lewis and colleagues, and is now built into many AI tools.
In plain words, it works in two steps:
- Search (retrieval). When you ask a question, the system searches your documents and picks the few passages most likely to contain the answer.
- Answer (generation). It passes your question and those passages to the language model, with an instruction such as “answer only from these passages, and say which one you used”.
The result is an answer based on your text, with references you can click and check.
An example
Menuiserie Boisvif SA, a fictional joinery company with 25 employees, puts its staff handbook, safety procedures and product sheets into a RAG tool. An apprentice asks: “What protective equipment do I need for the edge-banding machine?”
The system finds the relevant paragraph in the safety procedure and the product sheet for the machine. The AI answers in two sentences, lists the equipment and shows both documents as sources. If nothing relevant is found, a well-configured system says so instead of guessing.
Embeddings, explained simply
A classic search looks for the same words. If the handbook says “annual leave” and the employee types “holidays”, a keyword search may find nothing.
RAG systems usually add a search by meaning, using embeddings. An embedding turns a piece of text into a long list of numbers, a bit like coordinates on a map. Texts with similar meanings get coordinates close to each other; texts about different topics end up far apart. OpenAI’s documentation describes embeddings exactly this way: the distance between two of these lists measures how related the texts are.
In practice:
- Your documents are cut into short passages (often a few paragraphs each).
- Each passage gets its embedding, stored in a searchable index (often called a vector database).
- Your question gets an embedding too, and the system retrieves the passages whose coordinates are closest.
Search by meaning is not perfect with exact references such as an article number, an error code or a product reference. That is why many systems combine it with classic keyword search. Anthropic, for example, describes this combination as a way to reduce the cases where the right passage is not found.
What small businesses use it for
- Internal knowledge base. Procedures, how-tos, “who does what” and past decisions, searchable in plain language.
- Product manuals and technical sheets. Staff or technicians find the right specification without leafing through PDFs.
- HR policies. Holidays, expenses, working time and onboarding: answers taken from the current version of the handbook, with a link to the paragraph.
- Customer questions. A draft reply based on your terms and conditions, FAQs and product information, checked by a person before it is sent.
- Contracts and files. Finding clauses, deadlines or conditions across many documents, with the passage quoted.
In all these cases, the value comes from two things: finding the right passage quickly, and showing it, so a person can check.
Your options, from simple to advanced
1. Upload a file to an AI assistant
Most assistants (ChatGPT, Claude, Gemini, Microsoft Copilot and others) let you attach a document and ask questions about it. It is the quickest way to try, and fine for occasional use with non-sensitive files. It doesn’t give your team a shared, up-to-date knowledge base.
2. Projects and workspaces in assistants
Several assistants offer “projects” or similar spaces where you store a set of files and instructions once, then ask questions over time. Business plans often add connections to shared drives. This is a good middle step for a small team, provided the plan’s data terms suit you. Our guide ChatGPT at work: data protection explains what to check.
3. Dedicated tools
Some tools are built specifically for searching company documents, customer support or intranets, and connect to your file storage, wiki or helpdesk. They usually offer access rights per user, automatic updates when a document changes, and statistics on unanswered questions.
4. Self-hosted open-source
For sensitive documents, you can run the whole chain yourself: an open-source language model (for example Apertus, the open Swiss model developed by EPFL, ETH Zurich and CSCS), an open-source embedding model and a document interface, on your own server or with a Swiss host. Documents never leave the infrastructure you choose. It requires technical skills and maintenance. See Swiss hosting for AI models, How to install Ollama and Open-source tools for SMEs.
Data protection: where are your documents stored?
As soon as your documents contain personal data (names of employees or clients, salaries, health information, contact details), the Swiss Federal Act on Data Protection (FADP) applies. The Federal Data Protection and Information Commissioner (FDPIC) has stated that the FADP, in force since 1 September 2023, applies directly to AI-supported data processing.
The basics to check:
- Only what is needed. Don’t index a whole shared drive “just in case”. Leave out documents with personal data that the use case doesn’t require.
- A contract with the provider. If a cloud provider stores and processes your documents for you, it acts as a processor, and you need a data processing agreement.
- Storage location. Under Art. 16 FADP, personal data may go abroad without further safeguards only to countries the Federal Council lists as having adequate protection. Otherwise, safeguards such as standard contractual clauses are needed, and the people concerned must be informed.
- Transparency. According to the FDPIC, people must be told when they are dealing with a machine, and whether the data they enter is used to improve the system. This matters for a customer-facing assistant.
- Training use. Check whether the provider may use your documents or questions to train its models, and switch this off if possible.
- Sensitive data and professional secrecy. Health data, HR files and client files of doctors, lawyers or fiduciaries call for extra care, often in favour of Swiss or self-hosted solutions.
Also remember the search index: the passages and their embeddings are a copy of your documents, stored wherever the tool stores them. For more on the legal framework, see our guide to Swiss AI law.
Limits, and how to check quality
RAG is useful but not magic. Common problems:
- The search misses the right passage, so the AI answers from the wrong one or says it doesn’t know.
- Outdated or contradictory documents. If three versions of the expenses policy are indexed, the AI may quote the old one.
- Hard-to-read files. Scanned PDFs, tables, plans and handwritten notes are often poorly extracted.
- Access rights. If everyone can query everything, an employee may see salary data or confidential files through the AI.
- The AI can still invent or overstate, especially when the passages only partly answer the question.
A simple way to check quality before rolling it out:
- Write 20 to 30 real questions your team asks, with the correct answer and the document where it is found.
- Run them through the tool and note for each one: right answer, right source, or neither.
- Include questions with no answer in the documents. A good system says so.
- Check the cited passages, not just the answers.
- Clean up your documents. Remove old versions, give files clear titles and name one person responsible for each topic.
- Test again after any major change to the documents or the tool.
Start small: one well-defined set of documents, one team, real questions. If the answers are reliable and the sources are right, extend from there.