The problem
Real-world document corpora are hostile to naive RAG: scanned PDFs, dense tables, figures that carry the actual answer, mixed languages, thousands of files. Chunk- and-embed alone retrieves the wrong paragraph with great confidence.
What I built
A self-hosted RAG platform that treats retrieval quality as a pipeline, not a model call:
- Layout-aware ingestion — Docling-based parsing that preserves tables and figures instead of flattening them into word soup; content-hash dedup on normalized text;
- Hybrid retrieval — a query router in front of dense search, with a cross-encoder reranking stage (the measured win came from reranking, not from swapping embedding models);
- A relatedness graph over the corpus — graph and mind-map views (per-document and multi-document) that make inter-document relationships visible: you can see which documents cluster around a topic and walk the neighbors, instead of only querying the corpus blind;
- An MCP server layer — agents consume
searchas a tool with auth and audit logging, which turned the pipeline from an app into infrastructure other systems build on; - A living corpus — an agent-run monthly ingestion workflow (the fleet watches sources, fetches, cleans, verifies, ingests) keeps the knowledge base current — answers cite documents as they stand today, including sources newer than any model’s training cutoff;
- Operations — Postgres + FAISS behind FastAPI, Docker-deployed on always-on home infrastructure, serving a document corpus in the thousands.
What it proves
Retrieval is an engineering discipline: parsing fidelity, retrieval staging, and honest evaluation move the needle more than model choice. The failure modes I hit — index/registry desync, dedup keyed on the wrong hash, per-article recall diluted by fixed-size chunking — each became a design rule, and several were found by measuring recall on real questions rather than eyeballing demos.
Status
In production since spring 2026, queried daily — including by the agent fleet, which uses it through the MCP layer.