Interleaved Composite Quantization for High-Dimensional Similarity Search

Soroosh Khoram, Stephen J. Wright, Jing Li · DOI

Abstract

Similarity search retrieves the nearest neighbors of a query vector from a dataset of high-dimensional vectors. As the size of the dataset grows, the cost of performing the distance computations needed to implement a query can become prohibitive. A method often used to reduce this computational cost is quantization of the vector space and location-based encoding of the dataset vectors. These encodings can be used during query processing to find approximate nearest neighbors of the query point quickly. Search speed can be improved by using shorter codes, but shorter codes have higher quantization error, leading to degraded precision. In this work, we propose the Interleaved Composite Quantization (ICQ) which achieves fast similarity search without using shorter codes. In ICQ, a small subset of the code is used to approximate the distances, with complete codes being used only when necessary. Our method effectively reduces both code length and quantization error. Furthermore, ICQ is compatible with several recently proposed techniques for reducing quantization error and can be used in conjunction with these other techniques to improve results. We confirm these claims and show strong empirical performance of ICQ using several synthetic and real-word datasets.

Introduction

Finding nearest neighbors in high-dimensional spaces is a fundamental operation in machine learning applications like image retrieval and recommendation systems. Vector Quantization (VQ) is a standard technique to manage the computational burden by compressing vectors into discrete codes. However, VQ typically faces a rigid trade-off: shorter codes offer speed at the cost of precision, while longer codes provide accuracy but increase computational latency. This paper introduces Interleaved Composite Quantization (ICQ), a method designed to break this trade-off by achieving the speed of short codes without sacrificing the precision of long ones.

Methodology: Interleaved Composite Quantization

The core of ICQ is a "coarse-to-fine" search strategy that leverages the observation that most candidates in a large dataset are far from a given query and can be discarded with minimal information.

1. Subspace Identification and Training

ICQ identifies a high-variance subspace containing the most informative dimensions of the data. During training, a novel augmented loss function using a bi-modal mixture model (Normal and Skew Normal distributions) is employed to automatically isolate these dimensions.

2. Interleaved Quantization

Quantizers are partitioned into two groups. A small subset ($\mathcal{K}$) is optimized for the high-variance subspace, while the remaining quantizers handle the rest of the vector space. This "interleaved" structure allows the most critical data features to be processed first.

3. Two-Step Search Operation

  • Crude Pruning: For each query, a "crude" distance is calculated using only the subset $\mathcal{K}$. This step quickly prunes the vast majority of distant candidates.
  • Refined Comparison: The full, high-precision code is only utilized for candidates that pass the initial pruning threshold.
mAP vs. Operations on synthetic datasets demonstrating ICQ's efficiency over SQ+PQ baselines.

Evaluation and Results

The authors evaluated ICQ against standard baselines, including Supervised Quantization (SQ) and Product Quantization Networks (PQN), across synthetic and real-world datasets (MNIST, CIFAR-10).

Performance on Real-World Benchmarks

On MNIST and CIFAR-10, ICQ demonstrated a significantly better precision-speed trade-off. As shown in the results, ICQ maintains high Mean Average Precision (mAP) while requiring fewer operations (Ops) than traditional SQ.

Performance comparison on MNIST and CIFAR datasets showing Ops vs. K and mAP vs. Ops.

Key Findings

  • Efficiency Gains: On MNIST, the computational gap between ICQ and SQ widens as the number of quantizers ($K$) increases, allowing ICQ to achieve peak precision with much lower latency.
  • Robustness: In experiments involving "unseen classes," ICQ consistently outperformed SQ, indicating that its subspace identification generalizes well to novel data categories.
  • Compatibility: ICQ functions as an architectural layer compatible with existing techniques like Composite Quantization (CQ) and Product Quantization (PQ), enhancing their baseline performance.

Conclusion

Interleaved Composite Quantization (ICQ) effectively addresses the computational bottleneck of high-dimensional similarity search. By focusing computational resources on informative subspaces and employing a two-step pruning strategy, ICQ achieves high precision with the efficiency of much shorter codes. Future work may involve optimizing the pruning margin and testing the approach on billion-scale datasets.

Summary updated

BibTeX
@misc{khoram2019interleaved,
  author = {Soroosh Khoram and Stephen J. Wright and Jing Li},
  title = {{Interleaved Composite Quantization for High-Dimensional Similarity Search}},
  year = {2019},
  eprint = {1912.08756},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1912.08756},
}
Figure