Abstract
In large-scale data mining, estimating Jaccard similarity between sets is a fundamental task. While $b$-bit minwise hashing is a standard approach, its precision degrades significantly when sets are highly similar. This paper introduces the Odd Sketch, a compact binary data structure that leverages XOR logic to focus on the symmetric difference between sets. By isolating the "signal" in the differences rather than the intersection, Odd Sketches achieve substantially lower mean squared error (MSE) and higher recall for Jaccard similarities exceeding 0.8.
Introduction
Calculating exact Jaccard similarity ($J$)—the ratio of the intersection to the union of two sets—is computationally prohibitive for massive datasets. Sketching techniques provide compact summaries to estimate $J$ efficiently. However, standard $b$-bit minwise hashing faces a "variance barrier" in high-similarity regimes: as $J$ approaches 1, sketches become nearly identical, and minor bit differences lead to large relative errors. We address this by proposing the Odd Sketch, specifically engineered for high-precision estimation of near-duplicates.
Methodology
The Odd Sketch is constructed by initializing a bit-vector of $n$ zeros. For each element in a set $S$, a hash function determines a position in the vector, and the corresponding bit is flipped ($0 \to 1$ or $1 \to 0$). Consequently, each bit indicates whether an odd number of elements mapped to that location.
A key property of the Odd Sketch is its linearity under XOR: $\text{odd}(S_1) \oplus \text{odd}(S_2) = \text{odd}(S_1 \Delta S_2)$. This allows the estimator to directly compute the sketch of the symmetric difference $S_1 \Delta S_2$. Using a Poisson approximation, the Jaccard similarity can be estimated from the fraction of "1" bits in the XORed sketch.
Results and Discussion
The Odd Sketch was evaluated against $b$-bit minwise hashing using synthetic and real-world datasets, including KOS blogs and Enron emails.
Accuracy in High-Similarity Regimes
For $J \ge 0.8$, the Odd Sketch consistently outperforms $b$-bit minwise hashing. As shown in Figure 5, the $-\log(\text{MSE})$ for the Odd Sketch increases sharply as $J$ approaches 1, indicating significantly lower error compared to various $b$-bit configurations ($b=1, 2, 4$).
Recall and Robustness
In web duplicate detection tasks on the KOS blog dataset, the Odd Sketch achieved approximately 15% higher recall than 1-bit minwise hashing at a similarity threshold of 0.85. The authors also identified a "sweet spot" for precision: the estimator is most accurate when the XORed sketch contains roughly 30% "1" bits. This allows practitioners to tune the number of permutations ($k$) to optimize for high-precision zones.
Conclusion
The Odd Sketch provides a powerful alternative to minwise hashing for applications requiring high precision at high similarities. While its performance degrades in low-similarity regimes due to bit saturation, its ability to isolate the symmetric difference makes it an ideal tool for duplicate detection and recommendation systems where near-identity is the primary signal of interest.
Summary updated