Document Hashing with Multi-Grained Prototype-Induced Hierarchical Generative Model (2024)

Abstract: Document hashing plays a crucial role in large-scale information retrieval. However, existing unsupervised document hashing methods merely consider flat semantics of documents, resulting in the inability of preserving hierarchical semantics in hash codes. In this paper, we propose a hierarchical generative model that can model and leverage the hierarchical structure of semantics. Specifically, we introduce hierarchical prototypes into the model to construct a hierarchical prior distribution, which is integrated into the variational auto-encoder (VAE) framework, enabling the model to produce hash codes preserving rough hierarchical semantics. To further promote the preservation of hierarchical structure, we force the hash code to preserve as much semantic information as possible via contrastive learning, which exploits the hierarchical pseudo labels produced during VAE training. Extensive experiments on three benchmarks outperform all baseline methods, demonstrating the superiority of our proposed model on both hierarchical datasets and flat datasets.

## introduction similarity search aims at retrieving documents of high similarity with the query input from a huge database, and has been found useful in a large number of applications like plagiarism analysis @xcite , collaborative filtering @xcite etc. semantic hashing @xcite represents the documents by compact binary codes, thus is able to evaluate the similarity between two documents at the low-cost hamming space, consequently improving the retrieval speed and memory footprint compared with continuous real-valued features. one of the most widely-used approaches for unsupervised hashing is to model the documents through a deep generative model @xcite fang, * corresponding author football economy news report business sports basketball stocks messi played in the… manchester united was… … trajectory of inflation… gdp growth is expected… … golden state warriors... in an nba matchup… … the investors has reacted… optimism in the stock … … 2017; @xcite , in which the semantic information of documents are encoded into the hash codes through the reconstruction of documents. after that, considerable researches have been devoted to improve the quality of generated hash codes by incorporating more semantic knowledge into the generative models like the knowledge of inherent cluster structure in data @xcite , neighborhood information among documents @xcite @xcite etc. thanks to the exploitation of these semantic knowledge, the hash codes produced by these models are shown to retain more semantic similarity information of documents. however, existing unsupervised methods @xcite @xcite @xcite concentrate on preserving flat semantic structure during their modeling process, but rarely consider and leverage the hierarchical semantic structure that exists ubiquitously in real world. for instance, a group of documents related to 'sports' and 'business' can be further subdivided into finer-grained categories like 'basketball', 'football', 'stocks', 'economy', etc, or be conversely summarized into a coarser-grained category like 'news' (refer to figure 1 for intuitive illustration). an ideal retrieval result is expected to be able to reflect the inherent hierarchical semantic structure. for example, given a query document from 'basketball', the most favorable retrieved documents should also belong to 'basketball', followed by documents from 'football', because documents from the same coarse-grained category 'sports' are more acceptable than those from different coarse-grained category, e.g., 'business'. obviously, by explicitly taking into account the hierarchical semantic structure in the hash model, the generated hash codes can not only reflect the desired hierarchical semantic structure, but also yield more accurate retrieval results. yet how to effectively model the hierarchical structure of semantics for unsupervised document hashing is unexplored before. thus, the problems confronting us can be concluded as: (1) how to model the hierarchical structure of semantics in unsupervised scenario? (2) how to skillfully integrate hierarchical structure into the framework of the generative hashing model? to address the aforementioned problems, in this paper, we propose hierhash: a multigrained prototype-induced hierarchical generative hashing model that can explicitly model and leverage the underlying hierarchical structure of semantics in documents. specifically, coarse-grained and fine-grained prototypes are first introduced and then leveraged to construct a hierarchical prior distribution, which is later integrated into the variational auto-encoder (vae) for deep hierarchical modeling of documents. with the coarse-/finegrained prototypes automatically learned from the training documents, the generative model is able to produce hash codes that roughly reflect the underlying hierarchical structure of semantics. to further promote the semantic hierarchies in the learned hash codes, in addition to the training objective on the generative model, we also force the hash codes output from the model to preserve as much semantic information as possible via contrastive learning, with the help of the hierarchical pseudo labels discovered by the generative model. finally, with the pseudo labels becoming increasingly accurate, a hierarchical self-labeling module is further introduced, which further improves the hash code quality through strong supervision from high-confidence pseudo labels. extensive experiments of hierhash on three public benchmarks outperform all baseline methods, demonstrating its superiority on both hierarchical datasets and flat datasets. the evaluation of the coarse-grained retrieval on two hierarchical datasets also demonstrates the effectiveness on hierarchical retrieval of our model. ## related work unsupervised document hashing deep generative models @xcite have attracted attention in the realm semantic document hashing, where an encoder-decoder architecture was established to encourage binary codes to retain semantic information by reconstructing original data. vdsh @xcite proposed to learn continuous representations under variational autoencoder (vae) framework (kingma and welling, 2013) with an assumption of gaussian prior and then cast it into binary codes; nash @xcite replaced gaussian prior with bernoulli prior to construct end-to-end generative hashing framework; bmsh @xcite employed a mixture prior; corrsh @xcite introduced the distribution of boltzmann machine to the generative model and wish @xcite followed nash @xcite and introduced a set of auxiliary implicit topic vectors to address the information loss in few-bits hashing. what's more, pairrec @xcite and snuh @xcite further leveraged neighborhood information in generative model. recently, contrastive methods were also proven effective in hashing task @xcite @xcite . however, these approaches undergone a similar problem to ignore potential hierarchical structure of data, which widely exists in real-world datasets. hierarchical hashing some works in hashing task @xcite @xcite paid attention to the hierarchical categories of datasets. for instance, ihdh @xcite proposed a document hashing model to make use of neighboring information and the hierarchical structure to learn hierarchical hashing codes. but they are all supervised methods which requires strong supervision from delicately-labelled hierarchical datasets, making them ungeneralizable. hierarchical structure in the realm of unsupervised image representation learning, many works @xcite @xcite proposed to build hierarchical prototypes to guide the learning of representations. other researches @xcite @xcite proposed to learn representations for down-stream few-shot classification task with coarsegrained labels of data. the aforementioned works demonstrated the feasibility and significance of learning representations with multiple semantic hierarchy. ## the proposed method in this section, a deep generative model is first developed to model the hierarchical semantic structure of documents, which can explicitly encourage the formation of hierarchical structure in document representations. then, a contrastive learning based method is further developed to strengthen the hierarchical structure by forcing the representations to better reflect the semantic information of documents, since the semantics of documents is thought to be inherently hierarchical. ## conclusion in this paper, to learn hash codes with hierarchical semantics unsupervisedly, we propose hi-erhash: a hierarchical generative model which introduces multi-grained prototypes to integrate the hierarchical structure of semantics into hash model. furthermore, to promote the learned hierarchical structure, we leverage hierarchical pseudolabels produced during the vae optimization with contrastive-based methods, which refine the semantics preserved in hash codes. experimental results show that hierhash significantly outperforms existing baselines on both hierarchical datasets and flat datasets.