Skip to main content
日本語

Running RAG in Production

Tomohiro Iida · Published June 30, 2026 · Updated June 30, 2026

An internal knowledge search assistant connects your regulations, manuals, past projects, and FAQs to an LLM so it answers questions with cited sources. A demo can be running in an evening; reaching quality good enough for daily use is a different problem. This article is for engineering teams building or evaluating a retrieval-augmented generation (RAG) system over internal documents, and focuses less on concepts or how to run a proof of concept, and more on the parts that matter for going into production: retrieval quality, citations, evaluation, and security.

Key takeaways

  • For use cases like internal knowledge search — large volumes of documents, frequent updates, and a need for citations — RAG is the default choice. Fine-tuning is useful alongside it when you also want to fix the tone or output format.
  • RAG is a pipeline where quality compounds across stages. When an answer looks wrong, check the retrieval stage before the generation prompt — that's usually where the problem is.
  • Citations, staying within the retrieved evidence, allowing "I don't know," ongoing evaluation, and filtering by access permission at retrieval time rather than after generation are what separate a working prototype from a production system.

What RAG solves, and when to use something else

An LLM carries knowledge learned during training, but on its own it has no access to your company's regulations, past projects, or their latest versions. There are three main ways to connect internal documents to an LLM, and they behave differently.

For a use case like internal knowledge — high volume, frequent updates, a need for citations — RAG is the practical default. Using fine-tuning alongside RAG makes sense specifically when you also want to lock down tone or output format.

The pipeline, end to end

RAG splits into two phases: an upfront "index building" phase, and a "retrieval and generation" phase that runs on every question.

Index building (upfront, batch processing):

Retrieval and generation (on every question, in real time):

Quality compounds across every stage, so a weak link anywhere breaks the whole chain. If the retrieval stage fails to surface the right chunk, the LLM might still happen to answer correctly from its own training knowledge, but that is not a cited, evidence-based answer. When an answer looks wrong, check retrieval before touching the generation prompt — it narrows the problem down faster.

Getting chunking right

Documents are not embedded whole; they are split into units sized for retrieval, and this split has a large effect on retrieval quality.

Fixed-length mechanical splitting is good enough for some cases, but for structured documents like internal regulations, splitting along the document's own structure works better.

Improving retrieval quality

Vector search alone (searching by semantic closeness) misses things. A practical setup combines:

You don't need everything from day one. A practical order is to start with a vector-plus-keyword hybrid as the baseline, then add reranking once evaluation shows a gap.

Generation: citations, hallucination, and "I don't know"

Retrieved chunks get appended to the prompt for the LLM to answer from, and this is where production quality diverges from a prototype.

How well a model follows instructions varies by model and configuration. Even with a model known for strong instruction-following, such as Anthropic's Claude, it is safer not to rely on the prompt alone for this constraint — combine it with retrieval-side controls such as thresholds and filters.

Example system prompt: "You are an internal knowledge search assistant. Answer only from the reference documents below. If the reference documents do not cover the question, say no matching document was found. Do not fill gaps by guessing. Always list the document name and section number you relied on at the end of your answer."

We can help with building a RAG system over internal documents, chunking and retrieval quality, and evaluation and security design, including rescuing a project that has stalled at the proof-of-concept stage.

Talk to us about AI implementation

Running evals

Shipping something because "it seems to work" means accuracy can silently degrade with every model update, document addition, or index change. RAG is a system that assumes ongoing evaluation.

An evaluation set can start small. Even a few dozen commonly asked questions from the field is enough to talk about improvement in numbers rather than impressions.

Common failure patterns

Security and access control

Internal knowledge is a concentration of confidential information, and it deserves the same design weight as any technology decision.

When not to use RAG

RAG is not a universal answer. Consider other approaches when:

RAG's strength is pulling the relevant passage, with evidence, out of a large body of internal documents. Confirming early on whether your problem actually fits that shape is the fastest route to something that works in production.

Frequently asked questions

Should I choose RAG or fine-tuning?
RAG, if you want to add or update knowledge; fine-tuning, if you want to lock down the tone or format of the output. Internal knowledge search falls into the first case. The two aren't mutually exclusive — using fine-tuning for tone and RAG for knowledge together also works well.
What should I use for a vector database?
There are several options: a dedicated vector database, a vector extension on an existing database, or the vector features of a search engine. Choose based on document volume, existing infrastructure, and operational capacity. For smaller scale, starting by extending existing infrastructure and considering a dedicated product once scale grows is a reasonable path. Rather than committing to a specific product upfront, decide based on evaluation.
An answer is wrong — where should I look first?
Check the retrieval stage first. Confirm whether the correct chunk appears near the top of the search results; if not, revisit chunking design, hybrid search, and reranking. If the correct chunk is near the top but the answer is still wrong, adjust the generation-stage prompt and constraints.
Can hallucination be eliminated completely?
Not to zero. Showing citations, constraining answers to the retrieved evidence, allowing "I don't know," and ongoing evaluation together lower the rate and make it easier for users to notice when it does happen — that is the realistic goal.
How do I apply access permissions?
Give each chunk access-scope metadata and filter at retrieval time based on the user's permissions. Controlling what's displayed after generation is too late in principle, since information could already have reached the LLM by then — filtering before retrieval is the rule.

We can help with building a RAG system over internal documents, improving retrieval quality, and designing evaluation and security, even before requirements are fully defined.

Request a free consultation