RAG Done Right —
What Nobody Tells You
About Retrieval in Production
Most RAG implementations work fine on your test data. They fall apart on real user questions. The gap is in retrieval quality — not the LLM.
5 Ways RAG Fails Silently
Your RAG system returns answers — that's the dangerous part. Silent failures produce plausible-sounding responses backed by the wrong context. Here are the five culprits, and what they look like in practice.
The RAG Quality Ladder
Five levels separate a weekend prototype from a production system you can trust. Each level builds on the last — you can't skip rungs without accumulating hidden debt.
Naive RAG — Basic Vector Search, No Eval
Fixed-size chunks, one embedding model, top-k cosine search, feed directly to LLM. Works on demos. Fails on edge cases you haven't seen yet. You have no idea how often it fails because you have no measurement.
Chunking Strategy + Metadata Enrichment
Semantic chunking respects document structure. Metadata tags (date, source, version, section) enable pre-filtering before vector search. Parent-document retrieval fetches larger context windows around matched chunks.
Reranking + Hybrid Search (BM25 + Dense)
Combine keyword (BM25/TF-IDF) and dense vector retrieval — keywords catch exact matches that semantics miss. A cross-encoder reranker re-scores the combined candidate set. Reciprocal Rank Fusion merges the result lists.
Retrieval Eval Harness — MRR, NDCG, Hit Rate
A golden Q&A dataset with ground-truth relevant chunks. Automated metrics run on every retrieval change. You now know your Hit@3, MRR@10, and NDCG@5 — and regressions block deployment.
Continuous Monitoring + Feedback Loop
Live retrieval metrics tracked per-query. Low-confidence retrievals are flagged. User feedback (thumbs down, corrections) flows back into the eval dataset. Model drift and distribution shift are caught automatically. The system gets better with every failure.
Hallucination vs. Retrieval Failure
Most "LLM hallucinations" in RAG systems are actually retrieval failures in disguise. The LLM is doing its job — it's faithfully working with the wrong context. Getting the diagnosis right determines where you fix it.
Wrong chunks retrieved — LLM has nothing to work with
The retrieved context doesn't contain the answer. The LLM either says "I don't know" (good) or — more often — confabulates a plausible answer from its parametric knowledge (bad). This looks like a hallucination but is actually a retrieval miss.
Correct chunks retrieved — LLM ignores or distorts them
The retrieved context does contain the answer, but the LLM fails to extract it correctly. This is a genuine generation failure — prompt design, context window position bias, or instruction-following issues.
Before blaming the LLM: inspect the retrieved chunks. If you paste the correct context directly into the prompt and the LLM answers correctly, you have a retrieval problem. If it still fails — you have a generation problem. These require completely different fixes. Debug in order: retrieval first, generation second.
What a Production RAG Eval Looks Like
A golden Q&A dataset drives retrieval metrics. Generation metrics measure faithfulness independently. A combined eval pipeline runs in CI and gates every change.
The Eval Stack
~200 hand-curated query / relevant-chunk / expected-answer triples. Cover head queries (80%) and tail edge cases (20%). Update as content changes.
For each query, check if the relevant chunk appears in top-k results. Compute Hit@3, MRR@10, NDCG@5. Alert if MRR drops more than 5% from baseline.
Faithfulness (does the answer contradict the retrieved context?), Answer Relevance (does it answer the question?), Correctness vs. ground truth. Use an LLM-as-judge or RAGAS framework.
Every pull request that changes chunking, embedding, or retrieval logic runs the full eval suite. Regressions block merge. Improvements get logged.
The Bottom Line
Better retrieval beats a bigger model every time.
You don't need GPT-5. You need the right chunks in the context window. Measure your retrieval. Fix what's broken. Ship with confidence.
Retrieval-first AI, measured and monitored — not vibes.