Most RAG pipelines retrieve a generous candidate list, assemble a prompt, and then let a token cap trim whatever does not fit. That order is backwards. The cap preserves whatever happened to rank highest, and the highest-ranked material is exactly what near-duplicates tend to dominate.
Duplicate chunks are usually produced upstream, by chunking. Overlapping windows exist to preserve continuity, but they increase the number of stored chunks and introduce redundancy into the indexed corpus, as one study of chunk filtering notes in its analysis of chunking redundancy. Multiple splitters firing on the same document can yield a paragraph chunk, a token-window chunk that overlaps it, and a heading chunk that wraps both, all embedding into nearly the same neighborhood, as one practitioner account of chunk rules describes the crowd-out effect. If six of your top ten are cousins of one section, you have four slots for the rest of the corpus. The retriever looks confident and coverage is poor.
Ordering matters for a second reason. A cap discards by tokens, not by quality. Reordering the pipeline so trimming happens first means each later rule works on a cleaner candidate set, and the cap that finally fires is removing genuinely low-value material. The cap becomes a safety limit instead of a de facto relevance filter.
There is also a placement cost worth fixing before any trimming. Document content belongs in the user message, not baked into the system prompt, because a system message that changes with every retrieval is a prefix that never repeats and nothing can be cached against it as this budgeting walkthrough shows. Get that split right first, then trim.



