RAG Architecture: Getting AI to Talk About Your Own Data

Last month, the general manager of a manufacturing company put a 1,200-page quality procedures document on the meeting table and said: "Nobody reads this. New engineers ask the senior technician next to them about everything, and the senior technician is retiring." His request was clear: the AI should know this document and answer questions from it. And his first sentence was exactly what you would guess: "Train the model on our data."

We stopped right there. Because the industry's accepted answer to this request isn't training a model; it's called RAG, Retrieval-Augmented Generation. Instead of spending months training a model and freezing it, you find the documents relevant to the question at the moment it is asked and put them in front of the model; the model generates the answer from your data. Think of it as letting the student take an open-book exam instead of making them memorize everything: as the book gets updated, so do the answers.

How it works, in three steps

The mechanism sounds complicated, but its backbone is three steps. First, you split your documents into chunks, convert each chunk into a numerical vector called an embedding, and write it to a vector database; these vectors represent the meaning of the text in numbers. When a user asks a question, the question is converted into a vector the same way, and the chunks closest to it are found in the database: chunks that are "similar in meaning" get picked up even if the words differ. In the final step, the retrieved chunks and the question are sent to the model with the instruction "answer based only on these sources."

RAG: documents are split into chunks and written to a vector database, chunks close to the question are retrieved, and the model gives a sourced answer based only on those sources.
When a document changes, the system doesn't need retraining.

The result: the answer comes from your documents, you can show which document it is based on, and when a document changes the system doesn't need retraining. For enterprises that want auditability, these three points are the whole point.

Let me make it concrete: a quality engineer asks, "How often does a crane operator certificate need to be renewed?" Out of 1,200 pages, the system finds the relevant clause of the relevant procedure and hands it to the model; the model writes the answer and attaches the source underneath: such-and-such document, section 7.3. The engineer clicks once to go to the original clause and verify. The difference from asking the senior technician is that the technician isn't always at their desk, and the system can show its source every single time.

Anyone can build the demo; the details decide production

Let me be frank: building an impressive RAG demo over a weekend is no longer an achievement. The achievement is a system that still gives correct answers six months later. These are the four details that have bitten us while moving pilots into production in the field:

  • Chunking: Cutting a document every five hundred characters with a blunt knife kills context; tables get split down the middle, and clauses get separated from their headings. Overlapping chunking that respects the heading hierarchy is essential.
  • Retrieval quality: Vector similarity alone isn't enough; for exact expressions like product codes and clause numbers, classic keyword search is still king. Using the two as a hybrid and re-ranking the results raises answer quality visibly.
  • Permission leaks: A user who can't access an HR file shouldn't be able to learn its contents by asking the chatbot. Access control has to go down to the retrieval layer; this is the most frequently skipped and the most dangerous topic.
  • Update flow: The procedure changed, the vectors didn't, and now the system confidently describes outdated information. Refreshing the relevant vectors when a document is updated should be tied to an automated pipeline.

That fourth item looks innocent but is the sneakiest. Users forgive a system that gives a wrong answer; a system that confidently describes outdated information quietly erodes trust, and then nobody uses it.

Let me open up the permissions item with a case too, because we ask everyone who says "that kind of thing doesn't happen here" the same question. During a pilot at one organization, a test user asked the chatbot a question about executive bonuses, and the system produced a perfectly well-formed answer from an HR file the user should not have had access to. The access labels hadn't been carried over when the documents were imported into the vector database; the retrieval layer was finding everything for everyone. It was caught before going to production, but if it hadn't been, the "useful internal tool" would have turned into a data breach headline overnight.

Four details when moving RAG into production: chunking, retrieval quality, permission leaks and update flow.
Anyone can build the demo; the details decide production.

Don't pit it against fine-tuning; combine them

We hear the question "RAG or fine-tuning?" a lot, and it is usually framed wrong. If your knowledge changes often, if citing sources matters, and if you have to be able to answer "why did the model say that?", RAG is the right tool. Fine-tuning, on the other hand, is useful less for loading knowledge into a model and more for teaching it habits of style, format and domain language, such as a corporate correspondence tone or a specific output template. The two aren't rivals; mature systems use them side by side. But the starting point in almost every scenario is RAG, because setting it up takes days rather than weeks, and fixing it when you get it wrong is cheap.

Fine-tuning teaches style and format; RAG is the starting point for scenarios with frequently changing knowledge that require citing sources.
The two aren't rivals; mature systems use them side by side.

A special note for anyone working with Turkish content: your embedding model has to handle Turkish well. Multilingual models vary significantly in their Turkish performance, and the wrong choice cripples the promise of "find what's close in meaning" at the very first step. In our pilots, we pit several embedding models against each other using question-and-answer pairs generated from our own documents and choose based on that. A half-day comparison settles what would otherwise be months of "why are we getting irrelevant chunks?" debates.

There's no need to rush the infrastructure choice either. The vector database market is lively right now, and every vendor presents its product as the one true answer; yet for a mid-sized organization's archive, a modest start such as the pgvector extension on Postgres is often more than enough. If scale really grows, the path to specialized solutions stays open. Focusing on answer quality in the pilot instead of burying weeks in infrastructure debates is the healthiest order of priorities we have seen.

Then there is expectation management: RAG doesn't eliminate hallucination, it tames it. If the answer isn't in the chunks put in front of it, the model tends to fill the gap; you need to explicitly teach the system to say "I couldn't find this in the sources" and link answers to their sources. An answer that cites its source gives users a way to verify it, and in enterprise use that matters as much as the accuracy rate.

Anatomy of a two-week pilot

How did we proceed with that manufacturing company? We took the two most frequently asked-about sections of the procedures and built a pilot in fifteen business days. We collected twenty real questions from the quality team (not ones we made up, but ones actually asked in the field) and had experts score the system's answers. In the first round, fifteen of the twenty questions were fully correct; after tuning the chunking and re-ranking, that rose to eighteen. The remaining two were questions whose answers weren't in the document at all, and having those come back as "this information isn't in the procedures" is more valuable than a wrong answer.

The lesson we learned on the adoption side is this: instead of offering the assistant as a separate application, you need to embed it where the team already lives: in the organization's messaging tool, its intranet search, the tablet on the shop floor. Even the best assistant that has to be opened in a separate tab gets forgotten after a few weeks. We set up usage metrics from the start: who asks, how often, about which topics, and which answers get marked "not helpful." This feedback is the only way the system's second month is better than its first.

The pilot budget usually comes in below what most executives expect; the real cost arises later, when nobody takes ownership of maintaining the system and keeping the content updated. That's why our proposals always include the update flow and an ownership plan.

If you're discussing the idea of an internal knowledge assistant at your table, drop us a line; a pilot that gets up and running on your own documents in two weeks teaches you more than months of meetings.