T OTAL R ECALL : A B IDIRECTIONAL C ANDIDATES G ENERATION F RAMEWORK FOR L ARGE S CALE R ECOMMENDER & A DVERTISING S YSTEMS
Anonymous authors
Paper under double-blind review
A BSTRACT
Recommender (RS) and Advertising/Marketing Systems (AS) play the key roles in E-commerce companies like Amazon and Alibaba.
RS needs to generate thousands of item candidates for each user ( u 2 i ), while AS needs to identify thousands or even millions of high-potential users for given items so that the merchant can advertise these items efficiently with limited budget ( i 2 u ).
This paper proposes an elegant bidirectional candidates generation framework that can serve both purposes all together.
Specifically, our framework finds its practical applications on generating millions of users for a large number of items, and the marketing scenarios of small and medium enterprises (SMEs) with cloud-service.
Besides, our framework is also superior in these aspects: i ) .
We theoretically show that our modeling objective is equivalent to the modeling objectives of the SOTA algorithms if measured by the metrics of u 2 i
and i 2 u . ii ) .
Our framework can easily incorporate many DNN-architectures, and achieve SOTA results as measured by the metrics for both u 2 i and i 2 u . iii ) .
We empirically show that our framework can diversify the generated candidates, and ensure fast convergence.
I NTRODUCTION
In the Internet era, E-commerce companies usually act as a platform to connect both users and merchants.
They can collect huge amount of data of users’ behavior on merchants’ items, and utilize the data to serve them better, for example, to build better search/recommender/advertising systems.
When users browse the E-commerce websites/apps, they usually want to buy some desired items, or find something interesting, and that’s what the search engine and recommender system ( RS ) are built for.
Besides, the merchant usually wants to mine the potential users of its items, and then starts a campaign to prompt those users to buy the items.
The advertising system has the functionality to help the merchant, and we may call it the potential users mining system ( PUMS ).
In an industrial large-scale RS, there are usually two stages, the candidates generation ( CG ) stage and the ranking stage (Covington et al., 2016).
CG plays a very import role as it sets the upper bound of the recommender.
A single CG method usually lacks diversity, so the industrial CG system usually consists of different subsystems to generate candidate items, for example, i ) .
hot items, ii ) .
items similar to users (Covington et al., 2016; Li et al., 2019), iii ) .
items similar to clicked items (Linden et al., 2003), iv ) .
items clicked by similar users (Wang et al., 2006).
The PUMS has been studied and applied in marketing community for many years (Bult & Wansbeek, 1995;
Kim et al., 2005), and recently it is also introduced to social network to attract potential customers of companies (Pennacchiotti & Popescu, 2011; Pang et al., 2013).
Similarly in E-commerce companies, it can be used to discover potential customers for merchants, brands and etc.
Although it is widely used, people usually treat it as a simple binary classification problem, i.e., to predict whether a given user is the potential user or not.
Models like LR, SVM, XGBoost and etc.
(Hosmer Jr et al., 2013; Chang & Lin, 2011; Chen & Guestrin, 2016) are usually employed.
In this paper, we unify the two systems in our TotalRecall ( TR ) framework, and apply it in both large-scale PUMS and marketing scenarios of SMEs with the cloud-service.
Our main contributions are listed below:
• Bidirectional Candidates Generation : TR can be trained once and then used to generate candidate items ( u 2 i ) and users ( i 2 u ) all together without any additional operations.
Theoretically we show that it is due to the modeling of joint probability of u and i .
Achieving SOTA results in both RS and PUMS : We compare to two different algorithms,
i
e., Matrix Factorization ( MF ) with Bernoulli distribution and sequential modeling and MF with Multinomial distribution, and achieve comparable or better results than previous SOTA.
• Equivalence of the algorithms based on Bernoulli and Multinomial distributions : To the best of our knowledge, we are the first to show that modeling the user-item interaction with Bernoulli and Multinomial distributions are equivalent.
• Fast Convergence, and Diversified Candidates : TR converges much faster compared to MF models, up to 16 × times.
Our experiments show that TR can increase the diversity of the generated candidates.
R ELATED W ORK 2. R ECOMMENDER S YSTEM (RS)
RS has been studied for many years, and in the early years, Collaborative Filtering ( CF ) and its variants (Su & Khoshgoftaar, 2009) are widely adopted.
Later its descendant MF (Funk) is proposed to solve the problem more elegantly with higher accuracy, and Probabilistic Matrix Factorization ( PMF ) (Mnih & Salakhutdinov, 2008) builds a solid theoretic foundation for MF based on probability theory.
Although MF performs very well in many datasets (Rendle et al., 2020), it is usually not adopted in industry.
The modern industrial RS can involve up to billions of users and hundreds of millions of items, and consist of multiple stages, e.g., CG and ranking stages (Covington et al., 2016).
Various deep neural networks are adopted to tackle the complicated system, for example, in the CG stage, the problem is formulated as the multi-class classification, and users’ and items’ representations are detached with the two-tower architecture to balance the efficiency and accuracy in online serving (Covington et al., 2016; Li et al., 2019; Cen et al., 2020).
In the ranking stage, the problem is formulated as the binary classification, and various models has been developed: wide & deep model (Cheng et al., 2016) captures explicit and implicit feature crossing,
Deep Interest Network (Zhou et al., 2018) and Deep User Perception Network (Ni et al., 2018) utilize attention mechanism (Bahdanau et al.
to capture users’ short-term interests.
2. P OTENTIAL U SERS M INING S YSTEM (PUMS)
PUMS mines the potential users for given items.
The ‘item’ could be anything that users can interact with, for example, an insurance product (Kim & Street, 2004), a company/business (Pennacchiotti & Popescu, 2011; Pang et al., 2013;
Lo et al., 2016), a specific information (e.g., tweet) in social medias (Tang et al., 2015; Gui et al., 2019) and even another user (Guy, 2018).
These problems are usually treated as binary classification and solved with tools like SVM, LR and etc.
for each individual item independently (Hosmer Jr et al., 2013; Chang & Lin, 2011; Chen & Guestrin, 2016).
In the E-commerce company like Amazon, the ‘item’ could be a product, a brand, a product category, a merchant and etc, and the number of the ‘items’ range from thousands to hundreds of millions.
It will be impractical to model each item individually, so we usually model the items all together using binary classification similar to Rendle et al.
(2020), which will be stated in detail later in Sec.
2. S AMPLED - SOFTMAX AND I NFO NCE LOSS
In the CG stage of RS, sampled-softmax ( SSM ) loss (Jean et al., 2015) is widely used with different background distributions, such as log-uniform distribution (Powers, 1998), empirical marginal distribution (Yi et al., 2019) and mixed distribution (Yang et al., 2020).
In contrastive learning, InfoNCE loss is proposed in Oord et al.
(2018) to learn representations through self-supervision.
Later it is widely adopted in CV (Chen et al.
and NLP (Gao et al.
and performs very well.
InfoNCE and SSM losses are both trying to solve multi-class classification of very large vocabulary.
They both use negative sampling and can be written in the same analytical form:
[Equation]
where ( x, y ) ∈ D is the training data, and usually x is the input features and y is the class, f ϑ ( x, y ) is the output of the neural network parametrized by ϑ , and Y x contains hundreds or thousands of negative samples from background distribution p n ( y | x ) .
The main differences are that the p n ( y | x ) in SSM can be arbitrarily chosen, while in InfoNCE it is the empirical marginal distribution ˆ p data ( y ) .
Recently, InfoNCE loss is exploited in RS to optimize p ( y | x ) p ( y ) instead of p ( y | x ) for the debiasing purpose, and it can be easily implemented with in-batch negative sampling and features of y can be fully utilized (Zhou et al., 2021).
M ETHOD 3. P ROBLEM D EFINITION
In E-commerce companies, when a user u clicked an item i at time t , a record ( u, i, t ) was logged as the implicit feedback.
Given the raw logs { ( u, i, t ) } , there are usually two ways to process the data: one is to directly create a user-item interaction matrix S ui with the value s u,i = 1 if the ( u, i ) pair appears in the log (Su & Khoshgoftaar (2009)); the other is to formulate the problem as next-item prediction, i.e., from the raw log we create a dataset D
= { ( x u,t , y u,t ) : t ∈ { 1 , 2 , ..., T u }| u ∈ { 1 , 2 , ..., N }} , where x u,t = { y u, 1:( t − 1) } represents u ’s clicks prior to t -th click y u,t and T u is the number of clicks of u (Covington et al.
We define the click sequence x u,t as the pseudo-user, so we can create a pseudo-user-item interaction matrix from D , and all possible click sequences form the pseudo-user set.
Therefore, they both deal with the 2D interaction matrix S ui , irrespective of whether the u is a real user or pseudo-user or not.
In the remaining of the paper, we will not distinguish between user and pseudo-user, and only focus on solving the S ui .
S ui consists of all users as the row and all items as the column, and its entries are either 1 or unknown.
Let’s assume all users form the set U
= { u 1 , u 2 , ..., u M } , and all items form the set
I =
{ i 1 , i 2 , ..., i K } .
Given a user u ∈ U , we will generate candidate items from the item pool I (RS, u 2 i ), while given an item i ∈
I , we shall find out the potential users out of all users U (PUMS, i 2 u ).
The candidates generation of RS and PUMS are of the opposite direction, and traditionally they are solved separately.
But essentially they are both trying to estimate some kind of probabilities of the unknown entries in S ui , so we propose to model them jointly.
3. R ECOMMENDER S YSTEM
In RS, there are usually two types of modeling objectives when dealing with S ui , and we briefly introduce them in the following sections (See App.
A.1 for more details).
3.2. G AUSSIAN AND B ERNOULLI D ISTRIBUTION
The u - i interaction score s u,i of S ui is treated as the random variable, and assumed to be i.i.d.
following a certain distribution, for example, Gaussian (Mnih & Salakhutdinov (2008)) or
Bernoulli (Johnson (2014); He et al. (2017); Rendle et al.
(2020)) distributions.
3.2. M ULTINOMIAL D ISTRIBUTION
Here the modeling objective is the random variable s u , defined as the interacting item of u .
For example, given the total number of interactions N u
= (cid:80) i ∈
I s u,i of u , s u is assumed to be sampled from a multinomial distribution Mult ( N u , p u ) , where p u is a K -dimensional vector whose elements are the probability and sum to 1 (Liang et al., 2018).
Although not explicitly stated in many papers (Covington et al., 2016; Yi et al., 2019; Li et al., 2019; Cen et al., 2020), the multinomial distribution is actually assumed.
The modeling objectives in Sec.
3.2.1 and 3.2.2 are quite different, as the former is s u,i and the latter is s u .
In MF, we usually model s u,i , while in the sequential modeling of the CG stage in industry, we model s u .
Later in Sec.
3.5, we will show that modeling s u and s u,i can be theoretically equivalent, and it is verified by the experiments in Sec.
4.1 and 5.
However, modeling s u can boost the converging speed a lot.
3. P OTENTIAL U SERS M INING S YSTEM
The PUMS seems to be the twin system of RS, and similarly we could also define two modeling objectives s u,i and s i , where s i denotes the user who interacts with the item i .
s u,i and s i are assumed to follow Bernoulli and Multinomial distributions respectively.
In Sec.
5 we will compare the two methods.
3. T OTAL R ECALL : U NIFICATION OF RS AND PUMS
Motivated by Sec. 3.2 and 3.3, we propose to model the two systems jointly.
Specifically, the optimization objectives s u and s i in Sec.
3.2.2 and 3.3 are formulated in one framework and optimized together.
Later we show that by properly choosing the model architecture and loss function, we are treating u and i equally and modeling the joint probability.
[Equation]
3.4. M ODEL A RCHITECTURE
We choose the classical two-tower architecture (Huang et al., 2013; Covington et al., 2016; Rendle et al., 2020) for two reasons: one is that users and items can be treated equivalently, and the other is that no feature crossing occurs before the final logits (See Fig. 1).
So users’ and items’ embeddings can be inferred separately, and then approximate nearest neighbor (ANN) (Liu et al., 2004) search algorithm can be applied in online serving.
The output of two towers are d -dimensional vectors u
= f θ ( u ) ∈ R d
and i =
g θ ( i ) ∈ R d , where θ is the model parameter.
The dot product ⟨ u | i ⟩ , or the function of it is used as the sufficient statistics of the probability distributions defined in Sec.
3.2 and 3.3 (Check App. A.1 for details).
We find that l2-normalizing u and i and then rescaling the dot product by the temperature τ will lead to better and robust results:
[Equation]
3.4. L OSS F UNCTION
We propose the Bi-InfoNCE loss:
[Equation]
where I u ⊂ I and U i ⊂ U contain hundreds or thousands of in-batch negative samples, and q ( i ) and ˆ q ( u ) are empirical marginal distribution calculated using the training data S ui .
It can be shown that optimizing this loss will make ϕ θ ( u, i ) converge to log ˆ p data ( u, i )
(See App. A.3 for details.).
If we only optimize the first part of Eq. 3, ϕ θ ( u, i ) will converge to log ˆ p data ( i | u ) , and optimizing only the second part will let ϕ θ ( u, i ) converge to log ˆ p data ( u | i ) .
We refer to the two cases as UniInfoNCE losses.
3. E QUIVALENCE BETWEEN MODELING WITH B ERNOULLI AND M ULTINOMIAL DISTRIBUTIONS
As discussed in the previous sections, we can use both Bernoulli and Multinomial distributions to model the same user-item interaction matrix S ui , and usually their results are comparable in both
RS and PUMS (See Sec.
4.1 and 5).
The apparent connection between the two algorithms motivates us to explore their relations, and we prove that they are theoretically equivalent on modeling the user-item interaction matrix.
Specifically, different negative sampling methods of Bernoulli distribution correspond to different objectives modeled with Multinomial distributions.
For example, in MF with Bernoulli distribution (MF b ), we could have 5 different negative sampling methods, i.e., for a given positive ( u, i ) pair, we sample the negative pairs in these ways: 1) .
‘MF b [0:8]’ 1 , we randomly sample 8 i s from the item set I , and construct 8 negative pairs with the given u ; 2) .
‘MF b [8:0]’, we sample 8 u s from the user set U , and construct 8 negative pairs with the given i ; 3) .
‘MF b [4:4]’, we sample 4 u s and 4 i s, and construct 8 negative pairs with the given i and u respectively; 4) .
similar to 3)
, but the negative samples are doubled; 5) .
‘MF b [8]’, we sample( u, i ) pairs uniformly from the M × K pairs with i ∈
I and u ∈ U as the negative pairs.
We prove that 1) is equivalent to modeling p ( i | u ) , 2) to p ( u | i ) , 3) and 4) to p ( u,i ) p ( u ) p
( i ) , and 5) to p ( u, i ) .
The details can be found in App.
A.4.
3. M OTIVATION AND P RACTICAL APPLICATIONS OF TR
TR is developed to solve two practical problems: one is the large-scale potential users mining, and the other is the marketing in SMEs.
[Table]
For example
[Table]
we have 1 billion users and 10,000 items
[Table]
and we need to mine the top 1 million users for each of the items.
This problem can be easily solved with TR: we infer the users’ and items’ embeddings with TR
[Table]
and then apply the ANN search to find the top 10 items for each user.
Now we have 10 billion ( u, i ) pairs and their similarity scores
[Table]
and we just pick the top 1 million for each item based on the same scores.
This method also indirectly ensures that each person will receive at most 10 advertisement messages.
This can only be achieved if we model the joint probability p ( u, i ) .
We also list some alternative methods to solve the problem in App.
A.5, but they are either not good in terms of accuracy or not practical in terms of computation and storage costs, efficiency, risk and maintainability.
TR has been deployed in our production environment to serve this purpose.
In the marketing scenario of SMEs, two strategies are widely adopted: i ) .
SMEs pick some specific groups of users, and then choose the top products for each user and send the personalized campaign messages.
This can be regarded as the RS. ii ) .
SMEs have some new or special products and want to find the target users.
This is the PUMS.
The two marketing requirements can be completed either with two separate models or with the unified model TR.
Due to the limited computation and storage budgets, and the shortage of talents,
TR is the best choice for them.
Actually, TR is already implemented in one of our cloud-service products for SMEs.
E XPERIMENTS : RS
As stated in Sec. 3.2, two types of modeling objective are well studied in literature, and usually they use different datasets and baselines.
So we compare our results with them separately using different datasets.
The details of the datasets and processing methods can be found in App. A.6.
4. MF WITH B ERNOULLI D ISTRIBUTION
We compare TR to MF b in Rendle et al.
(2020), as described in Sec.
Our implementation of
MF b is a bit different from Rendle et al.
(2020): we implement it using tensorflow (Abadi et al., 2016) with Adam optimizer (Kingma & Ba, 2014).
We tried L2 regularization but failed to obtain the results reported by Rendle et al.
We also tried dropout (Srivastava et al., 2014), but it was unstable and need to be re-tuned for different dimensions d .
Finally we find that the ϕ θ ( u , i ) defined in Eq.
2 can actually act as a kind of regularization, so we use it rather than the one defined by Eq.
(2) in Rendle et al.
We use Movielens-1m and Pinterest datasets, and the evaluation metrics are HiteRate@10 and
NDCG@10.
MF b and TR have the same two-tower architecture and same number of parameters, and the key differences are the training data and the optimizing objectives: MF b uses explicit negative sampling, i.e., MF b [0:8], and optimize the binary cross-entropy loss, and TR uses implicit in-batch negative sampling and Bi-InfoNCE loss.
[Table]
The results are shown in Tab. 1.
In general, MF b and TR are comparable
[Table]
and this is consistent with our theory in Sec.
3.5, because they are both modeling p ( i | u ) or p ( u, i ) ultimately.
Besides, the diversity of TR is also larger than MF b as shown in Fig.
(Check App.
A.6.1 for more details.)
When measuring the training efficiency, TR converges to the optima up 16 × times faster than MF b (See Fig.
3 in Appendix).
We attribute it to two reasons: i ) .
For MF b [0:8] used here, 9 processed samples will consist of only 1 positive samples on average.
While in Bi-InfoNCE (or Uni-InfoNCE / SSM), 9 processed samples are all positive samples.
ii ) .
For MF b , each sample is either positive or negative, and the binary-cross-entropy loss allows it to compare with itself only.
In TR, Bi-InfoNCE (or Uni-InfoNCE / SSM) loss will compare each sample with all the other samples in the batch.
Bearing in mind that MF b and Bi/Uni-InfoNCE can theoretically converge to the same optimum, the qualitative explanation can provide some intuitive understandings of the fast convergence.
The fast converging speed makes it more practical to use TR in industrial applications with huge amount of data.
4. S EQUENTIAL M ODELING WITH M ULTINOMIAL D ISTRIBUTION
We compare TR to the sequential modeling with Multinomial distribution, as described in Sec. 3.2.2.
This modeling method is usually used in the CG stage of industrial large-scale RS, because it can deal with huge amount of data very efficiently, and yield good results.
For simplicity, we use the popular Youtube DNN (Covington et al., 2016) implemented by Cen et al.
as the backbone architecture of TR.
Other complicated architectures can be easily incorporated into TR framework.
We use the same datasets as Cen et al.
for a fair comparison, i.e., Amazon books data 2 and
Taobao click data in Tianchi competition 3 .
The data is split into train, validation and test data.
The training data is usually processed as next-item prediction as in Sec. 3.1, and we extend it into next- n -item prediction, i.e., instead of predicting only the next item, we predict all the next n items.
The results are shown in Tab. 2.
More results are shown in Fig.
4 and 5 in Appendix.
Our experiments show that proper regularization using l2-normalization and the scaling parameter τ can greatly improve the results, as it confines ϕ
θ ( u, i ) inside [ − 1 /τ, 1 /τ ] .
Better training data due to next- n -prediction can also improve the results, because it alters the distribution of the training data so that it gets close to the test data (See Fig. 6 in Appendix).
Besides, we have three observations.
i ) .
Comparable results : TR’s result is comparable to the
SOTA results from SSM and Uin-InfoNCE.
This shows that the modeling objectives p ( u, i ) and p ( i | u ) perform similarly if measured by the metrics for u 2 i candidate generation.
ii ) .
Improved diversity :
We try SSM with different background distributions, and compare with Uni-InfoNCE and Bi-InfoNCE, and find that Bi-InfoNCE gives better overall diversity as measured by the related metrics (See Fig. 4 in Appendix).
We don’t have a rigorous explanation and would like to leave it for the future study.
iii ) .
Faster convergence : Compared to SSM or Uni-InfoNCE without l2normalization, adding l2-normalization or using Bi-InfoNCE will make the models learn faster (See
Fig. 4 in Appendix).
This is because l2-normalization will restrict the vector space that u
and i could explore, and Bi-InfoNCE utilizes the data more efficiently compared to Uni-InfoNCE, i.e., the utilization rate is doubled.
E XPERIMENTS : PUMS
In E-commerce, there are usually two practical scenarios of i 2 u candidates generation: one is to mine the potential users for a single item, and the other is to find users for a group of similar items.
Because the marketing staff or some merchants regularly pick a group of similar items, and set the specific campaigns to advertise them.
Previously, the problem is usually formulated as the binary classification for each individual case, but it is not generally applicable because the number of items or groups could be quite large, and it is impractical to build so many models.
One solution is to merge all the binary classification models into one, just like MF b in Sec. 3.2. and 3.3.
The other is our TR framework.
5. D ATASET AND EVALUATION METRICS
We use Movielens-1m because it is also used in MF b of RS, and it can be used to mine the potential users of both the single item and the group of similar items.
Movielens-1m records 6040 users and 3706 movies.
The data is split into training, validation and test data, and we use the validation data to select the proper model configurations.
The final results are reported on the test data.
We use precision@10 and recall@10 to evaluate the accuracy of different algorithms, i.e., we mine the top 10 users for a single item or a group of items, and then evaluate the precision and recall.
We count the distinct users of the overall results to measure the diversity.
(See App.
A.7 for details about the dataset and metrics.)
5. P OTENTIAL U SERS OF A S INGLE ITEM
We first select movies which have been watched by at least 50 users, and it results in 2514 movies.
For each of these movies, we randomly pick 1% of its users to form the valid and test datasets, with half of the movies as the validation data and the other half as the test data (See App. A.7.).
The remaining data is used to train the model, and the validation data is for selecting the best hyperparameters, and the results are reported on the test data.
The results are shown in Tab. 3.
‘TR [Bi-InfoNCE]’ achieves the best results in terms of the accuracy and diversity.
High diversity implies that the advertisements can reach more users, even the nonactive users, thus alleviate the advertising fatigue.
Besides, TR uses the same training data and model configurations for both RS and PUMS, and achieves comparable in both cases.
The learned u/i representations can be applied to the two systems without any additional modifications.
In contrast, MF b ’s modeling objective (Eq. 4) seems to treat u and i equally, but the outcomes depend highly on the negative sampling methods (See Tab. 3).
This is consistent with our theoretical analysis in Sec. 3.5.
Last but not least, TR learns 16 × times faster than MF b (See Fig.
7 in Appendix).
The reason is the same as in Sec. 4.1.
Our study of mining potential users of a group of items can be found in App.
A.7.2.
[Table]
C ONCLUSION
In this paper, CF and the sequential modeling (i.e., next-item prediction) of RS, and PUMS are abstracted into a unified u - i interaction matrix S ui , and thus are treated equivalently as deriving some probabilities for the unknown entries from the known entries of S ui .
We also show their connections and differences based on probability theory.
We prove that modeling p ( s u,i = 0 / 1 | u, i ) with different sampling methods are equivalent to modeling p ( i | u ) , p ( u | i ) , p ( u, i ) and etc.
We propose the TR framework to solve u 2 i and i 2 u CG all together.
In TR, u and i are treated equally, and the joint probability p ( u, i ) is actually derived, instead of the conditional probability p
( i | u ) or p ( u | i ) .
Therefore, the learned representations of u and i in TR can be used in both u 2 i and i 2 u CG.
Our extensive experiments show that TR can achieve comparable and better results in each domain, and learns 16 × times faster than MF b .
Besides, TR generates diversified candidates.
In the future we plan to study the vector space of TR in depth, and try to unify different objects and users into one space, for example, products, merchants, brands, categories of products.
In such a space, everything is linked, and candidates generation can be applied on any pair of objects
A A PPENDIX A. D ISTRIBUTIONS
In Sec.
3.1 we define the interaction matrix S ui , and it has the known entries with value 1 and unknown entries.
Here we define a corresponding matrix P of the same shape, and its entries are the probabilities estimated by a certain algorithm.
In Sec.
3.2.1, the corresponding probability matrix P MF is defined as follows:
[Equation] [Equation]
where (cid:80) s u,i ∈{ 0 , 1 } p ( s u,i | u, i )
= 1 .
Here we can assume s u,i follows Gaussian distribution: s u,i ∼ N ( ϕ ( u , i ) , ˆ σ 2 ) , or Bernoulli distribution:
s u,i ∼ B ( σ ( ϕ ( u , i ))) , where σ ( · ) is the sigmoid function.
In Sec.
3.2.2, the probability matrix P u 2 i is:
[Equation]
(5) where (cid:80) s u ∈
I p ( s u | u ) = 1 .
For a given user u , s u ∼ Mult ( N u , p u ) ,
where p u =
( p u 1 , p u 2 , ..., p uK ) T is a K -dimensional vector, and its element p ui is defined as below:
[Equation]
In Sec.
3.3 of PUMS, we can define the specific P MF and P i 2 u by emulating Eq.
4 and 5.
For example, P i 2 u can be defined as below:
[Equation]
where s i denotes the user who will interact with the item i , and (cid:80) s i ∈
U p ( s i | i )
= 1 , and s i
∼ Mult ( N i , p i ) follows the Multinomial distribution, where p i =
( p 1 i , p 2 i , ..., p Mi ) T is a Mdimensional vector.
A. L OSS F UNCTIONS
In this paper, we focus on Bernoulli and Multinomial distributions, because they usually lead to better results than Gaussian distribution (He et al.
(2017); Rendle et al.
Following the maximum likelihood estimation (MLE) principle, the loss for Bernoulli distribution is:
[Equation]
where s u,i ∈ { 0 , 1 } , and s u,i = 1 are the positive entries in S ui , and s u,i = 0 are negative samples randomly sampled from the entries in S ui , and N B is the total number of records in the training data, including both positive samples and randomly sampled negative samples.
The loss for Multinomial distribution is softmax-cross-entropy loss:
[Equation]
In practice, the vocabulary I can be very large so that calculating the partition function (cid:80)
[Equation]
i ′ ) becomes impractical.
SSM and InfoNCE loss can be used to solve this problem:
[Equation]
where I u ⊂ I contains hundreds or thousands of negative samples, and p n ( i | u ) is a predefined background distribution.
It has been shown that optimizing Eq.
10 will make ϕ θ ( u, i ) converge to log ˆ p data ( i | u )
(Jean et al., 2015; Oord et al., 2018).
A. B I -I NFO NCE LOSS
Here we prove that ϕ θ ( u, i ) in Eq.
3 converges to log ˆ p data ( u, i ) .
In Eq.
3, in the optimum of the first part, following the proof by Jean et al.
; Oord et al.
(2018), we have exp( ϕ θ ( u,i ))
q i ∝ ˆ p data ( i | u ) q i , so we can assume:
[Equation]
u ) for a given u and any i .
Similarly, in the optimum of the second part, ϕ θ ( u, i ) =
log ˆ p data ( u, i ) − log ˆ p data ( i ) + g ( i ) for a given i and any u .
Thus, for any u and i , this will always hold: − log ˆ p data ( u ) + f ( u ) ≡ − log ˆ p data ( i ) + g ( i ) , so it must be some constant.
Then we have ϕ θ ( u, i ) =
log ˆ p data ( u, i ) + C , where C is some constant that is independent of u and i .
And when ϕ θ ( u, i ) converges to log ˆ p data ( u, i ) , both parts in
Eq.can reach their optima.
A. E QUIVALENCE BETWEEN B ERNOULLI AND M ULTINOMIAL DISTRIBUTIONS ON MODELING THE USER - ITEM INTERACTION MATRIX
Here we show that by properly choosing the training data distribution, ϕ θ ( u, i ) in Eq. 2 is actually approaching the conditional distribution p ( i | u ) or p ( u | i ) , or joint distribution p ( u, i ) , or p ( u,i ) p ( u ) p
( i ) .
Our derivation is inspired by Noise Contrastive Estimation (Gutmann & Hyv¨arinen, 2010).
In the modeling with Bernoulli distribution, we have two sets of samples, X and Y .
X is the set of positive samples and Y is the set of negative samples randomly sampled based on a certain distribution p n ( · ) .
Assume X = { x 1 , x 2 , ..., x L } contains L samples, and Y = { y 1 , y 2 , ..., y T } contains T samples, and Z = X
∪ Y = { z 1 , z 2 , ..., z L + T } contains all the L + T samples.
Here x l := ( u, i ) , y t :=
( u, i ) and z j := ( u, i ) , where u ∈ U and i ∈ I .
We assign each sample z
j a binary class C j : C j = 1 if z j comes from X , and C j = 0 if z j is from Y .
We assume the joint probability of positive samples in X is parameterized by θ is p model ( u, i ; θ ) =
p model ( z ; θ ) .
So we have the conditional probabilities:
[Equation]
The posterior probabilities are:
[Equation]
where
[Equation]
and we also have
[Equation]
So the log-likelihood is:
[Equation]
Through optimizing the binary classification using samples in Z and the corresponding binary classes C , we are actually recovering the MF with Bernoulli distribution defined in Sec.
The dot product ϕ θ ( u, i ) will converge to G ( z ; θ ) in Eq. 13:
[Equation]
Different negative sampling strategies will lead to very different optimal ϕ θ ( u, i ) .
For example, if we randomly sample n items for each positive ( u, i ) pair to form negative samples with the u , then we have p n ( z ) =
p n ( u, i )
=
ˆ p data ( u ) · 1 /K , where ˆ p data ( u ) is the empirical marginal probability of the positive samples.
Substitute p n ( z ) into Eq.
14, we have
[Equation]
Similarly, if we randomly sample n users for each positive ( u, i ) pair to form negative samples with the i , then ϕ θ ( u, i ) will converge to the conditional probability log p model ( u | i ; θ ) .
For each positive ( u, i ) pair, if we randomly sample n items to form negative samples with the u , and also n users to form negative samples with the i , then ϕ θ ( u, i ) will converge to the point-wise mutual information log
[Equation]
And if the negative samples are randomly sampled uniformly from all users and items globally, then ϕ θ ( u, i ) will converge to the joint probability log p model ( u, i ; θ ) .
Therefore, we show that MF with Bernoulli distribution and Multinomial distribution can be equivalent if we choose the proper negative sampling methods.
A. M OTIVATION AND P RACTICAL APPLICATIONS OF TR
For the example of mining potential users given 1 billion users and 10,000 items, we list all the alternative methods that we can think of:
For each item, we create the training sample, and then train a binary classification model, and finally predict for the 1 billion users and pick the top 1 million.
We need to repeat 10,000 times.
By emulating the RS, we model p ( u | i ) and obtain the embeddings of users and items, and then apply the ANN search (e
g., Faiss) to find the top 1 million users for each item.
This method has a serious defect: ANN has high accuracy if we retrieve the top hundreds or thousands of candidates, but its accuracy and efficiency drops dramatically if we extend the range to millions.
So, this method is not practical.
Also, we model p ( u | i ) and obtain the embeddings of users and items, and then do a brute force search: we calculate the similarity score of all the users and items, which is the Cartesian product of 1 billion users and 10,000 items, i.e., 10 trillion, and then we pick the top 1 million users for each item.
It’s very inefficient and consume huge number of resources.
We build two models for p ( i | u ) and p ( u | i ) respectively.
Then we use the embeddings of p ( i | u ) and apply the ANN search to find the top 10 items for each user.
Now we havebillion u-i pairs, and we use the embeddings from p ( u | i ) to calculate the similarity score of the u-i pairs, and finally pick the top 1 million for each item.
TR has just one less model than the last alternative and one less step, but in practice, it is problematic to maintain two correlated models, especially when they are very large.
Two models usually imply that the calculation is doubled, the storage is doubled, and the risk and instability are doubled.
To conclude, TR is the best choice that can balance the accuracy, efficiency, risk and maintainability in practice.
A. E XPERIMENT R ESULTS : RS A.6. MF WITH B ERNOULLI DISTRIBUTION
We compare to MF in Rendle et al.
(2020) using the same datasets: binarized Movielens-1m (Harper & Konstan, 2015) and a dataset from Pinterest (Geng et al., 2015).
Train and Evaluation Configurations
For each user, the last item is held out as the test set, and the second last is held out as the validation set, and the remaining as the training set.
We use the validation set and training set to select the best hyper-parameters, and then re-train the model using both training and validation sets.
Each user has his own candidates pool, and it consists of the withheld item and 99 sampled negative items.
During evaluation, the algorithm will score the 100 items and rank them by the score.
The hyper-parameters τ and batch-size are chosen using the validation data.
For Movielens-1m, we use τ = 0 .
125 , batch-size = 4096 for MF b , and τ = 0 .
111 , batch-size = 512 for TR.
For Pinterest, we use τ = 0 .
143 , batch-size = 8192 for MF b , and τ = 0 .
167 , batch-size = 8192 for TR.
We have d ∈ { 16 , 32 , 64 , 96 , 128 , 196 } for a comprehensive comparison.
Evaluation Metrics
Two evaluation metrics are employed to measure the performance of top- N ranked items:
[Equation]
15) where ˆ I u,N denotes the top- N ranked items for u , I u is the set of testing items, and δ ( · ) is the indicator function.
[Figure]
[Equation]
(16) where r u is the rank of the withheld item in the top- N items for u
Results
The performance of different methods is shown in Fig.
In general, MF with Bernoulli distribution and Multinomial distribution are comparable, which is consistent with our theory in Sec. 3.5.
The comparison of the converging speeds is shown in Fig.
We can see that modeling with
Multinomial distribution is much better than Bernoulli distribution.
A.6. S EQUENTIAL M ODELING WITH M ULTINOMIAL D ISTRIBUTION
We compare to the models implemented in ComiRec (Cen et al., 2020).
ComiRec provides the codes and two preprocessed datasets: Amazon books data (Ni et al., 2019) and Taobao click data (Zhu et al., 2018).
So we use the same datasets and evaluation metrics for a fair comparison.
Metrics and Comparing Methods
We use HitRate@ N and Recall@ N to measure the accuracy.
HitRate@ N is defined in Eq. 15, and
Recall@ N is defined below:
[Equation]
Metrics ‘Distinct items@ N ’ counts the distinct items of all users’ top-
N recommended list, and ‘Distinct cates@ N ’ counts the distinct categories of these items.
They measure the diversity of the recommendation results.
The comparing methods include the following:
[Figure]
[Table]
• MostPopular recommends the most popular items to all users.
• YouTube DNN (Covington et al., 2016) is a simple and very efficient neural network model adopted in the CG stage of the large-scale industrial RS.
• ComiRec-SA & ComiRec-DR (Cen et al., 2020) use self-attention (Vaswani et al., 2017) or dynamic routing (Sabour et al., 2017) to explicitly incorporate users’ diverse interests in the model’s architecture to increase accuracy and diversity.
Results
The results evaluated by the above metrics can be found in Fig.
We can see that their HitRate and
Recall are comparable, and this is consistent with our theory in Sec.
The diversity of TR with
Bi-InfoNCE is much better than other methods.
The performance of next- n -prediction are shown in Fig.
We investigate the KL Divergence of the marginal distributions of train and test data in Fig. 6, and show that the performance gain in Amazon data may be due to the reduced discrepancy between the train and test data.
In Taobao data, the discrepancy gets larger when we increase n , and in experiments the accuracy does not increase.
A. E XPERIMENT R ESULTS : PUMS
There are different ways of creating the validation and test datasets, such as randomly pickingusers for each chosen item or each group of items.
Here we choose to holdout 1% users for the practical reason: usually we mine the potential users based on the historical behaviors and then deliver advertisement to them in the future, and the implicit assumption is that the distribution of the future is close to the past, i.e., popular items in the past will be bought by more users in the future, and vice versa.
So we holdout validation and test datasets in accordance with the overall distribution to emulate the practical scenario.
A.7. P OTENTIAL U SERS OF A S INGLE ITEM
We create the training, validation and test data as described in Sec. 5.2.
The statistics of the resulting datasets is shown in Tab. 4.
The Metrics
Our evaluation metrics of accuracy are Precision@ N and Recall@ N :
[Equation]
where ˆ U i,N denotes the top- N ranked users for i and U i is the set of users for the testing item i .
[Equation]
U
[Equation]
We count the distinct users of all the test items to measure the diversity.
Results of Converging Speed
[Figure]
[Figure] [Figure]
In Amazon data, if we increase n , the discrepancy becomes smaller
[Figure]
and the accuracy also increases (See Fig. 5).
In Taobao data, the discrepancy gets larger when we increase n
[Figure]
and in experiments the accuracy does not increase.
[Figure] [Figure]
[Table]
The comparison of the converging speed can be found in Fig.
Similar to the results in Fig.
3 of
RS, TR is much faster than MF with Bernoulli distribution.
A.7. P OTENTIAL U SERS OF A G ROUP OF ITEMS
For a given genre, we define the popularity of its movies in this way: we first rank the movies based on the number of users who have watched them
[Table]
and then we pick the top/middle/bottom 10% movies as different groups.
So we obtained 54 groups from 18 genres.
In practice, movies of different genres and different popularity will behave very differently, e.g., precision and recall of popular Action movies and unpopular Western movies will differ a lot.
Movielens have 18 genres
[Table]
and we divide the movies of the same genre into 3 categories based on their popularity, so we can split the chosen movies into 54 groups.
Given a group and its affined items, we define its potential users this way: if a user interacts with one or more items in the group (excluding the items he has interacted previously), then he will be the potential users of the group.
For example, given the group G = { i 1 , i 2 , i 3 } and the user u 1 , if u 1 has interacted with i 1 in the historical data, then we cannot pick him as the potential user; if in the future data, u 1 interact with i 2 or i 3 , then he will be regarded as the potential user of G .
Different groups have different number of movies, e.g., the group ‘Drama-top10%’ containsmovies, while ‘Documentary top10%’ has only 3 movies, and their precision and recall will also differ a lot.
We report the averaged precision and recall over all groups in Tab. 5.
For small datasets like movie-lens-1m, the model generates the potential users of a group this way: for each item in the group, we first calculate ϕ θ ( u , i ) of Eq. 2, and then the score ˆ p TR ( u , i ) =
exp( ϕ θ ( u , i )) for TR and ˆ p MF ( u , i ) =
σ ( ϕ θ ( u , i )) 4 for MF b , with respect to the candidate users.
Thus each candidate user will have several scores, and then we aggregate the scores to obtain a match score between the user and the group, and finally pick the top- k users.
The aggregation methods could be max , mean or sum .
In Tab. 5, ‘MF b [0:8]’ and ‘TR [Uni-InfoNCE u 2 i ]’ are specifically for u 2 i CG of RS, so they give the worst results here.
Models tailored for i 2 u (‘MF b [8:0]’ and ‘TR [Uni-InfoNCE i 2 u ]’) and the general model for bidirectional CG (‘TR [Bi-InfoNCE’) perform much better.
The aggregation methods also affect the accuracy, and mean > max > sum .
If a user has scores with many items of the group, the sum could be high even if individual scores are low, and this also implies that the user has few interactions with the items of the group in the historical data.
So it would not be suitable that sum ranks this user high.
In contrast, mean and max will not have this problem, and mean considers more scores than just the max one and gives best results.