Introduction
The $r$-near neighbors reporting ($r$NNR) problem is fundamental to high-dimensional similarity search. Given a query point, the goal is to retrieve all points in a dataset within a distance $r$. While Locality-Sensitive Hashing (LSH) is the standard solution for sub-linear search, its performance is notoriously inconsistent across different data distributions.
The LSH Bottleneck
LSH functions by hashing similar points into the same buckets. However, in dense regions of high-dimensional space, a query can collide with a massive number of points across multiple hash tables. The computational overhead of merging these results and removing duplicates often exceeds the time required for a simple brute-force linear scan. This "dirty secret" of LSH means that in certain scenarios, the specialized index is actually slower than no index at all.
The Hybrid LSH Approach
To address this, the "Hybrid LSH" algorithm introduces a dynamic switching mechanism. By integrating HyperLogLog (HLL) structures—probabilistic estimators for set cardinality—directly into the LSH hash tables, the system can predict the cost of a query in real-time.
Methodology
- Augmented Indexing: Each LSH bucket is equipped with a small HLL register (typically 32–128 bits) to track unique point IDs during the construction phase.
- Cost Estimation: At query time, the algorithm identifies the relevant buckets across all $L$ hash tables and merges their HLL registers. This provides a fast, memory-efficient estimate of the total number of unique candidates ($candSize$).
- Adaptive Execution: The algorithm compares the estimated LSH processing cost against the cost of a linear scan ($O(n)$). If LSH is predicted to be slower due to high collision density, the system automatically defaults to a brute-force search.
Experimental Evaluation
The hybrid strategy was tested on four diverse datasets representing different distance metrics: MNIST (Hamming), Webspam (Cosine), CoverType (L1), and Corel (L2).
Performance Results
The results demonstrate that Hybrid LSH consistently achieves the "best of both worlds." It tracks the performance of pure LSH in sparse regions and seamlessly transitions to linear search in dense regions where LSH would otherwise fail.
Key findings include:
- Efficiency: The HLL estimation overhead is minimal, typically accounting for less than 4% of total query time.
- Accuracy: Despite its probabilistic nature, HLL provides candidate size estimates with a relative error of only 6-7%.
- Robustness: The system handles varying data densities without requiring manual parameter tuning for different search radii.
Conclusion
Hybrid LSH provides a robust framework for high-dimensional search by acknowledging that no single algorithm is optimal for all data distributions. By leveraging memory-efficient probabilistic structures, it ensures that similarity search remains efficient even in the most challenging "dense" scenarios. Future work may extend this logic to multi-probe LSH schemes and guaranteed exact reporting.
Summary updated