TECHNOLOGY

MinHash dataset deduplication: shingles, sketch compatibility and LSH candidates

In this article
THE QUICK TAKE

MinHash estimates similarity between chosen sets; an LSH lookup proposes candidates that still need an explicit acceptance rule.

Shingles define the set being compared

A document can be represented as a set of word sequences or character sequences. Changing that unit changes the Jaccard similarity that MinHash approximates. A word-based representation can respond very differently to tokenization, punctuation or mixed writing systems from a character-based representation.

Write down normalization and shingle construction before interpreting a similarity score. Repeated occurrences disappear in a set representation, so the resulting score does not directly preserve term frequency or document structure. It answers a deliberately narrower question about shared set elements.

A signature is an approximation

The datasketch API exposes the number of permutations, seed and hash configuration. More signature entries change the approximation budget and storage cost. They do not repair a poorly chosen text representation or turn lexical overlap into semantic equivalence.

Keep construction metadata with persisted signatures. A later process must reproduce compatible sketches before comparing them. Treat a corpus migration as a representation migration if its tokenizer, shingle policy or hash behavior changes, even when the stored document identifiers remain stable.

Library revisions can change compatibility

Current datasketch documentation distinguishes affine and legacy permutation schemes. The scheme is part of compatibility: signatures created under different schemes cannot simply be compared or merged. Raw hash values do not explain which construction produced them.

Pin the library revision and retain the scheme explicitly when restoring stored values. An index rebuilt from old signatures needs a deliberate compatibility decision rather than an assumption that equal array lengths imply equivalent statistics. Check installed-version documentation before copying examples from another release.

LSH returns a probabilistic candidate set

MinHash LSH trades exhaustive comparison for a banded index. Its threshold shapes retrieval probability; false positives and false negatives remain possible. Increasing signature size or changing the threshold can alter the candidate population without establishing a universal duplicate boundary.

Apply a declared post-filter to candidates, such as exact Jaccard on the original shingle sets when that cost is acceptable. This removes returned candidates that fail the acceptance rule. It does not recover qualifying pairs that the candidate stage failed to retrieve.

Evaluate the pipeline at the document level

A proposed validation should include known duplicates, layout variants and related documents that must remain separate. Measure candidate recall separately from the precision of final removals. Otherwise a clean-looking retained corpus can hide missed pairs, or aggressive deletion can look like better coverage.

Retain cluster membership and the selected representative’s provenance. Report the shingle policy, sketch parameters, index revision and acceptance rule together. These details let another team interpret the result without treating an approximate search setting as a proof of document equivalence.

Primary references

datasketch MinHash guide.

datasketch MinHash LSH.

datasketch API reference.

Related explanations: Deduplication and memorization; Document provenance.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles