A librarian who searches and a writer who composes: that is RAG. Plus six things that can go wrong, from contradictory documents to access rights.
“I want an AI that knows everything we know in the company: contracts, procedures, old quotes, manuals.” It is one of the most common requests, and the technique behind it is called RAG (retrieval-augmented generation). You do not need technical knowledge to understand it, and understanding it helps you set the right expectations.
The basic idea: the librarian and the writer
Picture an office with two people. The first, the librarian, knows where the documents are: when a question comes in, they search the archive for the pages that look relevant. The second, the writer, reads those pages and writes an answer. The writer is not allowed to answer from memory, only from the pages received.
That is RAG. A language model (the writer) receives the question together with the passages found by a search system (the librarian) and words an answer based on them. The technique was described in a 2020 research paper that combined a language model with an external memory from which information is retrieved for each question.

Why not simply train the model on our documents?
Because as a rule it is unnecessary and not the best solution. Training a model on company documents is costly and hard to keep current: if a returns policy changes, the process has to be repeated. With RAG, you change the document and the answer changes. You can also show the source of each answer, so a person can verify it.
The steps, in brief
- Preparing the documents. Files (PDFs, documents, web pages) are cleaned and split into passages of reasonable size.
- Indexing. Each passage is turned into a numerical representation of its meaning (the so-called embedding) and stored in a database that can search by meaning, not only by exact words.
- Searching. When a question comes in, the system finds the passages closest in meaning.
- Answering. The model receives the question and the passages and writes the answer, ideally pointing to the sources.
- Access control. The system must take into account who is asking: an employee must not receive a passage from a document they are not allowed to see.
What can go wrong
This is the part that matters to a manager. RAG is not magic, and its problems are well known.
It does not find the right document
If the librarian brings the wrong passages, the writer confidently writes a wrong answer. Common causes: badly split documents (a rule separated from its exception), questions worded differently from the text, internal abbreviations, tables and scanned PDFs that read badly.
It finds them, but the documents contradict each other
If the archive holds three versions of the returns policy, the system does not know which one is valid. The problem is not the model but the order in the documents. Without a clear rule (date, version, an “in force” status) you will get mixed-up answers.
It answers beyond what the documents say
Even with the passages in front of it, a model may fill in from its general knowledge or interpret too freely. That is why the instructions tell it to answer only from the sources and to say “I did not find it” when it lacks support. Instructions reduce the problem; they do not eliminate it.
It misses information in long passages
Research shows that models do not use every part of a long context equally well; information in the middle of a long text is used less well than information at the start or the end. That is why the model is sent a few well-chosen passages, not dozens of pages.
It leaks information that should not get out
If you index everything and do not control access, an employee can obtain, through a clever question, the content of an HR document or a confidential contract. Access rights must be enforced at search time, not just at display time. And dubious content inside a document can try to give instructions to the model, a problem we discuss in the article on agent security.
Information goes out of date
A price changed yesterday, and today the system answers with the old one. Without a process for updating the index, a good assistant becomes an unreliable one within months.

How to show it works: a set of control questions
Before launch, prepare a list of real questions, with the correct answer known and the document it comes from. Run them regularly and note:
- whether it found the right document;
- whether the answer matches the document;
- whether it said “I do not know” when the document is missing;
- whether it respected access rights.
The same set protects you at every change: new document, new model, new configuration.
When it makes sense and when it does not
RAG suits situations with many text documents, repeated questions and an owner who maintains the sources: internal support, a procedures guide, a customer knowledge base, finding clauses across a set of contracts. It does not suit exact calculations on large tables (there you want a database query), decisions with legal effect without review, or documents you cannot clean up.
Practical conclusion
A good RAG is mostly work on the documents rather than on the model: cleaning, versions, rights, tests. Before asking for “the AI that knows everything”, pick a small domain, clean those documents and see how it answers 50 real questions.
ME Digital provides AI implementation, including assistants that answer from company documents, with cited sources and respected access rights; you can write to us through the contact page.
