Why Better RAG Starts With Better Ingestion
Part 2 of 6: Building a production retrieval layer, one failure at a time.
TL;DR: Same 5,000 documents. Same embedding model. Same top-5 retrieval, same prompt, same everything downstream. I changed only the ingestion pipeline — structure-aware chunking, provenance on every chunk, and explicit supersession — and the parental leave bug from Part 1 became impossible rather than unlikely. Here is the rebuilt pipeline, the schema, and an honest account of what this approach still cannot do.
Where we are
The system currently does this: extract text from a document, cut it into 512-token pieces, embed each piece, store the piece and its vector in Postgres, retrieve the five nearest to a question, paste them into a prompt.
It works well on most questions and fails invisibly on one particular class of question. In Part 1 it told an employee they had 12 weeks of parental leave, citing a genuine...
Copyright of this story solely belongs to hackernoon.com. To see the full text click HERE