Almost every enterprise RAG project we are asked to rescue began the same way. Someone uploaded the employee handbook and a product manual to an assistant, asked it ten questions, and got ten good answers. A budget was approved that afternoon. Three months later the same system is connected to the real document estate, and a regional manager asks how many days of parental leave apply in her country. The assistant answers confidently, cites a policy, and is wrong, because the policy it found was superseded two years ago and the current one lives in a scanned file that was never read properly.
Nobody did anything foolish. The demo worked because it had ten clean documents, one version of each, no access rules, and questions written by the person who chose the documents. Production has forty thousand files in six formats, four generations of every policy, tables that matter more than the prose around them, people who phrase things in ways no author anticipated, and strict rules about who may see what. The model is the same in both cases. Everything that changed is in the plumbing around it.
This article is about that plumbing. It walks through how we build enterprise RAG systems that people still trust after the first month: how documents get in, how the right passage gets found, how access rules are enforced, how answers are tied to sources, and how you know whether any of it is working. It also covers what these systems cost and how long they take, and the cases where retrieval is the wrong tool and a long context window or a fine tuned model would serve you better.
What enterprise RAG actually is
Retrieval augmented generation is a simple idea. A language model knows a great deal about the world in general and nothing about your business in particular. So before it answers a question, the system searches your own content for relevant passages and hands them to the model along with the question. The model then writes an answer based on what it was given rather than what it happens to remember. Done well, this gives you answers that are current, specific to your organisation, and traceable to a source.
The important consequence is easy to miss. In a retrieval system, the model can only be as good as the passages it receives. If the right paragraph is not among them, no amount of model intelligence will produce the right answer. Usually it will produce a plausible wrong one instead. When we review a struggling system, the model is almost never the weak point. In the large majority of cases the correct information existed in the documents and simply was not retrieved, or was retrieved alongside an outdated version that contradicted it.
“Teams spend their time choosing a model and their budget on a vector database. The quality of the system is decided somewhere less interesting: in how a scanned table from 2019 was turned into text.”
Why chat with your documents disappoints
The basic recipe that every tutorial teaches is this: split each document into pieces of a fixed length, convert each piece into a numerical representation of its meaning, store those in a vector database, and at question time fetch the pieces whose meaning is closest to the question. It takes an afternoon to build and it works well enough on small clean collections to be dangerous. On real content it fails in a handful of predictable ways.
- It cuts documents in the wrong places. A fixed length split will separate a table from its heading, a clause from the exception that follows it, and a step from the warning that applies to it. Each fragment is then retrieved without the context that gave it meaning.
- It cannot find exact things. Meaning based search is excellent at finding passages about a topic and poor at finding a specific part number, error code, contract reference, or person's name, which are exactly what business users ask for.
- It has no sense of time or authority. A draft from three years ago and the signed current version look equally relevant. So do an official policy and someone's meeting notes about it.
- It ignores who is asking. Every user searches the same pool, so either sensitive documents are left out entirely or they leak into answers for people who should never see them.
- It always answers. When nothing relevant is found, the system still passes the least bad matches to the model, which obligingly writes something from them.
None of these is fixed by a better model or a longer prompt. Each is fixed by engineering in a specific stage of the pipeline, and the rest of this article goes through those stages in order.
Ingestion: where most of the quality is won or lost
Ingestion is the process of turning your documents into clean, structured text with useful labels attached. It is the least glamorous part of the system and it deserves the largest share of the early effort, because every later stage inherits its mistakes. A retrieval engine cannot find a paragraph that was garbled when it was extracted.
Extraction that respects structure
Business documents are not plain prose. They contain tables, multi column layouts, headers and footers repeated on every page, footnotes, scanned signatures, and diagrams with captions. Naive text extraction flattens all of that into a stream where a table becomes a meaningless run of numbers and a page footer interrupts a sentence. Good ingestion keeps the structure: headings remain headings, tables remain tables with their column names, lists remain lists. Scanned documents go through character recognition with a quality check, and files that fail the check are flagged rather than silently ingested as noise.
Chunking by meaning, not by length
A chunk should be a unit that makes sense on its own: a section, a clause with its exceptions, a procedure with its warnings, a table with its title. We split along the document's own structure first and only fall back to length limits inside very long sections. Each chunk carries a short description of where it sits, such as the document title and the chain of headings above it, so that a paragraph about notice periods is still recognisably about the UK contractor agreement when it is read in isolation. That single addition routinely improves retrieval more than changing the embedding model does.
Metadata is not optional
Every chunk should know what it came from: document type, owner, effective date, version, status, region, product, and who is allowed to read it. This is what later allows the system to prefer the current policy over the old one, restrict a search to one country, or exclude drafts. If your documents do not carry this information reliably, establishing it is part of the project. It is tedious, it usually involves the people who own the content, and it is the difference between a search engine and a pile.
Retrieval: hybrid search and reranking
Once the content is clean, the retrieval stage has one job: for a given question, put the few most useful passages in front of the model. The basic recipe uses meaning based search alone. Production systems almost always combine several techniques, because each covers the others' blind spots.
- 01Rewrite the question. Users type fragments, use internal jargon, and refer back to earlier messages. A small model call that turns the input into a complete standalone query, and expands known abbreviations, pays for itself immediately.
- 02Search two ways at once. Meaning based search finds passages that discuss the topic in different words. Keyword search finds exact terms, codes, and names. Running both and merging the results, usually called hybrid search, is the single most reliable upgrade over the basic recipe.
- 03Filter with metadata. Apply the user's permissions, and any constraints implied by the question such as region, product, or date, before ranking rather than after.
- 04Rerank. Take the top few dozen candidates and pass them through a reranking model that reads each passage alongside the question and scores how well it actually answers it. This step is slower per item, which is why it runs on a shortlist, and it is very good at pushing the right passage from position fifteen to position two.
- 05Decide whether there is enough. If the best candidates score poorly, say so. An honest reply that nothing relevant was found is far more valuable than a fluent guess.
Teams with strong in house data science sometimes go further and train their own embedding or reranking models on company vocabulary, which is squarely machine learning development work. It can help in highly specialised domains. For most organisations, hybrid search plus an off the shelf reranker plus good chunking gets the large majority of the available benefit, and we would do all three before considering anything custom.
Permissions aware retrieval
The fastest way to end an enterprise RAG project is for the assistant to quote a document its reader was not entitled to see. A summary of the redundancy plan, a colleague's salary band, another customer's contract terms: one such incident and the system is switched off, usually permanently. Access control therefore cannot be an afterthought, and it cannot be handled by asking the model to be discreet.
The only sound design is that restricted content never reaches the model in the first place. Each chunk carries the access rules of its source document, taken from the system where the document lives. Each query carries the identity and group memberships of the person asking. The retrieval step filters on those before anything is ranked or passed on. If a user could not open the file in the document system, the assistant behaves as though the file does not exist.
Two details cause most of the trouble in practice. First, permissions change. People move teams, folders are reshared, projects close. The index has to follow those changes promptly, which means syncing access lists on a schedule measured in minutes or hours, not rebuilding monthly. Second, the source permissions are often wrong already. Years of generous sharing mean that documents are technically open to far more people than anyone intended, and until now nobody noticed because nobody could search them effectively. A good assistant makes existing oversharing visible very quickly. We recommend an access review of the most sensitive repositories before launch, not after the first awkward discovery.
Citations and the discipline of grounded answers
An answer without a source asks the reader to trust the system. An answer with a source lets the reader check it. In a business setting that difference decides whether people act on what the assistant tells them. We treat citations as a core feature: each claim in an answer points to the passage it came from, and the reader can open that passage in the original document with one click.
Citations also discipline the model. The instruction is to answer only from the supplied passages, to attribute each statement, and to say plainly when the passages do not contain the answer. We then verify this in code where possible, checking that every cited reference corresponds to a passage that was actually retrieved, and that quoted figures appear in the cited text. Answers that fail the check are regenerated or replaced with a statement that the system could not find a reliable answer. Users forgive an assistant that says it does not know. They do not forgive one that invents a clause.
Conflicts deserve explicit handling. When two retrieved passages disagree, for instance an old policy and a new one, the system should prefer the more recent or more authoritative source according to its metadata, and where the conflict is genuine it should tell the user that the documents disagree and show both. Surfacing a contradiction in your own documentation is a service. Silently picking one side is how wrong answers acquire a citation.
Evaluation: knowing whether it works
Most teams assess a knowledge assistant by asking it a few questions and forming an impression. That approach cannot tell you whether last week's change made things better, and it systematically overrates the system because people test with questions they already know it handles. A proper evaluation set is the most valuable asset in the project, and it is not difficult to build.
Collect one hundred and fifty to three hundred real questions from the people who will use the system, including the awkward and badly phrased ones. For each, have someone who knows the subject record the correct answer and the document it comes from. Include questions that have no answer in the corpus, so you can measure whether the system admits it. Then score the pipeline in two parts. Retrieval is scored on whether the right passage appears in the top results. Generation is scored on whether the answer is correct, whether it is supported by the cited passages, and whether it declines when it should.
Measuring the two parts separately is what makes improvement efficient. If the right passage is not being retrieved, no prompt change will help and the work belongs in ingestion or search. If it is retrieved and the answer is still wrong, the work belongs in the instructions or the model. Run the set automatically on every change. After launch, add the questions that users marked as unhelpful, and review a sample of live answers each week. A system that is measured this way improves steadily. One that is judged by impression drifts, and nobody notices until trust is gone.
Freshness: keeping the index honest
A knowledge system is only as current as its last sync. Policies are revised, prices change, a product is withdrawn, and if the index still holds yesterday's version the assistant will repeat it with total confidence. Freshness is an operational commitment, not a feature you build once.
Each source needs a defined update path: ideally a notification when a document changes, otherwise a frequent scan for modifications. Updated documents are reprocessed and their old chunks removed. Deleted documents are purged, which matters for legal reasons as well as accuracy. Superseded versions are either removed or clearly marked so that retrieval can deprioritise them. And the whole thing is monitored: how old is the newest indexed change from each source, how many documents failed processing, how long does an update take to become searchable. When a source quietly stops syncing, you want an alert, not a complaint from a user who was told the old returns policy.
When enterprise RAG is the wrong tool
Retrieval is not the answer to every knowledge problem, and part of an honest scoping conversation is saying so. There are three alternatives worth understanding, and the right design often mixes them.
Long context: just give the model everything
Current models accept very large inputs. If the relevant material is a single contract, one product manual, or a few dozen pages, placing the whole thing in the prompt is simpler and frequently more accurate than retrieving fragments of it, because nothing is lost in chunking. This approach suits tasks centred on one document or a small fixed set. It stops working when the corpus is large, when cost per question matters at volume, or when different users are allowed to see different content.
Fine tuning: changing how the model behaves
The comparison of RAG versus fine tuning is often framed as a choice, but they solve different problems. Fine tuning teaches a model a style, a format, a specialised vocabulary, or a classification task. It is poor at teaching facts that change, because every update means retraining, and it cannot cite where a fact came from. Use it when you need consistent behaviour, such as always producing a report in your house structure. Use retrieval when you need current, attributable knowledge. A fine tuned model that also retrieves is a perfectly sensible combination.
Structured queries: when the answer is in a database
A question such as how many orders shipped late last month is not a document question at all. The answer lives in a database, and the right approach is to have the model call a well defined query tool rather than search text. Many disappointing assistants are document search systems being asked numerical questions. Routing each question to the appropriate method, documents, data, or a person, is a design decision that belongs at the start, and it is a large part of what we mean by AI software development rather than assembling a demo.
What an enterprise RAG system costs and how long it takes
Buyers reasonably want numbers, and the honest answer is a range driven by a few factors. The main ones are how many source systems must be connected, how messy the documents are, how complex the access rules are, and whether the assistant is internal or customer facing. A focused internal system over two or three well organised sources is typically eight to fourteen weeks of work for a small team. A broad deployment across many repositories with intricate permissions and scanned legacy content can take two or three times that, and most of the difference is ingestion and access control rather than anything to do with models.
Running costs have three parts: indexing, which is paid when documents are processed and again when they change; storage and search infrastructure; and model usage per question. For internal tools with hundreds or a few thousand users, the per question cost is usually modest and the infrastructure is the steadier line. For high volume customer facing use, model cost dominates, and techniques such as caching common answers, using smaller models for query rewriting, and passing fewer, better passages make a material difference. Ask any prospective supplier for a cost per thousand questions at your expected volume, not just a build price.
On choosing a partner for RAG development services, a few questions are revealing. Ask how they will evaluate the system and who builds the question set. Ask how permissions are enforced and what happens when a user's access changes. Ask to see how a scanned table from your own documents comes out of their ingestion. Ask what the system does when it cannot find an answer. A team that has run retrieval in production will have specific, slightly weary answers to all four. A team that talks mainly about which model they prefer has probably only built the demo.
Have a pilot that impressed in the demo and disappointed in use?
Send us twenty questions it gets wrong. We will tell you whether the fault is in ingestion, retrieval, permissions, or generation, what it would take to fix, and whether retrieval is even the right approach for what you are trying to do.
Talk to our AI teamWhat good looks like
A knowledge system that has earned its place is quietly unremarkable. The regional manager asks about parental leave and receives the current policy for her country, with a link to the clause. A new engineer asks how to request production access and gets the procedure, not three conflicting wiki pages. Someone asks about a project they are not part of and is told nothing was found. Occasionally the assistant says that two documents disagree and shows both, and the policy owner fixes one of them that week. Usage grows because people have learned that when it answers, it is right, and when it is unsure, it says so.
Behind that calm is a pipeline in which every stage is owned and measured: ingestion that respects structure, retrieval that combines methods, access rules enforced before the model sees anything, answers tied to sources, an evaluation set that runs on every change, and an index that is watched for staleness. None of those pieces is exotic, and none is optional. The projects that fail are almost always the ones that treated the afternoon demo as the system and the rest as detail.
Once answers are dependable, the natural next step is to let the system do something with them: raise the ticket, update the record, start the request. That moves you from a knowledge assistant into AI integration and automation, where retrieval quality stops being a matter of convenience and becomes a matter of correctness. It is a good place to arrive, and a poor place to start.
We build AI systems and custom software for businesses that want results, not decks. Questions about this article? Get in touch.

