Deep Retrieval: An End-to-End Learnable Structure Model for Large-Scale Recommendations

Weihao Gao, Xiangjun Fan, Jiankai Sun, Kai Jia, Wenzhi Xiao, Chong Wang, Xiaobing LiuarXiv 2020

Abstract

One of the core problems in large-scale recommendations is to retrieve top relevant candidates accurately and efficiently, preferably in sub-linear time. Previous approaches are mostly based on a two-step procedure: first learn an inner-product model, and then use some approximate nearest neighbor (ANN) search algorithm to find top candidates. In this paper, we present Deep Retrieval (DR), to learn a retrievable structure directly with user-item interaction data (e.g. clicks) without resorting to the Euclidean space assumption in ANN algorithms. DR's structure encodes all candidate items into a discrete latent space. Those latent codes for the candidates are model parameters and learnt together with other neural network parameters to maximize the same objective function. With the model learnt, a beam search over the structure is performed to retrieve the top candidates for reranking. Empirically, we first demonstrate that DR, with sub-linear computational complexity, can achieve almost the same accuracy as the brute-force baseline on two public datasets. Moreover, we show that, in a live production recommendation system, a deployed DR approach significantly outperforms a well-tuned ANN baseline in terms of engagement metrics. To the best of our knowledge, DR is among the first non-ANN algorithms successfully deployed at the scale of hundreds of millions of items for industrial recommendation systems.

Introduction

In large-scale recommendation systems, the goal is to find the most relevant items for a user out of millions or billions. Traditionally, this is done in two disconnected steps: first, training a model to embed users and items into a continuous vector space, and second, using Approximate Nearest Neighbor (ANN) or Maximum Inner Product Search (MIPS) to find items "close" to the user.

However, this approach has two major flaws. First, the simple inner product of vectors might not be expressive enough to capture complex user-item interactions. Second, the retrieval structure (the ANN index) is usually built after the model is trained; it isn't optimized for the actual data, leading to a "retrieval gap." While tree-based models have tried to solve this, they often struggle with data sparsity at the leaf level—there simply isn't enough interaction data for every single item to learn a perfect position in a massive tree. Deep Retrieval (DR) moves away from this paradigm by learning a discrete, retrievable structure directly from user-item interaction data.

The Deep Retrieval Architecture

The core of the paper is the DR structure, which replaces the continuous vector space with a discrete latent space. Instead of a tree, DR uses a $K \times D$ matrix for indexing. An item is represented by a "path"—a sequence of $D$ indices (one from each layer of width $K$).

In this structure, a path $c = [c_1, c_2, ..., c_D]$ is learned for each item. The model architecture uses a multi-layer perceptron (MLP) and softmax at each layer. To predict the next step in a path, the model takes the user's embedding and the embeddings of the previous steps in the path as input. This sequential dependency allows the model to capture hierarchical relationships between items.

The DR structure and path probability construction.

Learning and Inference

DR uses an Expectation-Maximization (EM) style algorithm for joint optimization. In the E-step, it optimizes the neural network parameters. In the M-step, it updates the item-to-path mappings (clustering). This ensures the structure itself evolves to better represent the data. Unlike trees where an item lives at one leaf, DR allows an item to be assigned to multiple paths. This captures "multi-aspect" properties—for instance, a cake might be categorized as both "food" and a "gift."

During serving, the model doesn't calculate scores for every item. It uses beam search to navigate the $K \times D$ structure, finding the most probable paths in sub-linear time. This "coarse-to-fine" structure allows the model to learn from shared behaviors, mitigating the data scarcity issues that plague large-scale trees.

Streaming Updates for Production

Real-world recommendation systems require the ability to handle rapidly shifting item popularities and new user interactions. DR introduces a mechanism for updating path scores in a streaming fashion. As new interaction data arrives, new scores are calculated and merged with existing recorded scores using a decay factor $\eta$. This ensures that the retrieval index remains fresh and responsive to current trends without the need for constant full-model retraining.

The streaming update process for path scores.

Experimental Results

The authors evaluated DR on two widely used public benchmarks: MovieLens-20M (~20 million ratings) and Amazon Books (~8.6 million interactions across ~1.5 million items). Crucially, they also deployed and tested the system on a live production short-video platform at ByteDance, involving hundreds of millions of users and items.

  • Accuracy: On public datasets, DR achieved nearly the same precision and recall as a "brute-force" search (the theoretical upper bound), significantly outperforming standard ANN baselines and previous tree-based models like TDM and JTM.
  • Efficiency: DR's inference time on the Amazon Books dataset was 4x faster than brute-force retrieval.
  • Production Impact: In A/B tests on a live system, DR showed significant gains in user engagement, including a +3.0% increase in video finish rate and a +0.87% increase in app view time.

Conclusion

Deep Retrieval represents a significant advancement in large-scale recommendation by bridging the gap between model learning and retrieval structure. By optimizing both jointly in an end-to-end fashion, DR achieves high accuracy with sub-linear complexity. Its successful deployment at the scale of hundreds of millions of items demonstrates its robustness and efficiency for industrial applications. Future work includes incorporating item metadata and negative feedback to further enhance the retrieval quality.

Summary updated

BibTeX
@misc{gao2020deep,
  author = {Weihao Gao and Xiangjun Fan and Jiankai Sun and Kai Jia and Wenzhi Xiao and Chong Wang and Xiaobing Liu},
  title = {{Deep Retrieval: An End-to-End Learnable Structure Model for Large-Scale Recommendations}},
  year = {2020},
  eprint = {2007.07203},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2007.07203},
}
Figure