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

1 INTRODUCTION . Recommendation systems have gained great success in various commercial applications for decades . The objective of these systems is to retrieve relevant candidate items from an corpus based on user features and historical behaviors . One of the early successful techniques of recommendation systems is the collaborative filtering ( CF ) , which makes predictions based on the simple idea that similar users may prefer similar items . Item-based collaborative filtering ( Item-CF ) ( Sarwar et al. , 2001 ) extends the idea by considering the similarities between items and items , which lays the foundation for Amazon ’ s recommendation system ( Linden et al. , 2003 ) . In the Internet era , the amount of candidates from content platforms and the number of active users in those platforms rapidly grow to tens to hundreds of millions . The scalability , efficiency as well as accuracy are all challenging problems in the design of modern recommendation systems . Recently , vector-based retrieval methods have been widely adopted . The main idea is to embed users and items in a latent vector space , and use the inner product of vectors to represent the preference between users and items . Representative vector embedding methods include matrix factorization ( MF ) ( Mnih & Salakhutdinov , 2008 ; Koren et al. , 2009 ) , factorization machines ( FM ) ( Rendle , 2010 ) , DeepFM ( Guo et al. , 2017 ) , Field-aware FM ( FFM ) ( Juan et al. , 2016 ) , etc . However , when the number of items is large , the cost of brute-force computation of the inner product for all items can be prohibitive . Thus , maximum inner product search ( MIPS ) or approximate nearest neighbors ( ANN ) algorithms are usually used to retrieve top relevant items when the corpus is large . Efficient MIPS or ANN algorithms include tree-based algorithms ( Muja & Lowe , 2014 ; Houle & Nett , 2014 ) , locality sensitive hashing ( LSH ) ( Shrivastava & Li , 2014 ; Spring & Shrivastava , 2017 ) , product quantization ( PQ ) ( Jegou et al. , 2010 ; Ge et al. , 2013 ) , hierarchical navigable small world graphs ( HNSW ) ( Malkov & Yashunin , 2018 ) , etc . Despite their success in real world applications , vector-based algorithms has two main deficiencies : ( 1 ) The objective of learning vector representation and learning good MIPS structure are not well aligned for the recommendation task ; ( 2 ) The dependency on inner products of user and item embeddings might not be sufficient to capture the complicated structure of user-item interactions ( He et al. , 2017 ) . In order to break these limitations , tree based models ( Zhu et al. , 2018 ; 2019 ; Zhuo et al. , 2020 ) , TDM/JDM , have been proposed . These methods use a tree as indices and map each item to a leaf node of the tree . Learning objectives for model parameters and tree structures are well aligned to improve the accuracy . However , the number of parameters in these models are proportional to the number of clusters , making the tree structure itself difficult to learn — data available at the leaf level can be scarce and might not provide enough signal to learn a good tree at a finer level . In this paper , we proposed an end-to-end learnable structure model — Deep Retrieval ( DR ) . In DR , we use a K⇥D matrix as in Figure 1a for indexing , motivated by Chen et al . ( 2018 ) . In this structure , we define a path c as the forward index traverse over matrix columns . Each path is of length D with index value range { 1 , 2 , . . . , K } . There are KD possible paths and each path can be interpreted as a cluster of items . There are two major characteristics in designing the structure . First , There is no “ leaf node ” as that in a tree , so the data scarcity problem of learning the tree based model can be largely avoided in DR ’ s structure . Second , each item can be indexed by one or more paths — each path could contain multiple items and each item could also belong to multiple paths . This property is naturally accommodated using our probabilistic formulation of the DR model as we will show below . This multiple-to-multiple encoding scheme between items and paths differs significantly with the one-to-one mapping used in tree structure design . In training , the item paths are learnt together with the neural network parameters of the structure model using an expectation-maximization ( EM ) type algorithm ( Dempster et al. , 1977 ) . The entire training process is end-to-end and can be easily deployed for large-scale content platforms . The rest of the paper is organized as follows . In Section 2 , we describe the structure model and its structure objective function used in training in detail . We then introduce a beam search algorithm to find candidate paths in the inference stage . In Section 3 , we introduce the EM algorithm for training neural network parameters and paths of items jointly . In Section 4 , we demonstrate the performance of DR on two public datasets : MovieLens-20M1 and Amazon books2 . Experiment results show that DR can almost achieve the brute-force accuracy with sub-linear computational complexity . In Section 5 , we conclude the paper and discuss several possible future research directions . 2 DEEP RETRIEVAL : AN END-TO-END STRUCTURE MODEL . In this section , we introduce the DR structure model in detail . First , we show how we establish the probability function for user x to select path c given the model parameters ✓ . This follows the extension to the multi-path mechanism that enables DR to capture multi-aspect properties of items . 1https : //grouplens.org/datasets/movielens 2http : //jmcauley.ucsd.edu/data/amazon We then introduce the penalization design that prevents collapsing in allocating items to different paths . Next we describe the beam search algorithm for retrieval . Finally , we present the multi-task joint training procedure of DR with a reranking model . 2.1 THE DR MODEL . The basic model . The DR model consists of D layers with K nodes , with DK nodes in total . In each layer , we use a multi-layer perceptron ( MLP ) 3 with skip connections and softmax as output . Each layer takes an input vector and outputs a probability distribution over { 1 , 2 , . . . , K } based on parameters ✓ . Let V = { 1 , . . . , V } be the labels of all items and ⇡ : V ! [ K ] D be the mapping from items to paths . Assume we are given mapping ⇡ in this section and will introduce the algorithm for learning the mapping together with ✓ in Section 3 . In addition , for the mapping ⇡ , we assume an item only belongs to one path and we would extend it to the multi-path setting in next section . Given a pair of training sample ( x , y ) , which denotes a positive interaction ( click , convert , like , etc . ) between user x and item y , as well as the path c = ( c1 , c2 , . . . , cD ) associated with the item y , the probability p ( c|x , ✓ ) is constructed layer by layer as follows ( see Figure 1b for a flow chart ) , • The first layer takes the user embedding emb ( x ) as input , and outputs a probability p ( c1|x , ✓1 ) over the K nodes of the first layer , based on parameters ✓1 . • From the second layer onward , we concatenate the user embedding emb ( x ) and the embeddings of all the previous layers emb ( cd 1 ) ( called path embeddings ) as the input of MLP , and output p ( cd|x , c1 , . . . , cd 1 , ✓d ) over the K nodes of layer d , based on parameters ✓d . • The probability of path c given user x is the product of the probabilities of all the layers ’ outputs . p ( c|x , ✓ ) = DY d=1 p ( cd|x , c1 , . . . , cd 1 , ✓d ) . ( 1 ) Given a set of N training samples { ( xi , yi ) } Ni=1 , the log likelihood function of the structure model is Qstr ( ✓ , ⇡ ) = NX i=1 log p ( ⇡ ( yi ) |xi , ✓ ) . ( 2 ) The size of the input vector of layer d is the embedding size times d , and the size of the output vector is K. The parameters of layer d have a size of ⇥ ( Kd ) . The parameters ✓ contain the parameters ✓ds in all layers , as well as the path embeddings . The parameters in the entire model have an order of ⇥ ( KD2 ) , which is significantly smaller than the number of possible paths KD when D 2 . Multi-path extension . In tree-based deep models ( Zhu et al. , 2018 ; 2019 ) as well as the structure model we introduced above , each item belongs to only one cluster/path , limiting the capacity of the model to express multi-aspect information in real data . For example , an item related to kebab could belong to a “ food ” cluster . An item related to flowers could belong to a “ gift ” cluster . However , an item related to chocolate or cakes could belong to both clusters in order to be recommended to users interested in either food or gifts . In real world recommendation systems , a cluster might not have an explicit meaning such as food or gifts , but this example motivates us to assign each item to multiple clusters . In DR , we allow each item yi to be assigned to J different paths { ci,1 , . . . , ci , J } . Let ⇡ : V ! [ K ] D⇥J be the mapping from items to multiple paths . Then the multi-path structure objective is straightforwardly defined as , Qstr ( ✓ , ⇡ ) = NX i=1 log 0 @ JX j=1 p ( ci , j = ⇡j ( yi ) |xi , ✓ ) 1 A . ( 3 ) This is because the probability belonging to multiple paths is simply the summation of the probabilities belonging to individual paths . 3Other neural network architectures such as recurrent neural networks ( RNN ) can also be applied here . Since D is not very large in our settings , for simplicity , we use MLP . Penalization on size of paths . Directly optimizing Qstr ( ✓ , ⇡ ) w.r.t . the item-to-path mapping ⇡ could fail to ensure to allocate different items into different paths . ( We did observe this in practice . ) In an extreme case , we could allocate all items into a single path and the probability of seeing this single path given any user x is 1 as in Eq . 1 . This is because there is only one available path to chose from . However , this will not help on retrieving the top candidates since there is no differentiation among the items . We must regulate the possible distribution of ⇡ to be diverse . We introduce the following penalized likelihood function , Qpen ( ✓ , ⇡ ) = Qstr ( ✓ , ⇡ ) ↵ · X c2 [ K ] D f ( |c| ) ( 4 ) where ↵ is the penalty factor , |c| denotes the number of items allocated in path c and f is an increasing and convex function . A quadratic function f ( |c| ) = |c|2/2 controls the average size of paths , and higher order polynomials penalize more on larger paths . In our experiments , we use f ( |c| ) = |c|4/4 .

Summary: The paper presents a method for "end-to-end" learning for retrieving top-k items in recommendation system setup. This is achieved by learning the hidden representations of the items and under neural network as a single objective function optimized using the expectation maximization framework. It is claimed that the proposed method achives better results than state-of-the-art tree-based models and those approaches which learn these components separately.