Quantization based Fast Inner Product Search

Ruiqi Guo, Sanjiv Kumar, Krzysztof Choromanski, David Simcha

Introduction

Maximum Inner Product Search (MIPS) is a fundamental operation in modern large-scale machine learning, powering recommendation systems (matching users to items) and high-dimensional classification. While Nearest Neighbor Search (NNS) under Euclidean distance is well-optimized, MIPS presents unique challenges because the inner product does not satisfy the triangle inequality, particularly when database vectors have varying norms. Traditional approaches like Locality Sensitive Hashing (LSH) often require augmenting vectors with extra dimensions to transform MIPS into a Euclidean problem, which introduces computational overhead and approximation errors.

This paper introduces QUIP (Quantization-based Inner Product search), a novel framework that leverages product quantization specifically optimized for inner product similarity. By avoiding dimensionality expansion and directly optimizing for retrieval rank, QUIP achieves superior accuracy and speed compared to existing hashing and tree-based methods.

Methodology

QUIP builds upon the concept of Product Quantization (PQ) but adapts it for the asymmetric nature of MIPS. The core methodology consists of three primary components:

  1. Subspace Quantization: Database vectors are partitioned into $K$ subspaces. Each subspace is represented by a codebook of centroids. During search, only the database vectors are quantized; the query remains exact. The inner product is estimated by summing pre-computed inner products of the query with the centroids in each subspace.
  2. QUIP-cov: Standard k-means minimizes Euclidean distance, which is suboptimal for MIPS. QUIP-cov utilizes a Mahalanobis distance based on the query distribution's covariance. This ensures that quantization is most precise in the directions where queries are most likely to appear.
  3. QUIP-opt (Rank Optimization): This is the most advanced variant. Given a small set of training queries, QUIP-opt employs a constrained optimization framework with a hinge loss term. This objective explicitly encourages the ground-truth top results to have higher approximate inner products than other items, shifting the focus from reconstruction accuracy to retrieval ranking.
Precision-Recall curves for Movielens (a) and Netflix (b) datasets across various bit budgets (b) and Top-k retrieval targets.

Experimental Evaluation

The authors evaluated QUIP against state-of-the-art baselines, including Asymmetric LSH (ALSH), Simple LSH, and PCA-Trees, across four real-world datasets: Movielens, Netflix, ImageNet (GoogLeNet features), and VideoRec (user interest embeddings).

Key Results

  • Precision-Recall Dominance: As shown in the Precision-Recall curves, QUIP (particularly QUIP-opt) consistently outperforms all baselines. Even at low bit budgets (e.g., 64 bits), QUIP maintains high precision where hashing methods struggle.
  • Efficiency and Scalability: Unlike ALSH, QUIP does not require dimensionality bloat. This memory efficiency allows it to handle larger datasets within the same hardware constraints. Furthermore, the paper provides theoretical grounding showing that quantization error decreases exponentially as the number of subspaces $K$ increases.
  • Recall Performance: When measuring recall against the percentage of points returned (search effort), QUIP variants reach high recall significantly faster than competing methods across all tested datasets.
Recall curves for Movielens, Netflix, VideoRec, and ImageNet, demonstrating that QUIP variants achieve high recall with significantly fewer points returned compared to baselines.

Conclusion

QUIP represents a significant advancement in MIPS by demonstrating that optimizing for retrieval rank is more effective than simple data reconstruction. By utilizing query-aware quantization and a ranking-based loss function, QUIP provides a fast, memory-efficient, and highly accurate solution for large-scale search tasks. Future work includes exploring the integration of these quantization techniques directly into the end-to-end training of deep neural networks.

Summary updated

BibTeX
@inproceedings{guo2016quantization,
  author = {Ruiqi Guo and Sanjiv Kumar and Krzysztof Choromanski and David Simcha},
  title = {{Quantization based Fast Inner Product Search}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2016},
}
Figure