Consensus hashing

Cong Leng, Jian Cheng

Abstract

Approximate Nearest Neighbor (ANN) search is a cornerstone of large-scale data retrieval, with hashing serving as a primary technique for generating compact, searchable binary codes. However, individual hashing algorithms often struggle with inconsistent results due to varying data assumptions or random initializations. This paper introduces Consensus Hashing (CH), an ensemble learning framework that aggregates multiple hashing outputs into a single, optimized binary representation. By prioritizing the consensus of pairwise similarities over direct bit-matching, CH effectively fuses complementary information, resulting in significant improvements in search accuracy, memory efficiency, and robustness across diverse datasets.

Introduction

The explosion of massive datasets has made efficient similarity search a critical challenge. Hashing algorithms address this by mapping high-dimensional data into short binary strings, enabling rapid comparisons using Hamming distance. Despite their utility, traditional methods like Spectral Hashing or Anchor Graph Hashing often rely on rigid geometric assumptions that may not hold for complex, real-world data.

Furthermore, different hashing techniques—or even the same technique with different parameters—frequently produce inconsistent codes for identical data points. Consensus Hashing (CH) addresses this by treating hashing as an ensemble problem. The goal is to synthesize a "consensus" code that outperforms any individual input, effectively capturing the underlying structure of the data more accurately than any single model could alone.

The Consensus Hashing Framework

The primary hurdle in combining hashing results is that two functionally identical codes might appear different (e.g., bit-flipped versions). CH overcomes this by focusing on the Connectivity Matrix. Instead of comparing bits directly, the method evaluates how "connected" pairs of points are within the Hamming space across all input hashing results.

Overview of the Consensus Hashing (CH) framework, illustrating the aggregation of multiple hashing outputs into a unified representation.

Two-Step Optimization

The CH objective is to find a consensus code whose connectivity matrix aligns with the average of the input matrices. This is achieved through a two-step process:

  1. Continuous Representation via MDS: The problem is first relaxed into a Multidimensional Scaling (MDS) task. To ensure scalability to millions of points, the Nyström technique is employed, approximating the solution using a small data subset and reducing training time to a linear relationship with dataset size.
  2. Binary Code Learning: The continuous values are converted into binary codes by solving a linear regression problem. An Orthogonal Procrustes (OP) rotation is applied to ensure the resulting bits are balanced and carry maximal information.

Experimental Evaluation

The authors validated CH on four major benchmarks: Tiny-100K, CIFAR10, GIST-1M, and the multi-view NUSWIDE dataset. The multi-view experiments were particularly telling, as CH successfully fused disparate feature types (e.g., color histograms and wavelet textures) into a single high-performance code.

Performance comparison showing Mean Average Precision (MAP) across different bit lengths for CH and competing state-of-the-art methods.

Key Results

  • Superior Accuracy: CH consistently outperformed state-of-the-art methods such as ITQ and AGH. In many scenarios, CH achieved higher Mean Average Precision (MAP) with 64 bits than competitors did with 128 bits.
  • Enhanced Compactness: The method provides approximately two times more compact representations, allowing for the same search precision with half the memory footprint.
  • Computational Efficiency: Despite its ensemble nature, CH remains fast. On the Tiny-100K dataset, training completed in seconds, significantly faster than complex manifold-based alternatives.

Discussion and Future Work

A significant insight of this work is that even "weak" hashers, such as those based on random projections (LSH), can be dramatically improved when combined via CH. This makes the framework highly versatile for boosting existing systems.

Currently, CH assigns equal weight to all input hashing results. A promising avenue for future research is the development of a weighted consensus scheme. Such a model would automatically learn to prioritize more accurate or informative hashers, potentially further refining the quality of the final binary representation.

Conclusion

Consensus Hashing represents a shift from searching for the "perfect" single hashing algorithm to leveraging the collective intelligence of multiple models. By focusing on similarity relationships rather than raw bits, CH provides a robust, efficient, and scalable solution for modern large-scale retrieval tasks.

Summary updated

BibTeX
@article{leng2015consensus,
  author = {Cong Leng and Jian Cheng},
  title = {{Consensus hashing}},
  journal = {Machine Learning},
  year = {2015},
  doi = {10.1007/s10994-015-5496-x},
}
Figure