[Paper Review] A Revisit of Hashing Algorithms for Approximate Nearest Neighbor Search
This paper revisits hashing algorithms for approximate nearest neighbor search (ANNS) by proposing a novel grouped Hamming ranking method for hash index search. Surprisingly, random-projection-based Locality Sensitive Hashing (LSH) outperforms ten advanced data-dependent hashing algorithms across multiple datasets when code lengths are extended to 1,024 or 2,048 bits, challenging prior claims of superiority by newer methods.
Approximate Nearest Neighbor Search (ANNS) is a fundamental problem in many areas of machine learning and data mining. During the past decade, numerous hashing algorithms are proposed to solve this problem. Every proposed algorithm claims outperform other state-of-the-art hashing methods. However, the evaluation of these hashing papers was not thorough enough, and those claims should be re-examined. The ultimate goal of an ANNS method is returning the most accurate answers (nearest neighbors) in the shortest time. If implemented correctly, almost all the hashing methods will have their performance improved as the code length increases. However, many existing hashing papers only report the performance with the code length shorter than 128. In this paper, we carefully revisit the problem of search with a hash index, and analyze the pros and cons of two popular hash index search procedures. Then we proposed a very simple but effective two level index structures and make a thorough comparison of eleven popular hashing algorithms. Surprisingly, the random-projection-based Locality Sensitive Hashing (LSH) is the best performed algorithm, which is in contradiction to the claims in all the other ten hashing papers. Despite the extreme simplicity of random-projection-based LSH, our results show that the capability of this algorithm has been far underestimated. For the sake of reproducibility, all the codes used in the paper are released on GitHub, which can be used as a testing platform for a fair comparison between various hashing algorithms.
Motivation & Objective
- To re-evaluate the performance of popular hashing algorithms for approximate nearest neighbor search (ANNS) under fair and comprehensive conditions.
- To address the lack of thorough evaluation in prior hashing papers, particularly the limited code length (often <128 bits) and reliance on inefficient Hamming ranking in MATLAB.
- To propose a new two-level hash index structure and a grouped Hamming ranking search procedure to enable fair and efficient comparison across hashing algorithms.
- To benchmark random-projection-based LSH against state-of-the-art ANNS methods, including tree-based, quantization-based, and graph-based approaches, under identical conditions.
- To provide a reproducible, open-source testing platform via GitHub for fair benchmarking of future hashing algorithms.
Proposed method
- Proposes a two-level hash index structure to improve search efficiency and fairness in comparison.
- Introduces a grouped Hamming ranking approach that aggregates results from multiple hash tables to improve recall without increasing code length.
- Converts the original MATLAB-based LSH implementation into optimized C++ code (named RPLSH) for fair performance comparison.
- Employs a systematic evaluation framework using recall vs. code length and recall vs. search time curves across large-scale datasets (SIFT1M, GIST1M).
- Uses the same hardware and single-threaded execution for all algorithms to ensure fair comparison.
- Compares RPLSH against five established ANNS libraries: FALCONN, FLANN, Annoy, FAISS, and KGraph, using tuned parameters for high recall.
Experimental results
Research questions
- RQ1Does random-projection-based LSH remain competitive with modern data-dependent hashing algorithms when evaluated under fair and comprehensive conditions?
- RQ2How does the performance of hashing algorithms scale with increasing code length beyond the commonly used 128 bits?
- RQ3Which hash index search procedure—Hamming ranking or hash bucket search—yields better performance and fairness in evaluation?
- RQ4Can a simple, data-independent method like random-projection LSH outperform complex, data-dependent hashing algorithms when implemented correctly?
- RQ5How does RPLSH compare to other state-of-the-art ANNS methods (e.g., tree-based, quantization-based, graph-based) in terms of recall and speed at high recall levels?
Key findings
- Random-projection-based LSH (RPLSH) achieves the best performance on both SIFT1M and GIST1M when code length is increased to 1,024 or 2,048 bits, outperforming ten other hashing algorithms.
- On SIFT1M, RPLSH achieves the highest recall (over 99%) and is second-best at lower recall levels; on GIST1M, it is the best performer when recall exceeds 90%.
- RPLSH significantly outperforms FALCONN, another LSH-based method, due to its use of grouped Hamming ranking instead of multi-table hash bucket search.
- Tree-based methods (FLANN, Annoy) perform well on low-dimensional data but degrade on high-dimensional data, while FAISS (product quantization) cannot achieve high recall due to approximation.
- KGraph, a graph-based method, is outperformed by RPLSH on GIST1M at high recall, contradicting claims that LSH is inherently slow or inaccurate.
- The study demonstrates that the performance of most hashing algorithms improves with longer code lengths, but many prior works fail to explore this due to arbitrary code length limits.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.