NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Compressed Hashing

Yue Lin, Rong Jin, Deng Cai, Shuicheng Yan, Xuelong Li

Abstract

Nearest Neighbor (NN) search in high-dimensional spaces is a cornerstone of modern machine learning, yet it remains computationally challenging. This paper presents Compressed Hashing (CH), a novel framework that integrates sparse coding with compressed sensing. By transforming data into sparse representations and applying the Restricted Isometry Property (RIP), CH achieves a hashing scheme where accuracy scales with code length independently of the database size. Experimental results on SIFT1M and GIST1M benchmarks demonstrate that CH significantly outperforms state-of-the-art data-independent and learning-based hashing algorithms.

Introduction

Approximate Nearest Neighbor (ANN) search often relies on hashing to map high-dimensional vectors into compact binary strings. However, existing approaches face a fundamental trade-off. Data-independent methods, such as Locality Sensitive Hashing (LSH), require code lengths to grow logarithmically with the dataset size ($O(\ln n)$) to maintain precision, leading to inefficiency in massive databases. Conversely, learning-based methods like Spectral Hashing perform well with short codes but often plateau or degrade as code length increases, failing to capture additional data variance.

Compressed Hashing addresses these issues by leveraging the mathematical strengths of compressed sensing to ensure robust distance preservation that is independent of the total number of data points.

Methodology

The CH pipeline consists of three primary stages:

  1. Sparse Coding via RBF Kernels: To utilize compressed sensing theory, the input data must be sparse. The authors employ an anchor-based approach, selecting $m$ anchor points via k-means. Each data point is represented by its similarity to its $s$ nearest anchors using a Radial Basis Function (RBF) kernel, resulting in a high-dimensional but sparse vector.
  2. Compressed Sensing Projection: Instead of standard random projections, the method applies the Restricted Isometry Property (RIP). RIP ensures that for sparse vectors, a random projection preserves Euclidean distances with high probability. Crucially, the number of required projections depends on the sparsity level, not the dataset size $n$.
  3. Binary Encoding: The resulting projected values are binarized by thresholding against their median values to produce the final hash code.

Theoretical Insights

The core innovation of CH lies in the transition from the Johnson-Lindenstrauss (JL) Lemma to the Restricted Isometry Property. While the JL Lemma suggests that more bits are needed as a database grows, RIP demonstrates that if data is sparse, distance preservation is a property of the projection matrix itself. By enforcing sparsity through anchor-based coding, CH creates a bridge that allows hashing to benefit from the efficiency of compressed sensing. Furthermore, unlike PCA-based methods that lose information in low-variance directions, CH's random projections distribute information across all bits, allowing performance to improve steadily with code length.

Key Results

The authors evaluated CH on two standard benchmarks: SIFT1M (1 million 128D features) and GIST1M (1 million 960D features).

Accuracy and Scaling

Compressed Hashing consistently achieved higher Mean Average Precision (MAP) than competitors, including Anchor Graph Hashing (AGH), Spectral Hashing (SpH), and LSH. Notably, as code length increased from 16 to 96 bits, CH maintained a significant upward performance trend, whereas methods like PCAH saw performance declines.

Mean Average Precision (MAP) vs. Code Length on SIFT1M and GIST1M datasets.

Computational Efficiency

While the sparse coding step introduces some overhead, the overall training time for CH remains lower than complex alternatives like AGH. Query times are approximately $50-70 \times 10^{-6}$ seconds, which is slightly slower than LSH but well within the requirements for real-time applications.

Training and test time comparisons for various hashing methods.

Conclusion

Compressed Hashing provides a robust solution for large-scale ANN search by combining the representational power of sparse coding with the theoretical guarantees of compressed sensing. While the method's performance depends on anchor selection and hyperparameter tuning, its ability to scale effectively with code length makes it a superior choice for high-dimensional datasets. Future work may explore more sophisticated anchor selection techniques to further enhance the sparse coding stage.

Summary updated

BibTeX
@inproceedings{lin2013compressed,
  author = {Yue Lin and Rong Jin and Deng Cai and Shuicheng Yan and Xuelong Li},
  title = {{Compressed Hashing}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2013},
  doi = {10.1109/cvpr.2013.64},
}
Figure