Architecture 9 min read

RAG Architecture Patterns for the Enterprise: Lessons from Three Production Deployments

CS
CELESDEV Solutions
Integration & Data Practice

In 2025, we deployed retrieval-augmented generation (RAG) systems at three enterprise clients: a pan-European insurance group, a mid-size investment bank, and a manufacturing conglomerate. Each deployment taught us something the benchmarks don't show. This article distils those lessons into patterns you can apply immediately — and anti-patterns to avoid.

Key Insight
Your vector store is almost never the bottleneck. In every production deployment we've run, the bottleneck was either chunking strategy, re-ranking latency, or the upstream document ingestion pipeline — not the vector similarity search itself.

Why Enterprise RAG Is Different from Demos

Every RAG demo works. A single PDF, OpenAI embeddings, a Chroma store running locally — it takes 20 minutes to build something impressive. Enterprise RAG is a different problem entirely. You're dealing with tens of thousands of heterogeneous documents, access control requirements, latency SLAs, explainability demands from compliance teams, and the need to integrate with existing data governance frameworks.

The three clients we worked with had document corpora ranging from 40,000 to 900,000 documents. Two had strict data residency requirements (no data leaving EU regions). One had a legal team that needed every LLM response to be traceable to a specific source passage, with the ability to audit which document version was queried.

These constraints shape architecture decisions in non-obvious ways. Let's walk through the patterns that emerged.

Pattern 1: Hierarchical Chunking for Mixed Document Types

The single most impactful decision in any RAG deployment is chunking strategy. Most tutorials use fixed-size chunking (e.g., 512 tokens with 50-token overlap). This works adequately for uniform documents but fails badly for enterprise corpora containing a mix of contracts, technical manuals, financial reports, and internal wikis.

We implemented a hierarchical chunking approach with three levels:

At query time, the retrieval pipeline runs a two-stage search: document-level filtering narrows the candidate set, then section- and sentence-level retrieval extracts the precise context. This reduced hallucination rates by approximately 34% compared to flat chunking on our insurance client's contract corpus.

C4 Container — RAG Retrieval Pipeline┌─────────────────────────────────────────────────────┐ │ Query Orchestrator │ │ ┌────────────┐ ┌────────────┐ ┌────────────────┐ │ │ │ Doc Filter │→ │ Section │→ │ Sentence │ │ │ │ (L1 embed) │ │ Retriever │ │ Re-ranker │ │ │ └────────────┘ │ (L2 embed) │ │ (cross-encoder)│ │ │ └────────────┘ └────────────────┘ │ └─────────────────────────────────────────────────────┘ ↓ ↓ ↓ Weaviate Weaviate LLM Context (summary) (sections) Assembly

Pattern 2: Re-Ranking as a First-Class Component

Vector similarity retrieves semantically adjacent content. It does not retrieve the most relevant content for a specific query. For enterprise use cases — particularly legal research and financial analysis — this distinction matters enormously.

We introduced a cross-encoder re-ranking step between retrieval and context assembly. The cross-encoder takes (query, candidate passage) pairs and scores them with significantly higher accuracy than bi-encoder similarity alone. We evaluated Cohere Rerank, BGE-Reranker-v2, and a fine-tuned MonoT5 variant.

For our bank client, we fine-tuned MonoT5 on 8,000 (query, relevant passage) pairs extracted from their existing search logs. This outperformed off-the-shelf re-rankers by 18 MRR points on their internal evaluation set. The fine-tuning data was the most valuable investment in the entire project — more impactful than model selection or infrastructure choices.

Fine-tuning your re-ranker on domain-specific data matters more than which foundation model you choose for generation.

Pattern 3: Guardrail Architecture for Regulated Contexts

Both the insurance and banking clients operated under DORA and internal risk frameworks that required the RAG system to refuse or flag certain query types. We implemented a four-layer guardrail stack:

  1. Input classification: A small fine-tuned classifier categorises queries before they hit the retrieval pipeline. Queries touching PII, restricted trading information, or out-of-scope topics are blocked with an explanatory response.
  2. Retrieval scope enforcement: ACL metadata filters on the vector store ensure users only retrieve from document collections they're authorised to access.
  3. Output review: A secondary LLM pass checks generated responses for confidential terms, regulatory non-compliance markers, and factual inconsistencies with retrieved passages.
  4. Audit logging: Every query, retrieved passage set, and generated response is logged with a trace ID. The insurance client's compliance team can reconstruct any answer from logs within minutes.

This stack adds approximately 800ms to end-to-end latency. For our clients, this was an acceptable trade-off for the compliance assurance it provided. Critically, we made each guardrail layer independently configurable so the system can be tuned without rebuilding the pipeline.

Key Takeaways
  • Invest in chunking strategy before infrastructure — it's your highest-leverage decision
  • Add a cross-encoder re-ranker; fine-tune it on domain data if volume allows
  • Build guardrails as a configurable stack, not hardcoded logic
  • Audit logging is non-negotiable in regulated industries
  • Evaluate with domain-specific benchmarks, not general RAG leaderboards
Related Articles
Architecture
C4 Model in Practice: Communicating Architecture to Every Stakeholder
Read article →
Architecture
Using MEGA HOPEX for Architecture Governance at a European Bank
Read article →
Integration
Event-Driven Integration with Symfony Messenger and Redis Streams
Read article →