Home
/
Insights
/
Engineering
Engineering

Building a Production RAG Pipeline That Doesn't Hallucinate

Chunking, retrieval, evaluation and guardrails, the patterns we use to ship reliable AI copilots.

Tanco Tech Consulting
Aug 8, 2026 · 9 min read

Retrieval-augmented generation (RAG) is the workhorse behind most useful enterprise AI copilots. The demo is easy; the reliable production system is not. Here are the patterns we use at Tanco Tech to ship RAG that answers from your data, and admits when it doesn't know.

1. Chunking is a product decision, not a default

How you split documents determines what the model can retrieve. Naive fixed-size chunks shred tables and break context. We chunk semantically, by section and heading, keep a sensible overlap, and attach rich metadata (source, section, date, permissions) to every chunk so we can filter and cite precisely.

2. Retrieval quality beats model size

Most "the AI is wrong" complaints are actually retrieval failures, the right context never reached the model. Our defaults:

  • Hybrid search, combine dense vector similarity with keyword/BM25 so exact terms and IDs aren't lost.
  • Reranking, a second-pass reranker to push the most relevant chunks to the top.
  • Metadata filtering, scope retrieval by tenant, permission and recency before you rank.
If the answer isn't in the retrieved context, the model shouldn't be answering. That single rule prevents most hallucinations.

3. Ground the generation, and cite

We instruct the model to answer only from the supplied context, to say "I don't have that information" when it's missing, and to cite the source chunks. Citations aren't just UX polish, they make answers auditable and build user trust.

Our reliability checklist
Hybrid
search + rerank
Cite
every claim to a source
Eval
on real questions, continuously

4. Evaluation is the real moat

You can't improve what you don't measure. We build a golden set of real questions with known-good answers and run it on every change, scoring for faithfulness (is the answer supported by the sources?), relevance and coverage. This turns "it feels better" into a number.

5. Guardrails and observability

In production we add input/output filtering, rate limiting, and full tracing of every retrieval and generation so we can debug any answer after the fact. When something goes wrong, we can see exactly which chunk led the model astray.

Ship it with a partner who's done it

We build practical AI copilots that hold up in production, one recent support assistant deflected around 90% of routine tickets. If you want an AI system your users can actually trust, explore our AI services or get a quote.

#Engineering
#RAG
#LLMs
#AI
Share

Have a project in mind?

Tell us what you're building and get a tailored estimate in minutes.