BLOG ·

7 MIN READ

Enterprise RAG: How to Build Retrieval-Augmented Generation That Works in Production

A research-led guide for enterprise teams evaluating production AI systems.

Drew Brooker

ML Engineer

  • RAG DEVELOPMENT
  • RETRIEVAL AUGMENTED GENERATION
  • ENTERPRISE RAG ARCHITECTURE
  • RAG EVALUATION

Enterprise RAG connects a language model to company information at runtime.

The basic concept is simple. A user asks a question, the system retrieves relevant evidence, and the model answers with that evidence in context.

Production RAG is harder because every stage between the source document and the final answer can fail.

Documents can be parsed incorrectly. Tables can lose structure. Chunks can split related evidence. Search can miss the right passage. Reranking can bury it. Permission filters can leak or hide information. The model can receive the correct evidence and still use it incorrectly.

A production RAG system should therefore be treated as a retrieval system and a generation system with separate tests.

Enterprise RAG architecture

Enterprise RAG stack

FIGURE 1

A production RAG system contains several independently testable stages.

LayerPurposeExample failure
SourcesAuthoritative company informationWrong source selected
ParsingExtract usable structureTable lost
ChunkingCreate retrievable unitsEvidence split
MetadataPreserve source attributesMissing date or owner
IndexMake content searchableIncomplete indexing
QueryExpress information needWeak search request
RetrievalFind candidate evidenceCorrect passage absent
Permission filterEnforce accessUnauthorized content exposed
RerankingOrder candidatesDistractor ranks first
Context assemblySelect model evidenceToo much noise
GenerationAnswer from evidenceUnsupported claim
CitationPoint back to sourceWrong source attached
EvaluationMeasure behaviorFailure remains invisible

Start with the knowledge problem

Before selecting a vector database or embedding model, define the knowledge the application needs.

Create a source inventory.

SourceUpdate rateAuthorityPermissionsStructure
Product docsWeeklyProduct teamInternal/publicHTML/Markdown
ContractsEvent-drivenLegalAccount-specificPDF/DOCX
CRMContinuousSales/opsRole-basedStructured
Support ticketsContinuousSupportInternalText
PoliciesMonthlyComplianceRole-basedDocuments
InventoryContinuousOperationsInternalDatabase

The inventory determines ingestion, freshness, permissions, and retrieval design.

EVALUATE PARSING ON REPRESENTATIVE SOURCE TYPES

Parsing matters

A PDF is not a sequence of clean paragraphs.

It can contain headers, footers, tables, multi-column layouts, footnotes, images, captions, and scanned pages.

A parser that flattens a pricing table into meaningless text can destroy the evidence before retrieval begins.

Evaluate parsing on representative source types.

Questions include:

  • Are headings preserved?
  • Are table rows understandable?
  • Are page references retained?
  • Are lists preserved?
  • Are repeated headers removed?
  • Are document dates and versions captured?
  • Are images or diagrams relevant to the use case?

THERE IS NO UNIVERSAL CHUNK SIZE

Chunking is an information-design problem

Chunks should preserve enough local context to answer likely questions.

Very small chunks can lose relationships. Very large chunks can reduce retrieval precision and consume context.

There is no universal chunk size.

A contract clause, API reference, support article, product catalog, and research report have different structures.

Structure-aware chunking gives the retrieval system more useful units than blind character windows.

FILTERING, FRESHNESS, DEBUGGING, AND CITATIONS

Metadata turns retrieval into a controllable system

Useful metadata can include:

  • source ID;
  • document title;
  • section;
  • owner;
  • creation date;
  • last updated date;
  • product;
  • region;
  • customer;
  • document type;
  • version;
  • permission group;
  • validity period.

Metadata supports filtering, freshness, debugging, and citations.

A PRODUCTION SYSTEM CAN USE BOTH

Combine retrieval methods

Enterprise search benefits from combining methods.

MethodStrength
Semantic retrievalConceptual similarity
Keyword retrievalExact terms, codes, names
Metadata filtersScope and permissions
Database queriesStructured facts
Graph traversalExplicit relationships
RerankingBetter ordering of candidates

A user asking about invoice INV-49328 needs exact matching. A user asking which policy applies to an unusual refund case needs semantic retrieval. A production system can use both.

Permission-aware retrieval

Permission filtering belongs inside the retrieval path.

The agent should not retrieve documents the current user cannot access and rely on the model to keep them secret.

A useful path is:

identity
  ↓
authorized query
  ↓
candidate retrieval
  ↓
permission filter
  ↓
rerank
  ↓
evidence

This is especially important when a shared index contains information from several departments, customers, regions, or security classes.

RERANKING AIMS FOR PRECISION

Reranking

Initial retrieval aims for recall: find a useful candidate set.

Reranking aims for precision: put the strongest evidence near the top.

This separation lets a fast method gather candidates and a more precise one order them.

A reranker can score candidates against the actual query after the initial search.

Context assembly

More context is not automatically better.

The system should send the model evidence that is relevant, current, authorized, and sufficiently complete.

Excess context adds cost and can dilute the strongest evidence.

Anthropic's work on context engineering describes context as a finite resource and argues for curating high-signal information during inference.

Citation design

Citations should preserve a path back to the underlying source.

A useful citation object can include:

{
  "source_id": "policy-2026-04",
  "title": "Refund Policy",
  "section": "Enterprise Accounts",
  "updated_at": "2026-04-12",
  "passage_id": "p-184"
}

The model can then attach source references to claims that depend on retrieved material.

CREATE TEST QUERIES WITH KNOWN RELEVANT EVIDENCE

Evaluate retrieval before generation

RAG evaluation pipeline

FIGURE 2

Retrieval and generation should be tested separately.

Create test queries with known relevant evidence.

For each query, record the document or passage that should be retrieved.

Then measure:

MeasureQuestion
Recall@kDid the candidate set contain the needed evidence?
Precision@kHow much retrieved content was useful?
MRRHow high did the first relevant result rank?
NDCGDid the ranking order relevant evidence well?
Permission accuracyWere unauthorized results excluded?
Freshness accuracyDid current evidence outrank obsolete material?

Only after retrieval works should final-answer evaluation carry much weight.

PRESERVE THE CASE AS REGRESSION COVERAGE

RAG failure matrix

RAG failure matrix

FIGURE 3

The fix depends on whether evidence exists, is retrieved, and is used correctly.

Failure A: evidence is absent from the corpus

Fix ingestion or source coverage.

Failure B: evidence exists but retrieval misses it

Fix query construction, indexing, filters, retrieval, or ranking.

Failure C: evidence is retrieved but the answer is wrong

Fix context assembly, instructions, model choice, or answer evaluation.

Failure D: evidence and answer are correct

Preserve the case as regression coverage.

THE SYSTEM NEEDS SEVERAL KINDS OF RETRIEVAL

Hybrid search example

Suppose an employee asks:

HYBRID SEARCH EXAMPLE

What warranty applies to the XR-440 unit sold to Acme in Germany last March?

The system needs several kinds of retrieval.

  1. 1Exact entity lookup for XR-440.
  2. 2Customer lookup for Acme.
  3. 3Region filter for Germany.
  4. 4Date filter for the sale.
  5. 5Semantic retrieval over warranty language.
  6. 6Current-policy check.
  7. 7Permission check for account records.

Pure vector similarity is an incomplete architecture for this question.

Freshness

Changing information needs a freshness policy.

Possible mechanisms include:

  • event-driven updates;
  • scheduled synchronization;
  • document versioning;
  • validity dates;
  • source priority;
  • stale-document suppression;
  • deletion propagation.

A RAG system that retrieves a superseded policy accurately is still wrong.

"JUST IN TIME" RETRIEVAL

RAG for agents

An agent can use retrieval as a tool and pull context as it works.

Anthropic's context-engineering guidance describes "just in time" retrieval, where an agent maintains lightweight references and loads information as needed during execution.

That approach is useful for long-running work because it avoids filling the context window with information that never becomes relevant.

Production RAG checklist

Corpus

  • Are authoritative sources defined?
  • Is source ownership clear?
  • Are update paths known?
  • Are deletions propagated?

Parsing

  • Are tables preserved?
  • Are headings retained?
  • Are dates and versions captured?
  • Are scanned documents handled?

Retrieval

  • Are semantic and lexical methods tested?
  • Are structured sources queried directly where appropriate?
  • Is reranking measured?
  • Are permissions enforced before context reaches the model?

Evaluation

  • Is there a query/evidence test set?
  • Is retrieval measured independently?
  • Are freshness cases included?
  • Are permission cases included?
  • Are unsupported answers measured?

Operations

  • Can a bad answer be traced to the exact evidence?
  • Can the team inspect ranking?
  • Are source and index versions recorded?
  • Are regressions tested before release?

FAQ

Enterprise RAG is retrieval-augmented generation built around company knowledge, systems, permissions, freshness requirements, and production evaluation.

Sources

PAN ET AL.
Characterizing Agents in Production, ICML 2026, IBM Research.
LANGCHAIN
State of Agent Engineering, June 2026.
ANTHROPIC
Building Effective Agents.
ANTHROPIC
Effective Context Engineering for AI Agents.
ANTHROPIC
Demystifying Evals for AI Agents, January 2026.
OPENAI
Evaluate Agent Workflows and Optimizing LLM Accuracy.
NIST
Artificial Intelligence Risk Management Framework: Generative Artificial Intelligence Profile, NIST AI 600-1.
GOOGLE CLOUD
Fine-tuning LLMs and AI Models.

Editorial note

Charts based on survey findings identify their source in the caption. Mathematical examples are labeled as illustrations. Architecture diagrams and decision frameworks are original explanatory assets created for this post.

LET'S TALK

Go fromproductionin weeks,not quarters.

Book a 15-minute working session. Bring one process that hurts. We'll leave with a plan for it, and an honest answer on whether we're the right neolab.