Abstract
This paper introduces FSWBC (Fast Search on Weighted Binary Codes), a novel algorithm designed for exact $K$-nearest neighbor (KNN) search in weighted Hamming space. While weighted Hamming distance significantly improves retrieval accuracy by resolving distance ties inherent in standard Hamming space, it traditionally necessitates slow exhaustive linear scans. FSWBC overcomes this efficiency barrier by utilizing a priority queue to probe hash table buckets in a strictly non-decreasing order of weighted distance. Experimental results on large-scale datasets like SIFT1B demonstrate that FSWBC achieves 100% accuracy while being over 1,300 times faster than a linear scan.
1. Introduction: The Ambiguity Problem
Binary hashing has become a cornerstone of large-scale image retrieval due to the compact nature of binary codes and the speed of Hamming distance calculations. However, standard Hamming distance suffers from a significant ambiguity problem: because distances are discrete (counting bit flips), many distinct codes can have identical distances to a query. This leads to numerous "ties" that degrade search precision.
To address this, researchers assign bitwise weights to codes, creating a weighted Hamming space that breaks these ties and improves accuracy. However, this transition breaks the efficiency of traditional hash-based search methods like Multi-Index Hashing (MIH), which are optimized for unweighted distances. Consequently, practitioners were often forced to choose between the accuracy of weighted distances and the speed of non-exhaustive search. FSWBC is proposed to bridge this gap, offering the speed of hashing with the precision of weighted distances.
2. Methodology: The FSWBC Algorithm
The core of FSWBC is a weight-driven probing strategy that treats binary codes as indices in a hash table. Rather than checking every entry, the algorithm intelligently probes buckets near the query in order of increasing distance.
2.1 Priority Queue and Monotonic Probing
FSWBC utilizes a priority queue to generate a sequence of candidate bucket indices. The algorithm ranks bits based on the "increased weight" (the cost of flipping that specific bit). It employs two specific operations—Operation 1 and Operation 2—to derive new candidate codes from the current top-ranked code in the queue.
A critical contribution of this work is the mathematical proof that these operations generate bucket indices in a strictly non-decreasing order of weighted Hamming distance. This monotonicity ensures that the search always prioritizes the most promising buckets and can terminate early once the $K$ nearest neighbors are guaranteed to be found.
2.2 Multi-Index Framework and Memory Efficiency
For longer binary codes (e.g., 64 or 128 bits), a single hash table becomes too sparse to be efficient. FSWBC adapts the Multi-Index Hashing (MIH) framework by splitting long codes into shorter substrings and maintaining multiple hash tables. To optimize memory, the authors propose a "single multi-index" hash table that merges these structures, reducing the overhead of null pointers in sparse tables by up to 20% on massive datasets.
3. Experimental Evaluation
The authors evaluated FSWBC on two standard benchmarks: GIST1M (1 million descriptors) and SIFT1B (1 billion descriptors). Binary codes were generated using Locality-Sensitive Hashing (LSH) and Iterative Quantization (ITQ), with bitwise weights learned through established methods.
3.1 Accuracy and Speed
Unlike many competing fast search methods that sacrifice precision for speed, FSWBC is an exact search algorithm. It consistently achieves 100% accuracy (Pre@1) across all bit lengths. In contrast, methods like MIH-binary see their accuracy drop to as low as 30% on 128-bit codes.
In terms of efficiency, FSWBC provides massive speedups. On the SIFT1B dataset with 128-bit codes, FSWBC is over 1,300 times faster than an exhaustive linear scan. It even outperforms approximate methods like MIH-weight because its monotonic probing strategy allows it to examine fewer, more relevant buckets.
4. Conclusion
FSWBC successfully resolves the conflict between accuracy and efficiency in weighted binary code search. By proving the monotonicity of priority queue-based probing, the authors provide a framework that is both mathematically sound and practically superior to linear scans. While the performance is dependent on the quality of learned weights, FSWBC stands as a powerful tool for exact, large-scale retrieval in weighted Hamming spaces.
Summary updated