SAH: Shifting-aware Asymmetric Hashing for Reverse k-Maximum Inner Product Search

Qiang Huang, Yanhao Wang, Anthony K. H. Tung

TL;DR

This paper introduces SAH, the first subquadratic-time algorithm for Reverse k-Maximum Inner Product Search (RkMIPS). SAH tackles the challenge of identifying users interested in a specific item by combining a novel "Shifting-Aware Asymmetric Hashing" (SA-ALSH) technique for efficient item search with a "Cone-Tree" based blocking strategy for user pruning, achieving significant speedups and high accuracy.

What Problem Does This Paper Address?

In recommender systems, a common task is to find items a user might like, often framed as Maximum Inner Product Search (MIPS). This paper tackles the inverse problem: given an item, find users who are likely to be interested in it. This is crucial for market analysis and targeted advertising. The problem, termed Reverse k-Maximum Inner Product Search (RkMIPS), asks to find users for whom a given item would be among their top-k most relevant items. This is more challenging than MIPS because the number of relevant users can vary, and existing MIPS solutions, when naively applied, can lead to arbitrarily bad results due to distortions in high-dimensional spaces. Existing RkMIPS solutions are either too slow (linear scan) or not well-suited for high dimensions.

Methods

The core of the proposed solution is the Shifting-aware Asymmetric Hashing (SAH) algorithm, which comprises two main innovations:

  • Shifting-Aware Asymmetric Locality-Sensitive Hashing (SA-ALSH): To accelerate the MIPS part, SA-ALSH uses a novel "Shifting-Invariant Asymmetric Transformation" (SAT). This transformation maps item and user vectors to a higher-dimensional space where MIPS can be approximated by Nearest Neighbor Search (NNS) on angular distance. Crucially, SAT's shifting mechanism reduces distortion errors compared to previous methods like H2-ALSH, leading to more accurate results. SA-ALSH then uses this transformed space with a specialized LSH scheme.
  • Cone-Tree Blocking Strategy: To efficiently prune the large set of user vectors, SAH employs a "Cone-Tree" data structure. This tree partitions users into blocks (leaf nodes) based on their directional similarity. For each block, SAH derives upper bounds on the potential inner product between a query item and any user within that block. These bounds, combined with pre-computed lower bounds for users (similar to prior work), allow for aggressive pruning of entire user blocks or individual users, significantly speeding up the search.

Datasets

The paper evaluates SAH on five real-world recommendation datasets:

  • Amazon-Auto
  • Amazon-CDs
  • MovieLens
  • Music100
  • Netflix

Additionally, for comparing SA-ALSH with H2-ALSH on kMIPS, they use ten datasets, including the five above plus:

  • DEEP
  • Gist
  • GloVe
  • ImageNet
  • Msong

The paper notes that the latter five datasets cannot be directly used for RkMIPS as they lack user vectors.

Key Insights and Ideas

  • RkMIPS is fundamentally different from kMIPS: The paper empirically shows that the top-k items for a user are not necessarily the items that would be in a user's top-k list if the item were the query. This highlights the need for a dedicated RkMIPS solution.
  • Shifting Invariance is Key for High-Dimensional MIPS: The proposed SAT transformation's ability to be invariant to shifts in item vectors is crucial for reducing distortion errors in high-dimensional spaces, leading to more accurate MIPS approximations.
  • Cone-Tree for Efficient User Pruning: The Cone-Tree structure, by grouping users based on direction, provides tighter upper bounds for pruning than simpler norm-based blocking, significantly improving search efficiency.
  • Combining Hashing and Blocking is Powerful: SAH's success stems from effectively integrating SA-ALSH for fast item search with the Cone-Tree for efficient user pruning, creating a synergistic effect.

Key Results

  • Speedup: SAH is 4-8x faster than the state-of-the-art RkMIPS method (Simpfer) and significantly faster (nearly 2 orders of magnitude) than H2-ALSH when adapted for RkMIPS.
  • Accuracy: SAH consistently achieves F1-scores over 90%, often outperforming H2-ALSH and H2-Simpfer.
  • Parameter Sensitivity: The paper shows that SAH is relatively robust to parameter choices, with optimal performance often achieved at default settings (e.g., b=0.5, K=128, No=20).
  • SA-ALSH Advantage: SA-ALSH demonstrates superior performance (both speed and accuracy) for kMIPS compared to H2-ALSH, validating the effectiveness of the shifting-invariant transformation.

Limitations and Future Work

  • Theoretical Guarantee for k=1: The current theoretical guarantee for SAH applies to the case where k=1.
  • Future Work: The authors suggest extending SAH to provide a subquadratic-time algorithm for approximate RkMIPS for any k > 1.

Summary updated

Abstract

This paper investigates a new yet challenging problem called Reverse $k$-Maximum Inner Product Search (R$k$MIPS). Given a query (item) vector, a set of item vectors, and a set of user vectors, the problem of R$k$MIPS aims to find a set of user vectors whose inner products with the query vector are one of the $k$ largest among the query and item vectors. We propose the first subquadratic-time algorithm, i.e., Shifting-aware Asymmetric Hashing (SAH), to tackle the R$k$MIPS problem. To speed up the Maximum Inner Product Search (MIPS) on item vectors, we design a shifting-invariant asymmetric transformation and develop a novel sublinear-time Shifting-Aware Asymmetric Locality Sensitive Hashing (SA-ALSH) scheme. Furthermore, we devise a new blocking strategy based on the Cone-Tree to effectively prune user vectors (in a batch). We prove that SAH achieves a theoretical guarantee for solving the RMIPS problem. Experimental results on five real-world datasets show that SAH runs 4$\sim$8$\times$ faster than the state-of-the-art methods for R$k$MIPS while achieving F1-scores of over 90\%. The code is available at \url{https://github.com/HuangQiang/SAH}.
BibTeX
@inproceedings{huang2023sah,
  author = {Qiang Huang and Yanhao Wang and Anthony K. H. Tung},
  title = {{SAH: Shifting-aware Asymmetric Hashing for Reverse k-Maximum Inner Product Search}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2023},
  doi = {10.1609/aaai.v37i4.25550},
}
Figure