What RAG is and why it is needed
RAG stands for retrieval-augmented generation. The idea is simple: when someone asks a question, the system first finds the fragments of your documents that cover that topic, then asks the model to answer using only those fragments and to cite where each part came from.
It is needed because a model only knows what it learned during training, and that does not include your internal procedures, the terms you signed with a supplier in March or the spec sheet of the product you launched last month. Asking without giving it your documents is asking it to guess, and it guesses very confidently.
The alternative many people imagine, training your own model on company documents, almost never pays off: it is expensive, it has to be redone whenever a document changes and it does not solve citing the source. For knowledge that changes, retrieving at query time beats memorising.
The hard part is retrieval, not the model
If the system hands the model the wrong fragments, the answer will be poor no matter how good the model is. That is why nearly all the work is in the searching: how documents are split, how they are indexed and how it is decided which chunks go into each answer.
Splitting a document well is less obvious than it sounds. Cutting every thousand words separates a table from its heading and a clause from its exception. What works is splitting along the real structure of the document (chapters, sections, articles) and carrying the necessary context into each chunk, so it stands on its own.
And two kinds of search have to be combined. Semantic search finds related text even without shared words, but it fails on exact references: a product code, an article number, a proper name. Good old keyword search is exactly right there. Systems that work use both and rank afterwards.
Permissions: who can see what
An internal search engine that shows everyone the payroll, the contracts or board material is not an improvement, it is an incident. Permissions cannot be added at the end: they have to travel with each fragment from the moment it is indexed.
The practical rule is that the system filters before searching, not after answering. If content is retrieved first and then hidden from users who should not see it, one failure is enough to leak information; if the index only returns what that person may read, the problem never arises.
This forces clarity that many companies lack: who can see each folder. It is common for the RAG project to be the first time anyone asks that seriously, and for much of the early work to be sorting it out.
Making it cite or stay quiet
The rule that separates a trustworthy system from a dangerous one is simple: every answer cites the document it came from and links to it, and when it finds no grounding, it says it does not know. That is less impressive than a system that always answers, and it is the only way the team still trusts it in week two.
Citing also has a practical effect: it turns the user into a reviewer. If the answer links to the section of the manual, whoever asked can check it in two seconds, and mistakes get caught instead of spreading.
It is also worth deciding what the system does when documents contradict each other, which happens more than people expect: two versions of the same procedure, an old policy nobody withdrew. The right behaviour is to show both and flag the dates, not to choose silently.
Keeping it alive
A system like this decays on its own. Documents change, new ones appear, policies are withdrawn, and if the index does not keep up, within months it answers with things that are no longer true, which is worse than not answering.
So it needs an automatic way to detect changes and reindex, and a clear signal of which version is current. In regulatory or technical documentation it also helps to carry the date into the answer, so the reader knows which moment it refers to.
And it needs someone watching the questions people ask. They are the best list of what is missing: if the system cannot answer the same thing twenty times, the problem is not the search engine, it is that the document does not exist or is not where it should be.
- Automatic reindexing when a document changes, not once a year
- An identifiable current version, with the date visible in answers
- Regular review of unanswered questions
- A bank of real questions to check it still gets things right after every change
Frequently asked questions
Are my documents used to train the model?
They need not be, and it is worth making sure. The business terms of the main providers state that they do not train models on content sent through the API; consumer free tiers do not always say the same. It is one of the things to confirm in writing before connecting anything, and it should be stated in the project.
Can I keep everything inside my company?
Yes, with open models hosted on your own infrastructure. It works, and for very sensitive information it is sometimes the only sensible option, but you have to count the hardware and maintenance cost and accept that open models tend to lag a step behind. It is a risk and budget decision, not a technical one.
How many documents make it worthwhile?
It is not about volume but about how much they are searched. Fifty documents ten people consult daily justify the project; five thousand nobody opens do not. The right question is how much time goes into finding things today.
Does it work with scanned documents?
Yes, but there is a step before: turning the image into text, and the quality of that conversion sets the ceiling for everything else. With poor scans, complex tables or stamps over the text, test on a real sample before taking the project for granted.
