Associative Memories to Accelerate Approximate Nearest Neighbor Search

Vincent Gripon, Matthias Löwe, Franck VermetarXiv 2016 · arXiv

Introduction

In the era of large-scale data processing, finding the "closest" match to a query—whether it is a similar image, a related document, or a specific customer profile—has become a significant computational bottleneck. As datasets grow in both cardinality ($n$) and dimensionality ($d$), traditional search methods struggle to maintain efficiency. In their paper, "Associative Memories to Accelerate Approximate Nearest Neighbor Search," Vincent Gripon, Matthias Löwe, and Franck Vermet propose a novel approach inspired by neural network architectures. By utilizing associative memories, they provide a method to quickly identify promising neighborhoods in high-dimensional space, effectively bypassing the need for exhaustive global searches.

Nearest Neighbor (NN) search is a fundamental operation in machine learning, underpinning tasks from classification to object retrieval. The canonical complexity for an exhaustive search is $O(nd)$. To mitigate this, existing Approximate Nearest Neighbor (ANN) techniques typically focus on two strategies: reducing dimensionality $d$ (e.g., via Product Quantization or Hashing) or reducing the number of vectors $n$ (e.g., via tree-based spatial partitioning).

However, tree-based methods often succumb to the "curse of dimensionality," where their performance degrades as $d$ increases. This paper addresses the $n$ problem using associative memories based on the Hopfield model. Instead of treating the dataset as a flat list, the authors partition it into classes that are stored collectively, allowing the system to "poll" these memories to find the most relevant subset of data.

Methodology: Neural Associative Memories

The proposed method involves a three-step process: storage, scoring, and searching.

1. Storage

The collection of $n$ vectors is divided into $q$ equal-sized classes, each containing $k$ vectors. Unlike a standard database that stores vectors individually, each class is represented within an associative memory. This memory uses a weight matrix or similar structure to represent the aggregate information of the group.

2. The Score Function

When a query vector $x^0$ is presented, the system computes a score for each class $\mathcal{X}^i$. This score is derived from a quadratic form:

$$s(\mathcal{X}^i, x^0) = \sum_{\mu:x^\mu \in \mathcal{X}^i} \sum_{l,m=1}^d x^0_l x^0_m x^\mu_l x^\mu_m$$

This function measures the overlap between the query and the collective memory of the class. It allows the system to rank classes based on their likelihood of containing the true nearest neighbor.

The system identifies the class with the highest score and performs an exhaustive search only within that specific subset. This significantly reduces the number of distance computations required.

Theoretical Foundations

The authors provide rigorous mathematical proofs demonstrating the asymptotic correctness of this approach. For both sparse binary data and unbiased random $\pm1$ distributions, the probability of error drops toward zero as the dimensionality $d$ increases, provided that the relationship $d \ll k \ll d^2$ is maintained. This is a critical finding: unlike many algorithms that fail in high dimensions, this method’s accuracy actually improves as $d$ grows.

Experimental Evaluation

The authors validated their approach using a mix of synthetic and real-world benchmarks:

  • Synthetic Data: Used to confirm theoretical bounds on error probability.
  • MNIST: 60,000 handwritten digit images (784 dimensions). The authors found that "smart allocation"—grouping similar vectors into the same class—significantly boosted performance compared to random partitioning.
  • Santander Customer Satisfaction: A Kaggle dataset (369 dimensions) used to test performance on non-image tabular data.
  • SIFT1M & GIST1M: Standard large-scale ANN benchmarks containing 1 million vectors each. On these datasets, the authors demonstrated that combining associative memories with Random Sampling (RS) can create a hybrid architecture that outperforms either method in isolation.

Key Insights and Discussion

One of the most compelling aspects of this research is the reversal of the curse of dimensionality; the method leverages high dimensionality to improve retrieval precision. Furthermore, the complexity of the initial polling phase depends on the number of classes ($q$) rather than the number of vectors per class ($k$), suggesting that the system is most efficient when utilizing many small, specialized classes.

However, the approach does introduce a memory overhead. Storing associative matrices can be more memory-intensive than storing raw vectors, particularly if the matrices are dense. This presents a trade-off between computational speed and memory consumption.

Conclusion and Future Work

This paper introduces a promising neural-inspired framework for accelerating ANN search. By shifting the search problem from individual vectors to collective associative memories, the authors provide a scalable solution for high-dimensional datasets. Future research directions include developing "smart pooling" techniques to identify neighbors directly from the memory poll, implementing hierarchical partitioning for even larger datasets, and refining clustering techniques for more effective vector allocation.

Summary updated

Abstract

Nearest neighbor search is a very active field in machine learning for it appears in many application cases, including classification and object retrieval. In its canonical version, the complexity of the search is linear with both the dimension and the cardinal of the collection of vectors the search is performed in. Recently many works have focused on reducing the dimension of vectors using quantization techniques or hashing, while providing an approximate result. In this paper we focus instead on tackling the cardinal of the collection of vectors. Namely, we introduce a technique that partitions the collection of vectors and stores each part in its own associative memory. When a query vector is given to the system, associative memories are polled to identify which one contain the closest match. Then an exhaustive search is conducted only on the part of vectors stored in the selected associative memory. We study the effectiveness of the system when messages to store are generated from i.i.d. uniform $\pm$1 random variables or 0-1 sparse i.i.d. random variables. We also conduct experiment on both synthetic data and real data and show it is possible to achieve interesting trade-offs between complexity and accuracy.
BibTeX
@misc{gripon2016associative,
  author = {Vincent Gripon and Matthias Löwe and Franck Vermet},
  title = {{Associative Memories to Accelerate Approximate Nearest Neighbor Search}},
  year = {2016},
  eprint = {1611.05898},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1611.05898},
}
Figure