Why does redundancy hurt more than it costs?
The bill is the visible half. The quality damage is worse: your top-k has finite slots, and if a passage exists in ten near-identical revisions, retrieval happily fills the result list with ten copies of one idea, crowding out the second and third relevant passages a RAG prompt or agent actually needed. Deduplication is a relevance fix that happens to also be a cost fix.
What does a working pipeline look like?
- Canonicalize: resolve each document to its current version; strip boilerplate (headers, footers, legal blocks) that repeats across the corpus.
- Chunk, then hash: normalize whitespace and hash each chunk's content. A chunk whose hash you've already indexed gets a reference, not a new embedding.
- Embed once per unique chunk, and let metadata carry which documents and versions contain it.
- Default queries to
latest, exposing older versions through an explicit version filter.
Versioned corpus
mostly near-duplicates
Canonicalize to latest
Hash-dedupe chunks
Embed unique chunks once
History via metadata filters
What if you must keep every version?
Compliance corpora often require it. Keep them, but keep them as metadata-filtered history rather than as default-searchable content. The index answers day-to-day queries from the deduplicated current set; an audit query opts into the archive with a filter. Storage-backed engines make the archived portion cheap to retain.
TopK's metadata filtering makes the "latest by default, history on demand" split a query-time concern, and usage-based pricing means every chunk you dedupe away is ingest and storage you visibly don't pay for.