RAG that refuses to guess.
I built RAG.NextUpgrad, a production retrieval-augmented generation platform: hybrid retrieval, re-ranking, streaming answers with citations, and a confidence gate that blocks answers the evidence cannot support.
- Retrieval
- Dense + BM25, reciprocal-rank fusion
- Answers
- Streamed, with inline citations
- Safety
- Confidence gate on the evidence
- Footprint
- About 220 MB, runs on a free tier
The pipeline
What happens between a question and an answer.
- 01
Chunk and index twice
Documents are chunked and embedded for dense search and indexed for BM25, because exact terms and meaning fail in different places.
- 02
Fuse and re-rank
Reciprocal-rank fusion merges both result lists; a re-ranker orders them so the model only sees the strongest passages.
- 03
Score the evidence
A confidence gate scores what was retrieved before generation. Weak support means a refusal with a reason, never a guess.
- 04
Stream with citations
Answers stream back with inline citations to the exact passages, so every claim can be checked.
- 05
Fail over, keep serving
Provider outages fall back across LLM providers with identical prompts; the product stays up.
Why it holds up
Three choices that separate a production RAG system from a demo.
Hybrid, not vector-only
Vector search alone misses exact names and numbers; keyword search alone misses meaning. The pair, fused, fixes most bad answers.
A gate, not a disclaimer
The system is measured on when it declines. A refusal with the evidence shown beats a fluent, wrong paragraph.
Operated, not launched
Docker, CI/CD, structured logging and metrics; a test suite that runs on every change; a footprint that fits a free tier.
Writing on RAG
The guides I wrote from building it.
Need RAG that your users can trust?
I can build it, audit yours, or teach your team how it works. Twenty minutes to find out which.
