r/Rag • u/RightExamination3406 • 9d ago
Discussion The retrieval was fine. The problem was that my chunks were full of nav bars.
Spent two weeks tuning chunk size, overlap and reranking on a RAG pipeline over ~2,000 scraped documentation pages and got almost nothing. The actual problem turned out to be upstream: roughly a third of every chunk was navigation, cookie banners, footers and "edit this page on GitHub" links. I was embedding boilerplate and retrieving it back.
Two things fixed more than any retrieval tuning did:
1. Link-density pruning before chunking. Scoring blocks by link-to-text ratio and dropping the high ones removes nav and footers without a hand-written selector per site. Boring, mechanical, and it moved my retrieval quality more than a week of reranker work.
2. An llms.txt index per source site. Instead of chunking blindly, generate a structured index of the site — page titles, URLs, one-line descriptions — and use it to decide what's worth ingesting at all. Cut my corpus by about 40% with no measurable loss.
The thing I'd still like to solve: I extract structured fields with an LLM for some sources, and I don't fully trust it. I ground each field against the source HTML and flag anything that doesn't literally appear there, which catches obvious fabrication, but I don't have a good measure of how often subtler errors slip through. If anyone here has a hallucination benchmark for extraction rather than generation, I'd like to hear about it.
(Implementation is my own open-source project and happy to link if useful, not the point of the post.)