RAG bot that refuses outside its docs scores 9/10 on held-out set — what broke
ZtasnimS75 · reddit · 2026-10-22
A developer built a small RAG assistant over 8 FastAPI tutorial pages that must answer only from retrieved docs and cite the source file, else reply NOTINDOCS. Stack: ChromaDB, all-MiniLM-L6-v2 (800-char chunks, 100 overlap), Gemini flash-lite, Streamlit free tier.
Key findings:
- First dev run: 10/14, all failures false "not in docs". Distance measurement showed answerable questions scored 1.36 while an out-of-docs question scored 1.12 — a raw distance cutoff can't separate them. Raising the threshold to 1.5 and letting the LLM prompt do the refusing got 14/14 on dev (tuned, so optimistic).
- Hidden set after freezing: 9/10. The miss was a question the docs do answer — top chunks came from a neighboring page and the strict prompt refused. Left unfixed to keep the number honest.
- Deployment gotchas: pip freeze in PowerShell writes a UTF-16 requirements file; the vector index isn't in git and builds on first start; ChromaDB threw an error on first cloud start (reboot fixed it).
Caveats: test cases drafted with AI help, only 9 of 25 expected answers manually checked. The author asks whether hybrid BM25 + vector, a re-ranker, or more chunk overlap would fix the miss, and how to better set the refusal threshold. Demo, code, and full write-up linked.
More from coding & agent
- Grok Bot Lands in X DMs: An Autonomous Assistant That Connects to Your Apps — mark_k · 2026-10-22
- 5 ways AI makes engineering leaders more effective — beyond writing code — rseroter · 2026-10-22
- ToM2Vec uses continuous theory-of-mind vectors to boost multi-agent coordination across 5 tasks — EliasEskin · 2026-10-22
- ToM2Vec: continuous theory-of-mind vectors help LLM agents coordinate with unseen partners — EliasEskin · 2026-10-22
- LiDAR scan + LLM workflow produces dimensionally accurate 3D room models — OpenAIDevs · 2026-10-22
- Working with agents: give them principles, not rules — _AustinCalvert_ · 2026-10-22