[Paper Review] One Loss for Quantization: Deep Hashing with Discrete Wasserstein Distributional Matching
This paper proposes a single-loss quantization method for deep supervised image hashing by minimizing the distributional distance between learned continuous hash codes and a uniform discrete distribution using a novel, efficient variant of the Sliced Wasserstein Distance called HSWD. The approach simultaneously improves code balance and reduces quantization error, leading to superior retrieval performance across multiple datasets and models with lower computational overhead compared to existing multi-loss methods.
Image hashing is a principled approximate nearest neighbor approach to find similar items to a query in a large collection of images. Hashing aims to learn a binary-output function that maps an image to a binary vector. For optimal retrieval performance, producing balanced hash codes with low-quantization error to bridge the gap between the learning stage's continuous relaxation and the inference stage's discrete quantization is important. However, in the existing deep supervised hashing methods, coding balance and low-quantization error are difficult to achieve and involve several losses. We argue that this is because the existing quantization approaches in these methods are heuristically constructed and not effective to achieve these objectives. This paper considers an alternative approach to learning the quantization constraints. The task of learning balanced codes with low quantization error is re-formulated as matching the learned distribution of the continuous codes to a pre-defined discrete, uniform distribution. This is equivalent to minimizing the distance between two distributions. We then propose a computationally efficient distributional distance by leveraging the discrete property of the hash functions. This distributional distance is a valid distance and enjoys lower time and sample complexities. The proposed single-loss quantization objective can be integrated into any existing supervised hashing method to improve code balance and quantization error. Experiments confirm that the proposed approach substantially improves the performance of several representative hashing~methods.
Motivation & Objective
- Address the challenge of achieving both low quantization error and balanced code distribution in deep supervised hashing, which are critical for high retrieval performance.
- Overcome the limitations of existing multi-loss quantization approaches that are heuristic, computationally expensive, and require extensive hyperparameter tuning.
- Reformulate the quantization objective as minimizing the distributional distance between continuous hash codes and a uniform discrete distribution, enabling unified optimization of key performance criteria.
- Develop a computationally efficient distributional distance metric—HSWD—that leverages the discrete nature of hash functions to reduce sample and time complexity.
- Demonstrate that the proposed method can be seamlessly integrated into existing deep hashing frameworks to improve performance without architectural changes.
Proposed method
- Formulate the quantization objective as minimizing the distributional distance between the continuous output distribution of a hash function and a pre-defined uniform discrete distribution over binary codes.
- Adopt the Sliced Wasserstein Distance (SWD) as the base distributional distance due to its low sample complexity and ease of estimation.
- Propose a novel variant, HSWD (Hash-based Sliced Wasserstein Distance), which exploits the discrete structure of hash codes to reduce the number of required random projections.
- HSWD uses only as many projections as the hash code length, eliminating redundant projections into uninformative directions and avoiding costly matrix multiplications.
- Integrate HSWD as a single, differentiable loss term into any existing supervised hashing framework, replacing multiple heuristic quantization losses.
- The method enables end-to-end training where the model learns to produce continuous codes that are both balanced and close to discrete binary codes, minimizing quantization error.

Experimental results
Research questions
- RQ1Can a unified, single-loss objective effectively optimize both quantization error and coding balance in deep supervised image hashing?
- RQ2Does matching the learned continuous hash distribution to a uniform discrete distribution lead to improved retrieval performance compared to conventional multi-loss quantization schemes?
- RQ3Can a distributional distance metric be designed to be both theoretically valid and computationally efficient for discrete hash code optimization?
- RQ4How does the proposed HSWD method compare in efficiency and performance to standard SWD and existing quantization losses in terms of training time and retrieval accuracy?
- RQ5To what extent does the proposed method improve performance across diverse deep hashing models and benchmark datasets?
Key findings
- The proposed HSWD-based quantization method reduces training time per epoch by up to 40% compared to the original method and 20–30% compared to SWD-based quantization on CIFAR-10, NUS-WIDE, and COCO datasets.
- On all evaluated datasets, the method achieves significantly lower quantization error, as measured by the angle between continuous codes and their discrete counterparts, with improvements confirmed in t-SNE visualizations.
- Bit entropy analysis shows that HSWD consistently produces more balanced hash codes (higher entropy) than baseline methods, indicating better distributional uniformity.
- The retrieval performance of multiple state-of-the-art hashing models—CSQ and DCH—improves when HSWD is used as the quantization loss, with consistent gains in mAP and recall metrics.
- Qualitative t-SNE visualizations of 16-bit hash codes demonstrate that HSWD leads to better inter-class separation and intra-class compactness compared to standard quantization and SWD.
- The method reduces the need for hyperparameter tuning by replacing multiple heuristic loss terms with a single, principled distributional distance objective.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.