Service RAG architecture development · retrieval augmented generation · UK

RAG architecture development for the team whose chatbot hallucinated. a contract clause on a Tuesday.

Production RAG for UK SaaS, legaltech and healthtech teams — hybrid retrieval (pgvector + BM25 + reranker), corpus-tuned chunking, citation-gated generation and eval suites with hallucination detection. Nine systems shipped since 2023; every answer cites the source it actually came from.

24hreply, from a senior
100+projects shipped since 2019
Senioronly, on the spine
RAG in production since 2023

Your chatbot hallucinated a contract clause. We rebuild RAG so every answer cites the source it came from.

A notebook RAG with cosine similarity and no eval is a beautiful demo that becomes a customer complaint in a fortnight. We build the hybrid retrieval, the citation gate, and the eval suite that make retrieval augmented generation production-grade.

“Hallucination rate fell from 7.2% to 0.4%. The pilot was reinstated and the SRA query closed.”

Vikram

Head of Engineering, UK LegalTech

001

0

UK RAG systems shipped to production since 2023, zero cross-tenant leaks.

002

0%

Citation accuracy on held eval across production traffic.

003

0ms

P95 retrieval and generation latency across nine systems.

The engineering lead this page is fordemoed fine · fabricated a clause on Tuesday

Vikram shipped a chatbot to fourteen law firms. Then it invented a clause.

01

Vikram leads engineering at a UK legaltech. They shipped a contract-review chatbot to 14 law firms. OpenAI plus Pinecone. It looked great in the demo. Then a senior associate at a Magic Circle firm asked it about an indemnity clause.

02

The chatbot fabricated a clause that didn’t exist, cited section 7.4 (which was about something else entirely), and sounded confident. The partner saw it. The pilot got pulled. An SRA query landed. The architecture, not the model, was the problem: cosine-only retrieval, 512-token chunks, no citation gate, no eval.

03

This page is for the founder or data-lead who decided the RAG system is shipping to production, and wants it to land without taking the business down. The next sections show the discipline that gets it there.

Hallucination rate 7.2% 0.4%
The eight RAG pains we hear in every audit

The RAG pain. The day-1 architecture answer.

Each one decides whether your retrieval augmented generation survives the next customer complaint, the next reindex bill, or the next compliance review.

  1. 01
    The hallucinationDay-1 architecture

    “The chatbot made up a clause. The partner saw it. The pilot got pulled.”

    Citation gate plus retrieval-anchored generation. The model refuses to answer without a cited chunk. Hallucination rate falls below 1% on production traffic.

  2. 02
    The wrong chunkDay-1 architecture

    “The retrieved chunk was related, but not the right one. The answer was confidently wrong.”

    Hybrid retrieval plus reranker. BM25 plus semantic plus Cohere or Voyage reranker. Top-1 accuracy lifts 30 to 50%.

  3. 03
    The chunking messDay-1 architecture

    “We chunked at 512 tokens. It cut sentences in half. Retrieval missed answers.”

    Corpus-tuned semantic chunking. Semantic-unit chunking. Sentences, paragraphs and sections preserved. Retrieval accuracy lifts 20 to 40%.

  4. 04
    The eval that doesn’t existDay-1 architecture

    “We have no held eval. We ship blind, and the customer finds the regression.”

    Golden Q&A plus adversarial plus CI gate. 240 golden Q&A pairs plus adversarial prompts. A regression fails the build. The customer never finds it first.

  5. 05
    The cross-tenant leakDay-1 architecture

    “Tenant A asked a question and got Tenant B’s data in the answer.”

    Tenant pin at retrieval plus RLS. Tenant pin at the vector store. Postgres RLS on pgvector. Cross-tenant retrieval is architecturally impossible.

  6. 06
    The citation liesDay-1 architecture

    “The model cited section 7.4 but quoted from 12.1. The customer caught it.”

    Citation verification at generation. Every cited span is verified against the retrieved chunk. A mismatch means refuse to answer.

  7. 07
    The cost spiralDay-1 architecture

    “The embedding bill went from £200 to £4,800. The corpus reindexed daily for no reason.”

    Incremental indexing plus embedding cache. Incremental indexing. Embedding cache. Reindex only on document change. The bill stabilises.

  8. 08
    The observability gapDay-1 architecture

    “A customer says the answer was wrong, and we can’t reproduce it.”

    Per-query trace plus retrieval log. Every query logs retrieved chunks, reranker scores, model and version, and the answer. Reproducible from logs.

RAG tech stack · LangGraph + Claude / GPT-5 + pgvector + AWS

The stack we ship every RAG system on.

LangGraph for orchestration, hybrid retrieval over pgvector and BM25, a reranker on top, and the AWS layer that keeps the unit economics working at scale.

T1

What we ship every RAG system on

LangGraph + pgvector
Python 3.12 + LangGraphClaude Sonnet 4.5GPT-5pgvector (Postgres)BM25 (Tantivy)Cohere / Voyage Reranktext-embedding-3 / voyage-3FastAPIPydantic v2LangSmithSentryTypeScript
T2

When your RAG brief calls for it

reach when needed
Pinecone / QdrantWeaviateAnthropic MCPOpenAI Realtime (voice RAG)LlamaIndexHaystack
T3

The cloud + infra

AWS-default
AWSRDS Postgres + pgvectorAWS OpenSearchAWS LambdaKubernetes (EKS)DockerRedis (embedding cache)S3TerraformDatadog APMOpenTelemetryVanta / Drata
RETRIEVAL AUGMENTED GENERATION · WHAT WE SHIP

Four things in-house AI teams can’t hand you

The discipline that keeps a RAG system defensible in a Series B diligence call, and an SRA query.

01

Hybrid retrieval done right

Semantic plus BM25 plus reranker. Not just cosine similarity. Chunking tuned to your corpus.

02

Citation gate, not hope

Generation refuses to answer without a retrieved citation. Hallucination is architecturally constrained.

03

Eval suite + adversarial probes

Golden Q&A pairs plus adversarial prompts. Regression gated in CI before a customer finds it.

04

Per-tenant corpus + scope

Multi-tenant from day one. Tenant pin at the retrieval layer. Cross-tenant leak made impossible.

Results

Vikram’s RAG,
after the rebuild, in numbers

We rebuilt the contract-review RAG across 14 law firms in twelve weeks: pgvector plus BM25 plus Cohere reranker, a citation gate, and an eval suite of 240 golden Q&A pairs plus adversarial prompts.

Answer quality

7.20.4%
Hallucination rate
94%
Citation accuracy, held eval

The outcome

12 wk
Demo to production
SRA
Query closed, pilot reinstated

Track record

9
RAG systems since 2023
0
Cross-tenant leaks in production
How we work with you

Three ways to start. Pricing in the email back.

Pick the shape that fits and Mohit will send your real number inside 24 hours.

AStart here

5-day audit + scope

Two senior engineers read your estate and brief, then write the plan. A 30-page brief, six ADRs, a risk matrix, a fixed-price quote.

  • 5-day senior audit
  • Eval gold set scoped with you
  • Signed scope, line-item GBP
  • £8,000 fixed, no commitment to build
BMost common

RAG build sprint

8 to 14 weeks of fixed-scope shipping. Retrieval, generation, citation gate, eval, observability, multi-tenant scope, handover.

  • Hybrid retrieval + reranker
  • Citation gate + eval suite
  • 30-day walk-away both ways
  • From £55K, IP assigns on commit
COptional

Post-build retainer

One day a week of senior engineering for 3 to 6 months. Performance work, observability, a new surface, your team gets unblocked.

  • One senior day / week
  • Retrieval-quality monitoring
  • New corpus + new surface
  • From £5,000 / month
From £55K · 8-14 weeks · LangGraph + pgvector

“Hallucination rate fell from 7.2% to 0.4%. The pilot was reinstated and the SRA query closed.”

— Vikram, Head of Engineering, UK LegalTech
RAG architecture development · honest answers

What founders and CTOs actually ask before signing

Pain-first, soft-second.

pgvector for under 5M vectors plus tenant-pinned multi-tenant: it lives in your Postgres, so RLS gives you cross-tenant isolation for free. Pinecone or Qdrant beyond that scale. The decision goes in an ADR with a migration path, so you’re never locked to the wrong call.

Claude Sonnet 4.5 for long-context legal or clinical retrieval (200K context). GPT-5 for tool-use-heavy and cost-sensitive paths. We route per query type behind a gateway, so a price hike or a deprecation is a config change, not a rewrite.

A citation gate at generation: no retrieved chunk, no answer. Hybrid retrieval plus a reranker so the right chunk is in context. An eval suite with adversarial prompts gated in CI. Hallucination rate stays below 1% on production traffic, and we can prove it from the held eval.

Tenant pin at the vector store, plus Postgres RLS on pgvector, pgTAP-tested. Cross-tenant retrieval is architecturally impossible, not policy-impossible. Nine systems in production, zero cross-tenant leaks.

An embedding cache plus incremental indexing keeps the bill flat. A typical 14-firm legal RAG runs £180 to £450 a month on Anthropic plus AWS. A cost report ships at handover, so you can model it before you scale.

30-day walk-away both ways. Milestone billing 25/25/25/25. UK VAT registered, listed on Companies House, shipping since 2019. You’re never more than four weeks at risk of paying for nothing.

Every RAG architecture development project has two senior engineers paired, not one. Every decision goes into an ADR the same day. Mohit reviews every PR. Two handovers in seven years, both inside 48 hours.

Yes, with 14 days’ notice. Engineers move to other projects. Spend pauses. Resume with 14 days’ notice. No cancellation fee. We’ve done it six times in 2025.

Rag architecture development — dashboard / app screen
In context

What it looks like shipped.

rag architecture development, in context — the dashboards, flows and components your team actually ships, reviews and maintains.

A RAG plan you can take to your board

One paragraph. That’s it.

Send a 5-line brief: your corpus, query volume, tenant model, and current hallucination rate. Mohit replies inside 24 hours: a clear yes, a clear no, or the one question that decides it.

Write to mohit@empyrealinfotech.com Replies in 24hHybrid retrieval + citationsEval-gated
What happens after the email lands
  1. < 24h

    A personal reply.

    Yes, no, or the deciding question. Straight to your inbox.

  2. Week 1

    The audit + gold set.

    We read the estate and scope the eval set with your team.

  3. Wk 12

    A RAG you can defend.

    Hybrid retrieval, citation gate, eval suite. Clean enough for an SRA review.