Bit-mask Robust Contrastive Knowledge Distillation for Unsupervised Semantic Hashing

Liyang He, Zhenya Huang, Jiayu Liu, Enhong Chen, Fei Wang, Jing Sha, Shijin Wang

Introduction

Semantic hashing transforms images into compact binary strings, enabling lightning-fast retrieval across massive datasets. While large-scale models like Vision Transformers (ViT) have significantly improved retrieval accuracy, their high latency makes them impractical for real-time online queries. Knowledge Distillation (KD) aims to bridge this gap by training a lightweight "student" model to replicate the performance of a "teacher" model. However, traditional KD techniques often fail in the context of hashing because they do not account for bit independence or the need for strict semantic space alignment between models.

The Asymmetric Hashing Paradigm

A key contribution of this research is addressing the challenges within the Asymmetric Semantic Hashing search Paradigm (ASHP). In a standard Symmetric Semantic Hashing Paradigm (SSHP), the same model is used for both indexing the database (offline) and processing user queries (online). In contrast, ASHP utilizes a powerful, slow teacher model to generate high-quality hash codes for the database offline, while a fast student model handles real-time queries.

Comparison of Symmetric (SSHP) and Asymmetric (ASHP) Semantic Hashing Paradigms.

The difficulty in ASHP lies in ensuring the student model "speaks the same language" as the teacher. If their semantic spaces are not aligned, a query from the student will not match the corresponding entry in the teacher-generated database. BRCD solves this by forcing strict semantic alignment during the distillation process.

The BRCD Framework

To overcome these hurdles, the authors propose Bit-mask Robust Contrastive Knowledge Distillation (BRCD). This framework introduces three primary innovations:

  1. Contrastive Knowledge Distillation: Instead of simple output matching, the student learns the relational structure of the teacher's feature space. If the teacher considers two images similar, the student is incentivized to produce hash codes with a small Hamming distance (the number of differing bits).
  2. Cluster-based Robust Optimization: Data augmentation is essential for training but can sometimes lead to "offset positive samples"—instances where the teacher provides unreliable signals for heavily modified images. BRCD employs k-means clustering to identify and filter these outliers, ensuring the student learns from stable, high-quality knowledge.
  3. Bit-mask Mechanism: The researchers identified "redundancy bits"—dimensions in the hash code that contain mostly noise and do not vary consistently across similar images. By identifying and masking these bits during the distillation process, the student can focus its limited capacity on the most semantically meaningful features.

Experimental Results

The BRCD method was evaluated on three benchmark datasets: CIFAR-10, MSCOCO, and ImageNet100. The results demonstrate that BRCD consistently outperforms state-of-the-art distillation methods.

  • Performance Gains: In the difficult ASHP setting, BRCD achieved a 9.6% improvement on CIFAR-10 and a 4.3% improvement on ImageNet100 over existing baselines.
  • Efficiency: By using a ResNet18 student to mimic a ViT-Large teacher, the system achieves a 7x speedup in inference time while retaining a high level of accuracy.
  • Versatility: The framework proved effective across various backbone architectures (e.g., MobileNet, EfficientNet) and different underlying hashing algorithms (e.g., CIBHash, GreedyHash).

Conclusion

BRCD effectively addresses the semantic alignment and noise sensitivity issues inherent in distilling knowledge for unsupervised semantic hashing. By focusing on robust optimization and masking redundant information, it enables the deployment of highly efficient student models that rival the performance of massive Vision Transformers. Future work will explore the balance between augmentation intensity and the retention of "hard positive" samples to further refine the distillation process.

Summary updated

BibTeX
@inproceedings{he2024bit,
  author = {Liyang He and Zhenya Huang and Jiayu Liu and Enhong Chen and Fei Wang and Jing Sha and Shijin Wang},
  title = {{Bit-mask Robust Contrastive Knowledge Distillation for Unsupervised Semantic Hashing}},
  booktitle = {The Web Conference},
  year = {2024},
}
Figure