Retrieval with Learned Similarities

Bailu Ding, Jiaqi Zhai

Introduction

Modern large-scale retrieval systems, essential for search engines and recommendation engines, typically rely on Maximum Inner Product Search (MIPS). MIPS computes the dot product between a query vector and millions of item vectors to identify the most relevant candidates. While computationally efficient, MIPS is fundamentally limited by a "low-rank bottleneck," restricting its ability to capture complex, non-linear relationships between queries and items.

To overcome this, researchers have explored "learned similarities" using deep neural networks. However, these models are often too slow for real-time retrieval at scale. This paper introduces Mixture-of-Logits (MoL), a universal similarity function that bridges the gap between the speed of MIPS and the expressivity of deep neural rankings.

The Mixture-of-Logits (MoL) Architecture

The core of the proposed framework is the MoL similarity function. Unlike standard MIPS, which uses a single pair of embeddings, MoL utilizes multiple pairs of low-rank embeddings to represent the relationship between queries and items.

The Mixture-of-Logits (MoL) architecture, illustrating how query and item features are encoded into multiple embedding pairs to compute a final similarity score.

As shown in the architecture diagram, the system encodes query features ($q$) and item features ($x$) into sets of embeddings ($f_1(q) \dots f_{P_q}(q)$ and $g_1(x) \dots g_{P_x}(x)$). The final similarity score, $\phi(q, x)$, is computed as a weighted sum of the outer products of these embeddings. This "mixture" approach allows the model to attend to different semantic aspects of the query-item relationship simultaneously—similar to multi-head attention in Transformers.

Universal Approximation and Load Balancing

A key theoretical contribution of this work is the proof that MoL is a universal approximator. Given a sufficient number of components, MoL can represent any similarity matrix, effectively breaking the low-rank bottleneck. To ensure the model effectively utilizes all $P$ embedding pairs, the authors introduced a novel loss function based on mutual information. This prevents the model from relying on a single "expert" embedding pair, ensuring diverse feature representation across all heads.

Retrieval with Learned Similarities (RAILS)

To make MoL practical for large-scale systems, the authors developed the Retrieval with Learned Similarities (RAILS) framework. RAILS avoids the prohibitive cost of brute-force search through two primary approximate retrieval heuristics:

  1. Top-K Per Embedding: Retrieving the top items for each individual embedding "head."
  2. Top-K Average: Retrieving items based on the average of all embedding components.

By combining these strategies, the system can identify the true top-K items with high recall while maintaining low latency.

Experimental Evaluation

The authors evaluated MoL across several large-scale datasets, including MovieLens (1M & 20M), Amazon Books (sequential recommendation), and NQ320K (Natural Questions for open-domain QA).

Key Results

  • Accuracy Gains: On the Amazon Books dataset, MoL achieved a 20-30% improvement in Hit Rate compared to state-of-the-art dot-product models like SASRec.
  • State-of-the-Art Performance: MoL set new records on the NQ320K benchmark, outperforming both generative and dense retrieval models.
  • Efficiency: The RAILS approximate algorithms provided up to a 66x speedup over brute-force search on NQ320K, maintaining over 0.99 recall.
  • Hardware Synergy: MoL exhibits higher arithmetic intensity than simple dot products, making it well-suited for parallel execution on modern GPUs.

Conclusion and Future Work

The Mixture-of-Logits framework demonstrates that it is possible to achieve high-expressivity retrieval without sacrificing the efficiency required for production systems. While MoL requires a larger storage footprint due to multiple embeddings per item, its accuracy gains and hardware synergy make it a compelling alternative to traditional MIPS. Future research will focus on optimizing GPU kernels for exact search and scaling the system to handle billions of items.

Summary updated

BibTeX
@inproceedings{ding2025retrieval,
  author = {Bailu Ding and Jiaqi Zhai},
  title = {{Retrieval with Learned Similarities}},
  booktitle = {The Web Conference},
  year = {2025},
  doi = {10.1145/3696410.3714822},
}
Figure