An Investigation of Practical Approximate Nearest Neighbor Algorithms

Ting Liu, Andrew W. Moore, Alexander G. Gray, Ke YangNeurIPS 2004

TL;DR

This paper introduces Spill Trees, a novel variation of metric trees that utilizes overlapping partitions to enable highly efficient approximate nearest neighbor (ANN) searches. By combining these structures with a "defeatist" (no-backtracking) search strategy and random projections, the authors achieve up to a 31-fold speedup over Locality Sensitive Hashing (LSH) while maintaining high accuracy.

The Problem: The Curse of Dimensionality

In fields like computer vision and pattern recognition, finding the "nearest neighbor" to a query point in a massive, high-dimensional dataset is a frequent and computationally demanding task. While exact search algorithms work well in low dimensions, they fall victim to the "curse of dimensionality" in high-dimensional spaces (e.g., 1,000+ dimensions). In these scenarios, traditional tree structures degrade, becoming no faster than a simple, exhaustive linear scan.

To solve this, researchers turn to Approximate Nearest Neighbor (ANN) algorithms, which trade a tiny fraction of accuracy for massive gains in speed. At the time of this research, Locality Sensitive Hashing (LSH) was the dominant approach. The authors pose a fundamental question: Can we adapt older, spatial data structures like metric trees to beat LSH at the approximate search game?

Methods: Introducing the Spill Tree

The authors propose key innovations to transform standard metric trees into high-performance ANN engines:

  1. Spill Trees (sp-trees): In a standard metric tree, a strict decision boundary splits data into two disjoint sets. If a query point lands near that boundary, the search algorithm often has to "backtrack" to the other side to ensure it hasn't missed the true nearest neighbor, which is computationally expensive. Spill trees solve this by introducing an overlapping buffer. Points near the boundary are "spilled" over and stored in both children.
Spill tree split with an overlapping buffer
  1. Defeatist Search: Because of the intentional overlap in spill trees, the algorithm can perform a "defeatist" search. It descends the tree exactly once and stops at the first leaf it hits, without ever backtracking. The overlapping buffer ensures that even if the query is near a boundary, the true neighbor is highly likely to already be present in the chosen child node.
  2. Hybrid Sp-Trees: Pure spill trees can become unbalanced or even infinite in depth if too many points fall into the overlapping region. To counter this, the authors introduce a balance threshold ($\rho$). If a split becomes too imbalanced, the node reverts to a standard, non-overlapping metric tree split. During a search, the algorithm only backtracks on these specific "non-overlapping" nodes, maintaining efficiency.
  3. Random Projections: To further combat high dimensionality, the authors utilize the Johnson-Lindenstrauss Lemma to project high-dimensional data into a lower-dimensional subspace before building the tree. This preserves relative distances with high probability while drastically reducing computational overhead.

Key Insights

  • Redundancy as a Feature: Traditionally, data redundancy in tree structures is seen as a flaw. Here, the "spill" (storing boundary points twice) is a deliberate, highly effective feature that eliminates the need for expensive backtracking.
  • The Backtracking Bottleneck: The authors observed that in exact searches, up to 95% of the time is spent simply verifying that the first candidate found is indeed the true nearest neighbor. Defeatist search on spill trees bypasses this bottleneck entirely.
  • Hybridization for Stability: The hybrid approach guarantees that the tree maintains a logarithmic depth ($O(\log n)$), ensuring predictable and fast search times regardless of the underlying data distribution.

Empirical Results

The authors evaluated their approach on five diverse, high-dimensional real-world datasets, including aerial texture features (60D), image color histograms (64D), disk-write traces (1,024D), and galaxy spectra (4,000D).

The empirical results demonstrated that Spill Trees consistently outperformed LSH, SR-trees, and standard metric trees across the board:

Performance comparison of Sp-tree against LSH and other trees on Aerial and Corel_hist datasets
  • Massive Speedups: On the Aerial dataset, Spill Trees were 23x to 31x faster than LSH for the same level of error.
  • High-Dimensional Scaling: Even on the massive 4,000-dimensional Galaxy dataset, Spill Trees provided a 12x speedup over LSH.
  • Consistent Performance: The performance lead held true across the entire spectrum of approximation levels (from 1% to 20% error).
  • Efficiency: While standard metric trees struggle as dimensions increase, the combination of spill trees and random projections allowed the researchers to maintain sub-linear search efficiency.

Limitations and Future Work

While highly effective, the approach has a few trade-offs:

  • Memory Overhead: Because points in the overlapping buffer are stored in multiple nodes, Spill Trees inherently require more memory than standard metric trees. The paper notes this but leaves a detailed analysis of the memory-speed trade-off for future work.
  • Parameter Sensitivity: Search performance depends heavily on choosing the right overlap size ($\tau$) and balance threshold ($\rho$). Finding the optimal values for a completely new dataset might require empirical tuning.

Summary updated

BibTeX
@inproceedings{liu2004investigation,
  author = {Ting Liu and Andrew W. Moore and Alexander G. Gray and Ke Yang},
  title = {{An Investigation of Practical Approximate Nearest Neighbor Algorithms}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2004},
}
Figure