Approximate Nearest Neighbor (ANN) search is a fundamental component of modern information retrieval, enabling efficient similarity matching across massive datasets. To handle billions of items, quantization techniques compress high-dimensional vectors into compact, searchable codes. While Composite Quantization (CQ) currently offers state-of-the-art accuracy by approximating vectors as sums of dictionary elements, it suffers from a significant computational bottleneck: the construction of distance lookup tables.
The Bottleneck: Distance Table Construction
In large-scale search, a query must be compared against dictionary "words" to build a lookup table before scanning the compressed index. As databases scale or when re-ranking large candidate sets, this "negligible" overhead becomes a primary source of latency. The authors of "Sparse Composite Quantization" observe that this cost often dominates the total query time in practical applications.
Sparse Composite Quantization (SCQ)
To address this, the authors propose Sparse Composite Quantization (SCQ). The core innovation is introducing sparsity into the dictionary elements. By forcing dictionary vectors to contain many zeros, the Euclidean distance between a query and a dictionary word can be computed far more efficiently using sparse vector operations.
The method formulates an optimization problem that minimizes vector approximation error subject to two key constraints:
- Inter-dictionary orthogonality: Inherited from CQ to maintain simple distance lookups.
- Sparsity constraint: Limiting the total number of non-zero entries across all dictionaries.
Solving for the $L_0$ norm is NP-hard, so the authors employ a two-step optimization: a relaxation using $L_1$ regularization (soft-thresholding), followed by a refinement step that keeps only the $S$ largest entries.
Experimental Results
The authors evaluated SCQ across several benchmarks, including MNIST, SIFT1M, Tiny1M, and the massive SIFT1B dataset.
As shown in Figure 2, SCQ variants (SQ1 and SQ2) consistently outperform Product Quantization (PQ) and Cartesian k-means (CKM) in search accuracy (Recall and MAP) while maintaining comparable computational costs. Specifically, SQ1 is designed to match the speed of PQ, while SQ2 matches the speed of CKM, allowing for flexible speed-accuracy trade-offs.
The efficiency gains are even more pronounced on high-dimensional datasets like INRIA Holidays and UKBench using Fisher vectors.
In Figure 5, we see that SQ1 achieves a distance lookup time nearly identical to PQ, which is several times faster than CQ or CKM on these datasets. Despite this speed, SQ1 maintains high retrieval performance (MAP and Score), effectively bridging the gap between the accuracy of CQ and the efficiency of PQ.
Key Insights
- Generalization of PQ: SCQ is a mathematical generalization of Product Quantization. If sparsity is forced to align with specific subspaces, SCQ reduces to PQ. Consequently, SCQ can theoretically always match or exceed PQ's performance.
- Regularization Effect: Sparsity doesn't just provide speed; it acts as a form of regularization. By removing redundant information from the dictionary, sparse models sometimes achieve higher accuracy than their dense counterparts.
- Scalability: On the 1-billion SIFT vector task, SCQ reduced total search time by 7% to 36% compared to standard CQ, proving its effectiveness for true large-scale challenges.
Conclusion
Sparse Composite Quantization successfully combines the high accuracy of composite quantization with the computational efficiency of simpler methods. By optimizing for sparsity, SCQ mitigates the distance table construction bottleneck, making it a highly practical choice for modern, large-scale retrieval systems.
Summary updated