Abstract
We consider the problem of designing locality sensitive hashes (LSH) for inner product similarity, and of the power of asymmetric hashes in this context. Shrivastava and Li argue that there is no symmetric LSH for the problem and propose an asymmetric LSH based on different mappings for query and database points. However, we show there does exist a simple symmetric LSH that enjoys stronger guarantees and better empirical performance than the asymmetric LSH they suggest. We also show a variant of the settings where asymmetry is in-fact needed, but there a different asymmetric LSH is required.
Introduction
Maximum Inner Product Search (MIPS) is a fundamental task in machine learning, particularly in recommender systems. Given a query vector (e.g., a user profile) and a database of vectors (e.g., items), the goal is to find the item that maximizes the inner product with the query. Unlike standard nearest neighbor search, which uses Euclidean distance or Cosine similarity, MIPS is challenging because inner products are not bounded by the norms of the vectors. A very long vector far away might have a higher inner product than a short vector nearby.
A previous high-profile study (Shrivastava and Li, 2014) argued that a symmetric Locality Sensitive Hashing (LSH) scheme—where the same function is applied to both queries and database items—was impossible for MIPS. They proposed an "Asymmetric LSH" (ALSH) that used different, complex mappings for queries and items. This work challenges that notion, demonstrating that symmetry is not only possible but superior if the problem is framed correctly.
The SIMPLE-LSH Transformation
The proposed solution, SIMPLE-LSH, is a parameter-free symmetric hashing scheme. The core idea is to transform the MIPS problem into a standard angular similarity (Cosine) problem through a simple geometric mapping.
- Normalization & Bounding: We assume query vectors $q$ are normalized to unit length ($\|q\|_2 = 1$) and database vectors $x$ are bounded within the unit sphere ($\|x\|_2 \leq 1$).
- The Mapping: A $d$-dimensional database vector $x$ is mapped to a $(d+1)$-dimensional vector: $P(x) = [x; \sqrt{1 - \|x\|_2^2}]$. This "pads" every database vector so that its new length is exactly 1.
- The Query Mapping: For the query $q$, we simply append a zero: $P(q) = [q; 0]$.
- The Result: The inner product of the transformed vectors $P(q)^\top P(x)$ is exactly equal to the original inner product $q^\top x$.
Because all transformed vectors now lie on the surface of a unit sphere, MIPS is converted into a standard Cosine Similarity search, allowing the use of classic "Sign-Random-Projection" (SimHash) to create binary hash codes.
Theoretical and Empirical Performance
Theoretical analysis shows that SIMPLE-LSH achieves a lower hashing ratio $\rho$ (a measure of search efficiency) than both ALSH and standard Euclidean LSH across almost all similarity thresholds. This implies faster search times and lower memory overhead for the same target accuracy.
Empirically, the method was evaluated on standard collaborative filtering benchmarks like Netflix and Movielens 10M using latent factor models. In head-to-head tests, SIMPLE-LSH consistently yielded higher precision and recall than ALSH. This performance advantage held true across various hash code lengths (from 64 to 512 bits) and for retrieving different numbers of top items ($T=1, 5, 10$).
Conclusion
SIMPLE-LSH refutes the claim that MIPS requires complex asymmetric hashing. By acknowledging that real-world queries can be normalized and database vectors are typically bounded, we find a symmetric solution that is easier to implement and more effective. While asymmetry might be required in theoretical settings where vectors are completely unconstrained, SIMPLE-LSH provides a more practical and efficient approach for the majority of MIPS applications in machine learning.
Summary updated