Production RAG for Enterprise Documents
Production RAG for Enterprise Documents architecture. Main flow: Documents, then Chunk + embed, then Hybrid retrieve, then Rerank, then Cited answer. Connected paths: Vector search feeding Hybrid retrieve; BM25 keyword as a conditional path from Hybrid retrieve.
A production retrieval system that turns scattered internal documents into fast, accurate, source-backed answers.
- Type
- Case study
- Industry
- Knowledge Retrieval
The problem
Answering routine questions meant digging through PDFs, wikis, and ERPNext records by hand. Answers were slow, inconsistent, and dependent on whoever happened to know where things lived.
What I built
- 01
Consolidated the document sources and built an ingestion pipeline with semantic chunking.
- 02
Implemented hybrid retrieval, dense embeddings plus a BM25 fallback, with cross-encoder reranking for precision.
- 03
Surfaced answers through a simple chat interface, every response linked back to its source.
- 04
Tuned retrieval against real questions and added evaluation to catch regressions before they shipped.
What was hard
- Chunking decided the accuracy, not the model. Splitting on token count broke tables and clause boundaries, and the retrieval quality moved more from fixing that than from any prompt change.
- Dense search kept missing exact terms: a part number, a policy code, a date. That is what the BM25 leg is for, and merging two rankings sensibly took more iterations than adding the second index did.
- Regressions are invisible without evaluation. A change that improves five answers and breaks two looks like an improvement until someone hits the two, so a question set with known-good answers had to exist before tuning could mean anything.
Built with
- LangGraph
- Pinecone
- ERPNext
- Cross-encoder
- FastAPI