Abstract
In large-scale information retrieval, semantic hashing is essential for transforming high-dimensional document representations into compact, searchable binary codes. However, existing unsupervised hashing methods often treat semantic spaces as "flat," failing to capture the inherent hierarchical relationships present in real-world data. We introduce HierHash, an unsupervised framework that integrates hierarchical structures into a Variational Auto-Encoder (VAE) pipeline. By employing multi-grained prototypes and hierarchical contrastive learning, HierHash organizes the latent space into nested clusters, significantly improving retrieval precision. Our experiments on benchmark datasets like NYT and DBpedia show that HierHash consistently outperforms state-of-the-art baselines across various bit lengths.
Introduction
Semantic hashing maps documents into a low-dimensional Hamming space, where similarity is measured by bit differences. This allows for extremely fast retrieval in massive datasets. A significant limitation of current unsupervised methods is their inability to model multi-layered semantic relationships. For instance, while a model might recognize that two articles belong to "Sports," it may fail to preserve the nuance that "Basketball" and "Football" are more closely related to each other than either is to "Stocks."
As shown in Figure 1, real-world data is naturally hierarchical. HierHash addresses this by modeling these relationships without requiring expensive, manually labeled hierarchical datasets, filling a critical gap in unsupervised semantic hashing.
The HierHash Framework
HierHash enhances the standard VAE-based hashing pipeline with three core innovations designed to capture multi-grained semantics:
- Multi-Grained Prototypes: The model learns representative vectors (prototypes) for both coarse-grained and fine-grained categories within the latent space. Fine-grained prototypes are mathematically encouraged to cluster around their corresponding coarse-grained "parent" prototypes, establishing a hierarchical prior distribution.
- Hierarchical Contrastive Learning: To maintain semantic detail, the framework utilizes contrastive learning based on the model’s own "pseudo-labels." Angular normalization is applied to ensure that documents within the same coarse category maintain distinct fine-grained features, preventing semantic collapse.
- Hierarchical Self-Labeling: As training progresses, the model identifies high-confidence pseudo-labels to serve as "ground truth," refining the hash codes in a semi-supervised manner.
The system utilizes [CLS] token embeddings from a pre-trained BERT model as input, providing a robust initial understanding of linguistic context.
Experimental Results
We evaluated HierHash on three benchmarks: the New York Times (NYT) dataset, DBpedia, and AGNews. HierHash consistently outperformed state-of-the-art baselines, including VDSH, NASH, and DHIM.
Key Performance Metrics
- Precision Gains: On the DBpedia dataset, which features a deep hierarchy (9 coarse and 70 fine-grained categories), HierHash improved retrieval precision (P@100) by up to 7.30% over the next best method. On the NYT dataset, it achieved gains of up to 2.75%.
- Robustness: Even on "flat" datasets like AGNews, HierHash outperformed baselines, suggesting that capturing latent hierarchical structures is beneficial even when they are not explicitly labeled.
- Efficiency: The model is highly efficient, training in under 30 seconds per epoch on a standard consumer GPU (RTX 2080) with a memory footprint of less than 3GB VRAM.
Conclusion
HierHash demonstrates that incorporating hierarchical priors into generative hashing models significantly enhances the quality of binary representations. By discovering and leveraging multi-grained semantic structures unsupervised, it provides a powerful tool for efficient large-scale document retrieval. Future work will focus on developing end-to-end models that learn binary codes directly to minimize information loss during binarization and exploring deeper hierarchical structures beyond two levels.
Summary updated