Glossary

Deduplication

Finding and removing repeated content, whether identical files, near copies or passages that say the same thing, so that retrieval and memory return one copy of each fact.

Deduplication is the process of finding repeated content and keeping one copy of it. In retrieval augmented generation it applies at several points: identical files ingested twice, near copies such as two exports of the same report, chunks that repeat because of overlap, and passages from different sources that state the same fact. Left in place, duplicates fill the result list with copies of one answer and push out the passages that would have added something.

Why duplicates hurt retrieval

A retriever returns a fixed number of results, so every duplicate takes a slot. With top-k retrieval set to five and three near-identical chunks at the top, the model sees two useful passages instead of five, and the context window spends tokens on repetition. Duplicates also distort ranking: a fact that appears in ten copies of a template looks more relevant than a fact that appears once in the document that matters.

Versions are the harder case. A policy saved in March and again in October produces two chunks that look almost the same and disagree on one number. The retriever has no way to tell which is current, so the model may quote the old figure. That is a stale knowledge problem as much as a duplication problem, and it is why deduplication usually needs data versioning or at least a modified date to decide which copy to keep. Duplicates also confuse source attribution, since the same claim can be cited to several files.

Types of duplicate

Type

Example

How it is usually detected

Exact

The same PDF uploaded twice

A content hash such as SHA-256

Near duplicate

Two exports of one report with different headers

MinHash or SimHash over word shingles

Semantic

Two articles that state the same fact in different words

Cosine similarity between embeddings above a threshold

Version

An old and a new copy of the same policy

Shared title or source plus a newer modified date

Visual

The same image resized or recompressed

Perceptual hashing

Exact matching is cheap and safe. Near-duplicate detection catches far more, but needs a similarity threshold, and set too low it merges documents that differ in the one detail that mattered. Semantic matching with an embedding model is the broadest and the riskiest, so teams usually flag semantic duplicates for review rather than delete them.

Where to deduplicate

The cheapest place is ingestion. A data ingestion step that hashes each file before indexing skips exact copies, and incremental indexing replaces a changed document instead of adding a second version beside it. Inside a document, chunk overlap creates intentional repetition that is fine to keep in the index but worth collapsing in the results.

At query time, a simple filter drops results whose text is nearly identical to a higher-ranked result, and diversity methods such as maximal marginal relevance trade a little relevance for coverage. Reranking does not remove duplicates by itself, since two copies of a good passage both score well. Periodic clean-up belongs to knowledge base maintenance.

Memory systems face the same problem with facts. An agent that hears “I live in Berlin” in five conversations should hold one memory, and a user who moves should end up with one current city. Entity resolution and memory consolidation are the memory-side versions of deduplication.

Deduplication on Exabase

For facts, Exabase Memory handles this as part of writing: the M-1 engine re-evaluates existing memories when new information arrives, consolidates duplicates and resolves contradictions, so a fact learned many times is stored once and a changed fact replaces the old one. The memory guide covers inferred and verbatim memories, and the post on entity resolution explains the matching step.

For documents, Exabase is the substrate and the policy is yours. Files stored as Resources are indexed on arrival and searchable through Deep Search, with filters on folder, tag, type and date that help separate current material from archives. A Worker can run a scheduled job that looks for likely duplicates, moves them into a review folder or deletes them; deleted resources go to the bin and stay recoverable for 30 days, a form of soft delete. The Worker tools guide lists what a Worker can do. The knowledge base solution covers the wider upkeep, and best vector databases compares stores that leave deduplication entirely to your pipeline.

FAQs

What is deduplication in RAG?

Deduplication in RAG is removing repeated documents, chunks or passages from the index or the results, so that retrieval returns distinct information instead of several copies of the same text.

Why do duplicates reduce RAG accuracy?

They take result slots and context tokens that would otherwise hold different evidence, and they make a repeated passage rank above a more relevant one that appears once.

Should I deduplicate at ingestion or at query time?

Both, for different duplicates. Remove exact copies and old versions at ingestion; collapse near-identical results and overlapping chunks at query time.

How do I detect near-duplicate documents?

Common methods are MinHash or SimHash over word shingles, which estimate text overlap cheaply. Embedding similarity catches paraphrases but needs a careful threshold.

Can deduplication remove information I need?

Yes, if the threshold is too loose. Two contracts that differ in one clause look nearly identical. Keep exact matching automatic and send fuzzy matches for review.

Does Exabase deduplicate memories?

Yes. Exabase Memory consolidates duplicate memories and resolves contradictions when new information is written, so the same fact is not stored many times.

Related pages: Stale knowledge, Incremental indexing, Knowledge base maintenance, Near-duplicate detection, Memory consolidation, Entity resolution, Source attribution, Knowledge base, Knowledge bases use case, Exabase vs Pinecone.

Cut your token spend and give your agent precise context.

Get started in minutes.

Cut your token spend and give your agent precise context.

Get started in minutes.