Unsupervised Multi-Index Semantic Hashing

Christian Hansen, Casper Hansen, Jakob Grue Simonsen, Stephen Alstrup, Christina LiomaarXiv 2021 · DOI

TL;DR

MISH (Multi-Index Semantic Hashing) is a novel unsupervised model that learns document hash codes optimized specifically for the efficiency of multi-index hashing (MIH). By introducing two model-agnostic training objectives, MISH achieves state-of-the-art retrieval effectiveness while being over 33% faster than existing semantic hashing methods.

What Problem Does This Paper Address?

Similarity search—finding items similar to a query—is a cornerstone of modern information retrieval. Semantic hashing speeds this up by representing complex documents as compact binary "hash codes." In this space, the Hamming distance (the number of differing bits) serves as the similarity metric.

While Hamming distance calculations are fast, performing a "brute-force" linear scan across millions of documents is still computationally expensive. A common alternative is Multi-Index Hashing (MIH), which splits hash codes into substrings to enable sub-linear search times. However, the efficiency of MIH is highly sensitive to how these bits are distributed.

Until now, researchers focused almost exclusively on effectiveness (how accurate the search results are) while ignoring the efficiency of the underlying search strategy. Most existing models produce hash codes that, when used with MIH, result in large candidate sets and slow search times. MISH bridges this gap by explicitly optimizing hash codes for MIH efficiency during training.

Methods

MISH is built on a Variational Autoencoder (VAE) architecture, utilizing a pairwise reconstruction loss to ensure that semantically similar documents have similar hash codes. The core innovation lies in two new, model-agnostic training objectives:

  1. Reducing False Positives ($L_{false-positive}$): MIH works by looking up documents that match at least one substring of the query. If a document matches a substring but is far away in the full Hamming space, it's a "false positive" that wastes processing time. MISH derives an objective to push these false positive substrings apart.
  2. Controlling Search Radius ($L_{radius}$): For k-nearest neighbor (kNN) search, the number of hash table lookups grows exponentially as the search radius increases. MISH includes a loss that minimizes the Hamming distance to the $k$-th closest neighbor, keeping the required search radius small and the lookups minimal.

These objectives are differentiable and can be plugged into almost any existing semantic hashing model to improve its search efficiency.

Datasets

The authors evaluated MISH on three standard document benchmarks:

  • TMC: Multi-class air traffic reports (28,596 documents).
  • Reuters: Multi-class news documents (9,848 documents).
  • Agnews: Single-class news documents (127,598 documents).
Table 1: Dataset statistics.

Key Insights and Ideas

  • Efficiency is not a "Free Lunch": Simply applying MIH to existing hash codes isn't enough. The distribution of bits across substrings matters immensely. MISH shows that you can explicitly train for this distribution.
  • Effectiveness vs. Efficiency Trade-off: While there is a slight trade-off, MISH demonstrates that you can achieve massive efficiency gains with negligible impact on retrieval accuracy.
  • Model Agnosticism: The proposed loss functions aren't tied to the MISH architecture. They can be integrated into other popular models like NASH or PairRec to boost their performance in real-world, large-scale systems.
  • End-to-End beats Heuristics: Traditional methods sometimes use post-hoc bit reordering (like Greedy Substring Optimization) to improve MIH. MISH proves that optimizing this during the learning phase is significantly more effective.

Key Results

MISH consistently outperformed state-of-the-art baselines in both speed and accuracy.

  • Speedup: MISH achieved significantly higher speedups over linear scans compared to all baselines. On average, baselines were at least 33% slower than MISH when using multi-index hashing.
  • Effectiveness: MISH maintained or improved upon state-of-the-art Precision@100. It was particularly strong in "worst-case" precision, meaning it produces fewer ties and more distinct rankings.
Figure 1: Method comparison relative to our proposed MISH, averaged over all used datasets. We plot each method as a point regarding its mean speedup of multi-index hashing compared to a linear scan, as well as mean prec@100, rel- ative to MISH.

The impact of the new hyperparameters ($\alpha_1$ for false positives and $\alpha_2$ for search radius) is clearly visible in the heatmaps below. Increasing these values leads to dramatic speedups, though very high values eventually begin to prune the precision.

Figure 3: Hyperparameter impact on speedup and prec@100: 𝛼1 reduces the number of documents per hash table lookup, and 𝛼2 controls the number of such lookups.

Limitations and Future Work

The current work focuses on unsupervised hashing. The authors acknowledge that incorporating label information (supervised hashing) could further refine the candidate sets by ensuring that even fewer irrelevant documents are retrieved during the MIH process. Future work will explore these supervised extensions and the impact of these efficiency objectives on other data types, such as images.

Summary updated

BibTeX
@misc{hansen2021unsupervised,
  author = {Christian Hansen and Casper Hansen and Jakob Grue Simonsen and Stephen Alstrup and Christina Lioma},
  title = {{Unsupervised Multi-Index Semantic Hashing}},
  year = {2021},
  eprint = {2103.14460},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2103.14460},
}
Figure