Why Tables Are the #1 Silent Failure in Production RAG (and How I Fixed Mine)
Tables break RAG because flattening them destroys row/column relationships; keep them as HTML and attach headers to every row to fix it.
Topic
Reliability, failure modes, and the architecture that keeps retrieval-augmented generation working with real users.
Tables break RAG because flattening them destroys row/column relationships; keep them as HTML and attach headers to every row to fix it.
When RAG breaks, the model usually isn't the problem — retrieval is, about 73% of the time. Here's the real failure map and what to fix first.
Qdrant applies payload filters during HNSW graph traversal, not after — so filtered queries stay fast and always return a full top-k.
Frameworks are great for a demo. In production, the abstraction you can't see into costs more than it saves.
Vector search misses exact terms like SKUs and error codes because embeddings blur rare tokens; a sparse channel restores exact-match signal.
RAG became the default reflex for every LLM problem. Often it's the wrong tool. A straight decision framework for RAG vs fine-tuning vs just prompting.
Score retrieval and generation separately: the pair of metrics localizes whether a bad RAG answer is a retriever or an LLM problem.
CRAG fixes retrieval quality before generation; Self-RAG uses fine-tuned reflection tokens to critique its own output. Here's when to use each.
Reference-based evals compare output to a known correct answer; reference-free evals score intrinsic properties like grounding without ground truth.
The stages every production RAG system needs — indexing, query-time retrieval, and always-on evaluation — and how to order them.
Use per-recognition OCR confidence as a metadata gate: drop, re-OCR, or flag low-confidence spans before they pollute your RAG index.
If you log one thing in your RAG pipeline, log the final assembled prompt. It's the fastest path from 'bad answer' to root cause.
Attach structural, content, and contextual metadata to chunks, then use it for filtered multi-axis retrieval to sharpen RAG accuracy.
Use VLM parsing for scanned, complex, or merged-cell PDFs; use layout parsers for clean digital docs to save cost and latency.
Make a RAG ingestion pipeline idempotent by keying every stage on a SHA-256 content hash, isolating failures in DLQs, and reprocessing deterministically.
Add sparse/keyword search to dense embeddings only when your eval shows lexical misses on IDs, rare terms, acronyms, code, or names.
Why you can't average keyword and vector scores — and how Reciprocal Rank Fusion combines them for an 8–15% accuracy gain.
Most RAG hallucinations are retrieval bugs in disguise. A concrete checklist to cut them — grounding, retrieval quality, and faithfulness checks.
A step-by-step debug order for bad RAG answers — start with the assembled prompt, not the model. Most bugs are retrieval, not generation.
Pick an embedding model and dimension by trading MTEB quality against RAM, latency, and re-embedding cost — with a decision tree.
Start at 512 tokens with light overlap, then tune by query type. A practical, benchmark-backed guide to chunk size for retrieval.
Corrective RAG inserts a retrieval evaluator between vector search and the LLM that scores documents and routes to proceed, filter, or re-retrieve.
Moving a production cloud RAG pipeline on-device: the shape transfers, but index scale, embedder size, and re-ranking budgets do not.
Strip repeating headers/footers, de-hyphenate line breaks, and normalize unicode before chunking so RAG embeddings stay clean.
Use structure-defined chunks first; when you must set a size, 256-512 tokens with 10-20% overlap is a sane default, then tune.
Mine failing production traces, store input plus retrieved chunks plus expected behavior, and version 50-100 focused cases in-repo.
How to build a production agentic search system on Qdrant: single-shot vector+filter tool calls, Postgres hydration, and progressive relaxation.
On macOS, Apple Vision beats Tesseract for RAG ingestion — faster, more accurate on real scans, free, offline. Tesseract wins on Linux CI.
The common chunking approaches for retrieval, when each one helps, and the tradeoffs — a quick reference you can come back to.