Sharing All the RAG Pitfalls I Ran Into While Building an Internal Document Chatbot

I've been building a chatbot for searching our internal wiki for two months now. Embeddings and a vector DB are the combo everyone knows, but once I actually hooked it up, there were tons of traps that papers and blogs don't tell you about. Here's a rundown of the landmines I stepped on.

1. Sloppy chunking breaks retrieval

At first I did fixed cuts at 500 tokens, but because they got cut in the middle of paragraphs, each chunk completely lost context. Eventually I switched to splitting by headers and prepending the header path to each chunk. That one change noticeably improved the accuracy rate.

2. Hybrid search was the answer

If you use only vector search, it keeps failing on internal abbreviations and product code names. Embeddings can't capture the meaning of codes like 'ABC-2024'. Once I mixed in BM25 and reranked with RRF, that problem almost disappeared.

3. Rerankers deliver more impact than expected

The setup pulls the top 20 and uses a reranker to narrow them to 5, and it was the improvement with the best cost-to-benefit ratio. However, it added more than a second to response time, so you have to consider it together with streaming UX.

4. Improving without an eval set is just gambling

This is the part I regret most. For the first two months, I set direction based on 'it feels like it's getting better.' Only after I built an eval set of 100 question-answer pairs could I judge what was actually an improvement. Make one first, no matter what.

5. 'If you don't know, say you don't know' in the prompt only half works

When the search results are empty, it just makes something up. So if the retrieval score is below a threshold, I blocked it at the code level to not generate an answer at all and cut off with 'No documents found.' That's much more reliable.

Now I've even added source links to answers, and the response has been pretty good. Next I plan to add permission filtering and caching; if anyone has built something similar, I'd appreciate advice on cache strategy.

by 데이터덕후596

0 answers