Fast nearest neighbor search through sparse random projections and voting

Ville Hyvönen, Teemu Pitkänen, Sotiris K. Tasoulis, Elias Jaasaari, Risto Tuomainen, Liang Wang, Jukka Corander, Teemu Roos

Abstract

Approximate Nearest Neighbor (ANN) search in high-dimensional spaces is a critical challenge for modern data-driven applications. This paper introduces MRPT (Multiple Random Projection Trees), an algorithm that leverages sparse random projections and a novel voting scheme to achieve significant speedups. By utilizing level-wise shared projections and optimized linear algebra libraries, MRPT provides a memory-efficient solution that excels at high recall levels, particularly in very high-dimensional datasets.

Introduction

Finding the $k$ closest points to a query in a massive dataset—known as $k$-Nearest Neighbor ($k$-NN) search—is a fundamental task in recommendation systems, computer vision, and information retrieval. However, as dimensionality ($d$) grows, traditional methods often fall victim to the "curse of dimensionality," where exact search becomes no more efficient than a brute-force linear scan. Existing approximate methods, like Locality-Sensitive Hashing (LSH) or standard $k$-d trees, often suffer from high memory usage or slow response times when pushed to high accuracy levels (e.g., >90% recall). MRPT aims to provide a method that is fast, memory-efficient, and easy to implement using standard linear algebra libraries.

Methodology

MRPT improves upon classic Random Projection (RP) trees through three key innovations:

  1. Sparse Random Projections: Instead of using dense Gaussian vectors to split the data, MRPT uses sparse vectors where most components are zero. This reduces the computational cost of projecting data points and shrinks the index size.
  2. Level-Wise Shared Projections: In a standard RP tree, every node has its own random vector. MRPT uses a single projection vector for all nodes at the same level of the tree. This allows the algorithm to batch projections into large matrix-matrix multiplications, leveraging highly optimized BLAS libraries and CPU cache effects.
  3. Voting Search: Instead of simply looking at all points in the leaves where a query point lands, MRPT counts how many trees (out of $T$ total) contain a specific data point in the same leaf as the query. Only points that appear in at least $v$ trees (the "vote threshold") are considered for the final expensive distance calculation. This drastically prunes the candidate set without losing true neighbors.

Experimental Evaluation

The algorithm was evaluated on seven diverse datasets representing different types of high-dimensional data, including image descriptors (GIST, SIFT), text data (News), and high-dimensional image recognition data (STL-10).

Performance comparison of MRPT (red line) against state-of-the-art ANN algorithms across six datasets. MRPT consistently achieves lower query times at high recall levels.

Key Results

  • Superior Speed at High Recall: MRPT was the fastest algorithm in 14 out of 21 test cases for recall levels $\geq 90\%$. On real-world datasets, it was 25–100x faster than brute-force search at 90% recall.
  • High-Dimensional Scaling: The performance gap between MRPT and other methods was most pronounced in very high-dimensional spaces. On the 9216-dimensional STL-10 dataset, MRPT maintains a significant lead over competing methods as recall approaches 1.0.
Detailed performance on the 9216-dimensional STL-10 dataset, where MRPT shows a significant advantage at high recall.
  • Hardware-Friendly Design: By using shared projections and sparse matrices, the bottleneck is moved from random memory access to structured matrix operations, allowing the algorithm to benefit from modern CPU optimizations like vectorization.

Discussion and Limitations

While MRPT excels at high recall, graph-based methods like KGraph often remain faster at low accuracy requirements (e.g., <80% recall) because they can navigate the data manifold more directly. Additionally, the performance of MRPT depends on several parameters (number of trees, depth, vote threshold, and sparsity). While grid search was used for these experiments, finding the optimal balance automatically for new datasets remains a challenge. Future work may also include a more detailed time complexity analysis for the voting scheme across various data distributions.

Summary updated

BibTeX
@inproceedings{hyvonen2016fast,
  author = {Ville Hyvönen and Teemu Pitkänen and Sotiris K. Tasoulis and Elias Jaasaari and Risto Tuomainen and Liang Wang and Jukka Corander and Teemu Roos},
  title = {{Fast nearest neighbor search through sparse random projections and voting}},
  booktitle = {IEEE BigData},
  year = {2016},
  doi = {10.1109/bigdata.2016.7840682},
}
Figure