Embedding search returns a similarity score for each match, and a threshold decides which matches count as near-duplicates. Too low a threshold flags different documents as duplicates, while too high a threshold misses real copies. Test the threshold on pairs you already know, then set it between the two groups.
Checked on 2026-11-29. We did not run any tool for this guide. Every result below is an expected result, marked UNTESTED, for you to confirm on your own files.
Prerequisites
- A set of documents with some known near-duplicates
- An embedding model and a way to score pairs
- A list of pairs you know are different, for contrast
Steps
1. Score known duplicate pairs
Embed five pairs you know are near-duplicates and record each similarity score.
Expected result: Five duplicate scores exist, for example from 0.91 to 0.97.
2. Score known different pairs
Embed five pairs you know are different and record each score.
Expected result: Five different scores exist, for example from 0.42 to 0.68.
3. Pick a threshold between the groups
Choose a number above the highest different score and below the lowest duplicate score.
Expected result: A threshold is written down, for example 0.80.
4. Test the threshold on new pairs
Run ten new pairs through the threshold and check the flags by hand.
Expected result: Ten pairs are checked by hand, with any wrong flag noted.
Worked example
A practice set scored five duplicate pairs and five different pairs. The groups did not overlap.
| Pair type | Lowest score | Highest score |
|---|---|---|
| Near-duplicates | 0.91 | 0.97 |
| Different docs | 0.42 | 0.68 |
Expected result: Duplicates score 0.91 to 0.97 and different docs 0.42 to 0.68, so a threshold of 0.80 separates them (UNTESTED – confirm it yourself.)
Verdict table
| Check | Expected result | Pass? |
|---|---|---|
| Score known duplicate pairs | Five duplicate scores exist, for example from 0.91 to 0.97. | – |
| Score known different pairs | Five different scores exist, for example from 0.42 to 0.68. | – |
| Pick a threshold between the groups | A threshold is written down, for example 0.80. | – |
| Test the threshold on new pairs | Ten pairs are checked by hand, with any wrong flag noted. | – |
Limits
- The threshold depends on the embedding model; a number that works for one model may fail for another.
- Short documents score higher by chance, so test short pairs too.
Sources
- RAG Evaluation with Ragas – checked 2026-11-29
- RAG Evaluation with RAGAS: Measuring Faithfulness, Context Precision, and Recall in Production – checked 2026-11-29
- RAG Evaluation Metrics (NVIDIA NeMo Helix docs) – checked 2026-11-29
