Abstract
Sparse data are common in industrial applications, where handcrafted features and ReLU-activated embeddings often exhibit high sparsity. This paper explores efficient search in sparse data using graph-based Approximate Nearest Neighbor (ANN) algorithms like HNSW and its GPU variant, SONG. We introduce a "chi-square two-tower" model that, when integrated with ReLU, produces highly sparse embeddings. To further optimize performance, we incorporate Sign Cauchy Random Projections (SignCRP) to hash vectors into bits, reducing memory costs and accelerating search. Our results on proprietary LinkedIn Ads data and public benchmarks demonstrate significant improvements in retrieval efficiency and memory usage.
Introduction
In modern recommendation and advertising systems, Embedding-Based Retrieval (EBR) is essential for matching queries with billions of potential items. Standard two-tower models typically use cosine similarity, but these often fail to fully exploit the sparsity inherent in modern neural networks. As the scale of data grows, the computational and memory overhead of ANN search becomes a critical bottleneck. We address this by designing a retrieval pipeline that intentionally maximizes sparsity and leverages specialized algorithms to accelerate search.
Methodology
The proposed framework consists of three integrated components: the Chi-square Two-tower model, graph-based ANN search, and SignCRP hashing.
Chi-square Two-tower Model
Unlike traditional models that rely on dot product or cosine similarity, our model utilizes the chi-square similarity kernel. By combining this kernel with ReLU activation and sum-to-one normalization, we generate embedding vectors that are significantly sparser than those produced by cosine-based architectures. This architecture is specifically designed to handle member-side and campaign-side features through shared embedding and interaction layers.
Efficient Search with HNSW and SignCRP
For serving, we employ Hierarchical Navigable Small World (HNSW) graphs, optimized to skip zero-value entries in sparse vectors during distance calculations. To further compress the embeddings, Sign Cauchy Random Projections (SignCRP) hash high-dimensional chi-square vectors into compact bitstrings. This allows for extremely fast Hamming distance computations on modern hardware.
Experimental Results
We evaluated our approach using LinkedIn's Ads Targeting dataset (4.5 billion records) and several public benchmarks including Webspam, News20, RCV1, and MNIST.
Sparsity and Scaling
A key finding is that increasing embedding dimensionality enhances sparsity in the chi-square model more effectively than in the cosine model. At a dimension of 2048, the chi-square model achieved a sparsity of 0.6%, compared to 3.6% for the cosine model. This extreme sparsity allows for faster search even at higher dimensions.
Retrieval Performance
The extreme sparsity of the chi-square embeddings directly translates to search efficiency. In HNSW, distance computation is the primary bottleneck; our sparse format reduced this cost by approximately 3x. Furthermore, using SignCRP to hash vectors into 1024 bits yielded a 12x to 18x speedup in similarity computations on the Webspam dataset while maintaining 90% recall. On public datasets like News20 and RCV1, chi-square similarity actually outperformed cosine similarity in classification accuracy.
Discussion and Conclusion
Our exploration demonstrates that chi-square similarity is a robust, "search-friendly" alternative to cosine similarity for deep learning-based retrieval. While two-tower models are primarily retrieval-focused and may not capture the complex interactions of cross-encoders, the efficiency gains from sparsity and hashing are substantial for large-scale industrial applications. Future work will investigate the limits of sparsity at even higher dimensions and further optimize the overhead of SignCRP projections.
Summary updated