Recommendation systems are increasingly prevalent due to content delivery platforms, e-commerce websites, and mobile apps [30]. Most recommendation problems can be naturally thought of as predicting the user’s partial ranking of a large candidate pool of items. After obtaining the optimal ranking ordering, the recommender system can simply recommend top-K items in the list for each individual user. Usually rankings are made personalized to cater to users’ special tastes. In literature, this is formulated as the collaborative ranking problem [38]. The temporal ordering, determined by when users engaged with items, has proven to be an important resource to further improve ranking performance. We call the collaborative ranking setting with temporal ordering information the Temporal Collaborative Ranking problem in this paper.
Recent advances in deep learning, especially the discovery of various attention mechanisms [2, 33] and newer architectures [36, 4] in addition to classical RNN and CNN architecture in natural language processing, have allowed us to make better use of the temporal ordering of items that each user has engaged with. In particular, the SASRec model [16], inspired by the popular Transformer model in natural languages processing, has achieved state-of-art results in the temporal collaborative ranking problem and enjoyed more than 10x speed-up compared to earlier RNN[10] / CNN[34]-based methods. But at a closer look, the SASRec is inherently an un-personalized model without introducing user embeddings and this often leads to an inferior recommendation model in terms of both ranking performances and model interpretability. Although personalization is not needed for the original Transformer model [36] in natural languages understandings or translations, personalization plays a crucial role throughout recommender system literature [43] ever since the matrix factorization approach to the Netflix prize [19].
In this work, we propose a novel method, Personalized Transformer (SSE-PT), that introduces personalization into self-attentive neural network architectures. [16] found that adding additional personalized embeddings did not improve the performance of their Transformer model, and postulate that this is due to the fact that they already use the user history and the embeddings only contribute to overfitting. Although introducing user embeddings into the model is indeed difficult with existing regularization techniques for embeddings, we show that personalization can greatly improve ranking performances with recent regularization technique called Stochastic Shared Embeddings (SSE) [41]. The personalized Transformer (SSE-PT) model with SSE regularization works well for all 5 real-world datasets we consider, outperforming previous state-of-the-art algorithm SASRec by almost 5% in terms of NDCG@10. Furthermore, after examining some random users’ engagement history and corresponding attention heat maps used during the inference stage, we find our model is not only more interpretable but also able to focus on recent engagement patterns for each user. Moreover, our SSE-PT model with a slight modification, which we call SSE-PT++, can handle extremely long sequences and outperform SASRec in ranking results with comparable training speed, striking a balance between performance and speed requirements.
2.1 Collaborative Filtering and Ranking
Recommender systems can be divided into those designed for explicit feedback, such as ratings [21], and those for implicit feedback, based on user engagement [14]. Recently, implicit feedback datasets, such as user clicks of web pages, check-in’s of restaurants, likes of posts, listening behavior of music, watching history and purchase history, are increasingly prevalent. Unlike explicit feedback, implicit feedback datasets can be obtained without users noticing or active participation. Item-to-item [28], user-to-user [37], user-to-item [21] are 3 different angles of utilizing user engagement data. In item-to-item approaches, the goal is to recommend similar items to what users have engaged. In user-to-user approaches, the goal is to recommend to a user some items that similar users have engaged previously. User-to-item approaches, on the other hand, focus on examining user and item relationships as a whole, which is also referred to as a collaborative filtering approach. These relationships can also be viewed as graphs [42].
Two main approaches to recommendations are: attempt to predict the explicit or implicit feedback with matrix (or tensor) completion, or attempt to predict the relative rankings derived from the feedback. Collaborative filtering algorithms including matrix factorization, [11, 29, 18, 24, 14], which predict the feedback in a pointwise fashion as if it were a supervised learning problem, fall into the first category. Predicting the feedback with supervised learning objectives suffers from the different rating standards of users, and it can be helpful to consider the data to simply be the ranking of the items based on feedback. There are two main approaches to the collaborative ranking problem, namely pairwise and listwise methods. Pairwise methods [26, 39] consider each pairwise comparison for a user as a label, which implicitly models the pairwise comparisons as independent observations. Listwise methods [40], on the other hand, consider a user’s entire engagement history as independent observations. Normally, in terms of ranking performances, listwise approaches outperform pairwise approaches, and pairwise approaches outperform pointwise collaborative filtering [40].
2.2 Session-based and Sequential Recommendation
Both session-based and sequential (i.e. next-basket) recommendation algorithms take advantage of additional temporal information to make better personalized recommendations. The main difference between session-based recommendations [10] and sequential recommendations [16] is that the former assumes that the user ids are not recorded and therefore the length of engagement sequences are relatively short. Therefore, session-based recommendations normally do not consider user factors. On the other hand, sequential recommendation treats each sequence as a user’s engagement history [16]. Both settings, do not explicitly require time-stamps: only the relative temporal orderings are assumed known (in contrast to, for example, timeSVD++ [20]). Initially, sequence data in temporal order are usually modelled with Markov models, in which future observation is conditioned on last few observed items [27]. In [27], a personalized Markov model with user latent factors is proposed for more personalized results.
In recent years, deep learning techniques, borrowing from natural language processing (NLP) literature, are more widely used in tackling sequential data. Like sentences in NLP, sequence data in recommendations can be similarly modelled by recurrent neural networks (RNN) [10, 9] and convolutional neural network (CNN) [34] models. Later on, attention models are getting more and more attention in both NLP, [36, 4], and recommender systems, [23, 16]. SASRec [16] is a recent method with state-of-the-art performance among the many deep learning models. Motivated by the Transformer model in neural machine translation [36], SASRec utilizes a similar architecture to the encoder part of the Transformer model.
2.3 Regularization Techniques
In deep learning, models with many more parameters than data points can easily overfit training data. This may prevent us from adding user embeddings as additional parameters into complicated models like the Transformer model [16], which can easily have 20 layers with 6 self-attention blocks and millions of parameters for a medium-sized dataset like Movielens10M [6]. regularization [13] is the most widely used approach and has been used in many matrix factorization models in recommender systems;
regularization [35] is used when a sparse model is preferred. For deep neural networks, it has been shown that
regularizations are often too weak, while dropout [12, 32] is more effective in practice. There are many other regularization techniques, including parameter sharing [5], max-norm regularization [31], gradient clipping [25], etc. Very recently, a new regularization technique called Stochastic Shared Embeddings (SSE) [41] is proposed as a new means of regularizing embedding layers. [41] develops two versions of SSE, SSE-Graph and SSE-SE. We find that SSE-SE is essential to the success of our Personalized Transformer (SSE-PT) model.
3.1 Temporal Collaborative Ranking
Let us formally define the temporal collaborative ranking problem as: given n users, each user engaging with a subset of m items in a temporal order, the goal of the task is to find an optimal personalized ranking ordering of top K items out of total m items for any given user at any given time point. We assume our data is in the format of sequences of items for n users have interacted with so far, namely
Sequences of length T contain indices of the last T items the user i has interacted with in the temporal order (from old to new). For different users, the sequence lengths can be very different (where we pad the shorter sequences to obtain length T). We cannot simply randomly split data points into train/validation/test sets because they come in temporal orders. Instead, we need to make sure our training data is before validation data which is before test data temporally. We use last items in sequences as test sets, second-to-last items as validation sets and the rest as training sets. We use ranking metrics such as NDCG@K and Recall@K for evaluations, which are defined in (11) and (13).
3.2 Personalized Transformer Architecture
Our model is motivated by the Transformer model in [36] and [16]. In the following sections, we are going to examine each component of our Personalized Transformer (SSE-PT) model: the embedding layer, self-attention layer, pointwise feed-forward layer, prediction layer, layer normalization, dropout, weight decay, stochastic shared embeddings, and so on.
3.2.1 Embedding Layer
We define a learnable user embedding look-up table and item embedding look-up table
, where n is the number of users, m is the number of items and
are the number of hidden units for user and item respectively. We also specify learnable positional encoding table
. So each input sequence
will be represented by the following embedding:
where represents concatenating item embedding
and user embedding
into embedding
for time t. Note that the main difference between our model and [16] is that we introduce the user embeddings
, making our model personalized.
3.2.2 Self-Attention Layer
Self-attention layers defined as:
where W
The attention layer we actually used is a masked one because we only want attention from the future to the past, not the opposite direction. Therefore, all links between for j > i are forbidden. We find using bidirectional attention would lead to significantly worse performance.
3.2.3 Pointwise Feed-Forward layer
After feeding embeddings into the self-attention layer, we want to add non-linearity to the resulting for each sequence data. Therefore, we add a pointwise feed-forward layer after the self-attention layer, consisting of two fully connected layers:
where are the weight matrices and
are the bias terms.
3.2.4 Self-Attention Blocks
We combine self-attention layer and pointwise feed-forward layer to form a self-attention (SA) block. One block consists of one self-attention layer and two fully connected layers. We can stack blocks by feeding the output of first block as the input of the second block, i.e.
We use B to denote the number of attention blocks.
Figure 1: Illustration of our proposed SSE-PT model
3.2.5 Prediction Layer
As to the prediction layer, the predicted probability of user i at time t rated item l is:
where is the sigmoid function and
is the predicted score of item l by user l at time point t, defined as:
Although we can use another set of user and item embedding look-up tables for the and
, we find it better to use the same set of embedding look-up tables U, V as in the embedding layer. To distinguish the
, we call embeddings in (8) output embeddings and those in (2) input embeddings.
There are multiple ways to define the loss of our model, previously a popular loss is the BPR loss [26, 9]:
where is the sigmoid function,
is the predicted score of the positive item l at time point t for user
is the predicted score of the negative item, and set of negative items is defined as
. At time point t, the positive item index is
in (1), and negative item index
We find the BPR loss does not perform as well as the binary cross entropy loss in practice. The binary cross entropy loss between predicted probability for the positive item and one uniformly sampled negative item
is given as
. Summing over
and t, we obtain the objective function that we want to minimize is:
At the inference time, top-K recommendations for user i at time t can be made by sorting scores for all items and recommending the first K items in the sorted list.
3.3 Personalized Transformer Regularization Techniques
3.3.1 Layer Normalization
Layer normalization [1] normalizes neurons within a layer. Previous studies [1] show it is more effective than batch normalization for training recurrent neural networks (RNNs). One alternative is the batch normalization [15] but we find it does not work as well as the layer normalization in practice even for a reasonable large batch size of 128. Therefore, our SSE-PT model adopts layer normalization.
3.3.2 Residual Connections
Residual connections are firstly proposed in ResNet for image classification problems [7]. Recent research finds that residual connections can help training very deep neural networks even if they are not convolutional neural networks [36]. Using residual connections allows us to train very deep neural networks here. For example, the best performing model for Movielens10M dataset in Table 10 is the SSE-PT with 6 attention blocks, in which layers are trained end-to-end.
3.3.3 Weight Decay
Weight decay [22], also known as regularization [13], is applied to all embeddings, including both user and item embeddings.
3.3.4 Dropout
Dropout [32] is applied to the embedding layer E, self-attention layer and pointwise feed-forward layer by stochastically dropping some percentage of hidden units to prevent co-adaption of neurons. Dropout has been shown to be an effective way of regularizing deep learning models.
3.3.5 Stochastic Shared Embeddings
Unlike previous SASRec model [16], we use one more regularization technique in our SSE-PT model specifically for embedding layer in addition to the ones listed earlier: the Stochastic Shared Embeddings (SSE) [41]. The reason that we want to use this additional regularization technique is that we find the existing well-known regularization techniques like layer normalization, dropout and weight decay cannot prevent the model from over-fitting badly after introducing user embeddings. We apply this new regularization technique SSE-SE to our SSE-PT model, and we find it makes possible training this personalized model with more parameters.
The main idea of SSE is to stochastically replace embeddings with another embedding during SGD, which has the effect of regularizing the embedding layers. Specifically, SSE-SE replaces one embedding with another embedding stochastically with probability p, which is called SSE probability in [41]. There are 3 different places in our model that SSE-SE can be applied. We can apply SSE-SE to input/output user embeddings, input item embeddings, and output item embeddings with probabilities respectively. Note that input user embedding and output user embedding are always replaced at the same time with SSE probability
. Empirically, we find that SSE-SE to user embeddings and output item embeddings always helps, but SSE-SE to input item embeddings is only useful when the average sequence length is large, e.g. more than 100 in Movielens1M and Movielens10M datasets.
In summary, layer normalization and dropout are used in all layers except prediction layer. Residual connections are used in both self-attention layer and pointwise feed-forward layer. SSE-SE is used in embedding layer and prediction layer.
3.4 Handling Long Sequences: SSE-PT++
To handle extremely long sequences, a slight modification can be made on the way how input sequences ’s are fed into the SSE-PT neural networks. We call the enhanced model SSE-PT++ to distinguish it from the standard SSE-PT model, which cannot handle sequences longer than T.
Sometimes, we want to make use of extremely long sequences, , where t > T. However, our SSE-PT model can only handle sequences of maximum length of T. The simplest way is to sample starting index
uniformly and use
, where z = min(t, v + T). Although sampling the starting index uniformly from [1, t] can accommodate long sequences of length t > T, this does not work very well in practice. Uniformly sampling does not take into account the importance of recent items in a long sequence. To solve this dilemma, we introduce an additional hyper-parameter
which we call sampling probability. It implies that with probability
, we sample the starting index v uniformly from
and use sequence
as input. With probability
we will simply use the recent T items
as input. If the sequence
is already shorter than T then we simply set
Our proposed SSE-PT++ model can work almost as well as SSE-PT with a much smaller T. One can see in Table 4 with T = 100 SSE-PT++ can perform almost as well as SSE-PT. The time complexity of the SSE-PT model is of order . Therefore, reducing T by one half would lead to a theoretically 4x speed-up in terms of the training and inference speeds. As to space complexity, both SSE-PT and SSE-PT++ are of order
. When the number of users and items scales up, Tensorflow will automatically store the user and item embedding look-up tables in RAM instead of GPU memory.
Figure 2: Illustration of how SASRec (Left) and SSE-PT (Right) differs on utilizing the Engagement History of A Random User in Movielens1M Dataset.
Table 1: Description of Datasets Used in Evaluations.
In this section, we compare our proposed algorithms, Personalized Transformer (SSE-PT) and SSEPT++, with other state-of-the-art algorithms on real-world datasets. We implement our codes in Tensorflow and conduct all our experiments on
a server with 40-core Intel Xeon E5-2630 v4 @ 2.20GHz CPU, 256G RAM and Nvidia GTX 1080 GPUs.
4.1 Datasets
We use 5 datasets, the first 4 of them have exactly the same train/dev/test splits as in [16]:
• Beauty category from Amazon product review datasets. 1
• Games category from the same source. • Steam dataset introduced in [16]. It contains reviews crawled from a large video game distribution platform.
• Movielens1M dataset [6], a widely used benchmark datasets containing one million user movie ratings.
• Movielens10M dataset with ten million user ratings.
Detailed dataset statistics are given in Table 1. One can easily see that the first 3 datasets have very short sequences while the last 2 datasets have very long sequences.
4.2 Evaluation Metrics
The evaluation metrics we use are standard ranking metrics, namely NDCG and Recall for top recommendations:
In the DCG definition, represents the index of the l-th ranked item for user i in test data based on the learned score matrix X. R is the rating matrix and
is the rating given to item
is the ordering provided by the ground truth rating.
here we already assume there is only a single positive item that user will engage next and the indicator function is defined to indicate whether the positive item falls into the top K position in our obtained ranked list using scores predicted in (8).
In the temporal collaborative ranking setting, at time point t, the rating matrix R can be formed in two ways. One is that we include all ratings after t, the other is to include only ratings at time point t + 1. We use the latter, which is the same setting as [16]. For a large dataset with numerous users and items, the evaluation procedure would be slow because (11) would require computing the ranking of all items based on their predicted scores for every single user. As a means of speed-up evaluations, we sample a fixed number C of negative candidates while always keeping the positive item that we know the user will engage next. This way, both and
will be narrowed down to a small set of item candidates, and prediction scores will only be computed for those items through a single forward pass of the neural network.
Ideally, we want both NDCG and Recall to be exactly 1, because NDCG@K = 1 means the positive item is always put on the top-1 position of the top-K ranking list, and Recall@K = 1 means the positive item is always contained by the top-K recommendations the model makes. In our evaluation procedures, a larger C or a smaller K makes the recommendation problem harder because it implies the candidate pool is larger and higher ranking quality is desired.
Figure 3: Compare Attention Maps for Layer-1 between current state-of-the-art SASRec (Left) and our proposed SSE-PT (Right).
Table 2: Comparing various state-of-the-art temporal collaborative ranking algorithms on various datasets. Note that (F) to (K) are deep learning methods, we use underline to highlight best result for non-deep-learning methods and bold fonts to highlight best overall result.
4.3 Baselines
We include 5 non-deep-learning and 5 deep-learning algorithms in our comparisons:
4.3.1 Non-deep-learning Baselines
• PopRec: ranking items according to their popularity.
• BPR: Bayesian personalized ranking for implicit feedback setting [26]. It is a low-rank matrix factorization model with a pairwise loss function. But it does not utilize the temporal information. Therefore, it serves as a strong baseline for non-temporal methods.
• FMC: Factorized Markov Chains: a first-order Markov Chain method, in which predictions are made only based on previously engaged item.
• PFMC: a personalized Markov chain model [27] that combines matrix factorization and first-order Markov Chain to take advantage of both users’ latent long-term preferences as well as short-term item transitions.
• TransRec: a first-order sequential recommendation method [8] in which items are embedded into a transition space and users are modelled as translation vectors operating on item sequences.
SQL-Rank [40] and item-based recommendations [28] are omitted because the former is similar to BPR [26] except using the listwise loss function instead of the pairwise loss function and the latter has been shown inferior to TransRec [8].
4.3.2 Deep-learning baselines
• GRU4Rec: the first RNN-based method proposed for the session-based recommendation problem [10]. It utilizes the GRU structures [3] initially proposed for speech modelling.
• GRU4Rec: follow-up work of GRU4Rec by the same authors: the model has a very similar architecture to GRU4Rec but has a more complicated loss function [9].
Table 3: Comparing SASRec, SSE-PT and SSE-PT++ on Movielens1M Dataset while varying dimension of embeddings.
Table 4: Comparing SASRec, SSE-PT and SSE-PT++ on Movielens1M Dataset while varying the maximum length allowed.
• Caser: a CNN-based method [34] which embeds a sequence of recent items in both time and latent spaces forming an ‘image’ before learning local features through horizontal and vertical convolutional filters. In [34], user embeddings are included in the prediction layer only. On the contrast, in our Personalized Transformer, user embeddings are also introduced in the lowest embedding layer so they can play an important role in self-attention mechanisms as well as in prediction stages.
• STAMP: a session-based recommendation algorithm [23] using attention mechanism. [23] only uses fully connected layers with one attention block that is not self-attentive.
• SASRec: a self-attentive sequential recommendation method [16] motivated by Transformer in NLP [36]. Unlike our method SSE-PT, SASRec does not incorporate user embedding and therefore is not a personalized method. SASRec paper [16] also does not utilize SSE [41] for further regularization: only dropout and weight decay are used.
4.4 Comparison Results
We use the same datasets as in [16] and follow the same procedure in the paper: use last items for each user as test data, second-to-last as validation data and the rest as training data. We implemented our method in Tensorflow and solve it with Adam Optimizer [17] with a learning rate of 0.001, momentum exponential decay rates and a batch size of 128. In Table 3, since we use the same data, the performance of previous methods except STAMP have been reported in [16]. We tune the dropout rate, and SSE probabilities
for input user/item embeddings and output embeddings on validation sets and report the best NDCG and Recall for top-K recommendations on test sets. As mentioned before, we sampled C negative items to speed up the evaluation.
For a fair comparison, we restrict all algorithms to use up to 50 hidden units for item embeddings. For the SSE-PT and SASRec models, we use the same number of attention blocks of 2 and set the maximum length T = 200 for Movielens 1M dataset and T = 50 for other datasets. We use top-K with K = 10 and number of negatives C = 100 in evaluation procedure. One can easily see in Table 2 that our proposed SSE-PT has the best performance over all previous methods on all four datasets we consider. On most datasets, our SSE-PT improves NDCG by more than 4% when compared with SASRec [16] and more than 20% when compared to non-deep-learning methods.
When we relax the constraints, we find that an increase in the number of attention blocks and hidden units would allow our SSE-PT model to perform even better than in Table 2. In Table 5, when we increase item embedding dimension from 50 to 100, our SSE-PT achieves 0.6281 for NDCG@10 and SSE-PT++ achieves even higher 0.9292 while that of SASRec drops to 0.5919 from 0.5936.
To show the effectiveness of SSE-PT++, we decrease max length allowed from 200 to 100, we find in Table 4 that SSE-PT++ suffer the least with NDCG@10 dropping to 0.6186 from 0.6281 and Recall@10 dropping to 0.8318 from 0.8341. The one that suffers the most is the SASRec: its NDCG@10 drops to 0.5769 from 0.5919 and Recall@10 drops to 0.8045 from 0.8202.
Table 5: Comparing our SSE-PT, SSE-PT++ with SASRec on Movielen1M dataset. We use number of negatives C = 100, dropout probability of 0.2 and learning rate of for all experiments while varying others.
are SSE probabilities for user embedding, input item embedding and output item embedding respectively.
Table 6: Comparing Different Regularization Techniques for SSE-PT on Movielen1M Dataset. NO REG stands for no regularization. PS stands for parameter sharing across all users while PS(AGE) means PS is used within each age group. SASRec is added to last row after all SSE-PT results as a baseline.
We vary the tuning parameters we use in Table 5 including user/item embedding dimensions, the number of attention blocks, SSE probabilities for SSE-PT and the sampling probability for SSE-PT++. It is obvious from Table 5 and Table 7 that these hyper-parameters play an important role in terms of the final prediction performances. For our SSE-PT model, a larger item dimension helps improve the recommendation but it is not the case for baseline SASRec. Also, using SSE-SE in all three places achieves best recommendation performances for Movielens1M dataset in Table 5. One can easily see from Table 7, using SSE-SE towards input user embeddings is crucial again to ensure a properly regularized model. SSE-SE, together with dropout and weight decay, is the best choice for regularization, which is evident from Table 6. In practice, these SSE probabilities, just like dropout rate, can be treated as tuning parameters and easily tuned.
4.5 Attention Maps for Input Embeddings
Apart from evaluating our SSE-PT against SASRec using well-defined ranking metrics on 5 datasets, we use 2 other ways to visualize the comparisons. The first way is to visualize the attention maps of both methods and compare them. Note that the attention map is a lower triangular matrix as we only allow attention at present is paid to the past, but not to the future. The attention maps for the first layer in Figure 3 show that our SSE-PT paid more attention to recent items in a long sequence than SASRec. This is evident by comparing the attention intensity level of the two plots (right bottom).
As our second way to visualize the comparisons, we examine some random users’ engagement histories to see the top-K recommendations the two models give. In Figure 2, a random user’s engagement history in Movielens1M dataset is given in temporal order (column-wise). We hide the last item whose index is 26 in test set and hope that a temporal collaborative ranking model can
Table 7: Comparing our SSE-PT with SASRec on Movielens10M dataset. Unlike Table 5, we use the number of negatives C = 500 instead of 100 as C = 100 is too easy for this dataset and it gets too difficult to tell the differences between different methods.
figure out item-26 is the one this user will watch next using only previous engagement history. One can see for a typical user, they tend to look at different style of movies at different times. Earlier on, they watched a variety of movies, including Sci-Fi, animation, thriller, romance, horror, action, comedy and adventure. But later on, in the last two columns of Figure 2, drama and thriller are the two types they like to watch most, especially the drama type. In fact, they watched 9 drama movies out of recent 10 movies. It is not surprising to see the one we hide from the models is also drama type. In the top-5 recommendations given by our SSE-PT, the hidden item-26 is put in the first place. Intelligently, the SSE-PT recommends 3 drama movies, 2 thriller movies and mixing them up in positions. Interestingly, the top recommendation is ‘Othello’, which like the recently watched ‘Richard III’, is an adaptation of a Shakespeare play, and this dependence is reflected in the attention weight. In contrast, SASRec cannot provide top-5 recommendations that are personalized enough. It recommends a variety of action, Sci-Fi, comedy, horror, and drama movies but none of them match item-26. Although this user has watched all these types of movies in the past, they do not watch these anymore as one can easily tell from his recent history. Unfortunately, SASRec cannot capture this and does not provide personalized recommendations for this user by focusing more on drama and thriller movies. What we see from this particular example is consistent with the previous findings from examining the attention maps. Attention heat maps for both models during inference are included in Figure 2. It is easy to see that SSE-PT model shares with human reasoning that more emphasis should be placed on recent movies.
Figure 4: Illustration of the speed of SSE-PT
4.6 Training Speeds
In [16], it has been shown that SASRec is about 11 times faster than Caser and 17 times faster than GRU4Recand achieves much better NDCG@10 results so we did not include Caser and GRU4Rec
in our comparisons. Therefore, we only compare the training speeds and ranking performances
Table 8: Comparing Different SSE probability for user embeddings for SSE-PT on Movielens1M Dataset. Embedding hidden units of 50 for users and 100 for items, attention blocks of 2, SSE probability of 0.01 for item embeddings, dropout probability of 0.2 and max length of 200 are used.
Table 9: Comparing Different Sampling Probability, , of SSE-PT++ on Movielens1M Dataset. Hyper-parameters the same as Table 8, except that the max length T allowed is set 100 instead of 200 to show effects of sampling sequences.
among SASRec, SSE-PT and SSE-PT++. Given that we added additional user embeddings into our SSE-PT model, it is expected that it will take slightly longer to train our model than un-personalized SASRec. In Figure 4, max length T = 100 is used for SSE-PT++, and T = 200 is used for SSE-PT and SASRec. We find empirically that training speed of the SSE-PT and SSE-PT++ model are comparable to that of SASRec, with SSE-PT++ being the fastest and the best performing model. It is clear that our SSE-PT and SSE-PT++ achieve much better ranking performances than our baseline SASRec using the same training time in Figure 4.
4.7 Ablation Study
4.7.1 SSE probability
Given the importance of SSE regularization for our SSE-PT model, we carefully examined the SSE probability for input user embedding in Table 8. We find that the hyper-parameter SSE probability is not too sensitive: anywhere between 0.4 and 1.0 gives good results, better than parameter sharing and not using SSE-SE. This is also evident based on comparison results in Table 6.
4.7.2 Sampling Probability
Recall that the sampling probability is unique to our SSE-PT++ model. We show in Table 9 using an appropriate sampling probability like 0.2-0.3 would allow it to outperform SSE-PT when the same maximum length is used.
4.7.3 Number of Attention Blocks
We find for our SSE-PT model, a larger number of attention blocks is preferred. One can easily see in Table 10, the optimal ranking performances are achieved at B = 4, 5 for Movielens1M dataset and at B = 6 for Movielens10M dataset.
Table 10: Comparing Different Number of Blocks for SSE-PT while Keeping The Rest Fixed on Movielens1M and Movielens10M Datasets.
Table 11: Varying number of negatives C in evaluation on Movielens1M dataset. Other hyper-parameters are fixed for a fair comparison.
4.7.4 Number of Negatives Sampled
We want to make sure the number of negatives sampled during evaluation or difference in the usage of regularization techniques does not affect our final conclusion. So we add another set of experiments to remove personalization for our SSE-PT model while keeping all the regularization techniques we used. Based on the results in Table 11, we are positive that the personalized model always outperforms the un-personalized one even if we use the same regularization techniques. This holds true regardless of how many negatives sampled during evaluations.
In this paper, we propose a novel neural network architecture called Personalized Transformer for the temporal collaborative ranking problem. It enjoys the benefits of being a personalized model, therefore achieving better ranking results for individual users than the current state-of-the-art. By examining the attention mechanisms during inference, the model is also more interpretable and tends to pay more attention to recent items in long sequences than un-personalized deep learning models.
[1] Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
[2] Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473, 2014.
[3] Junyoung Chung, Caglar Gulcehre, KyungHyun Cho, and Yoshua Bengio. Empirical evaluation of gated recurrent neural networks on sequence modeling. arXiv preprint arXiv:1412.3555, 2014.
[4] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018.
[5] Ian Goodfellow, Yoshua Bengio, Aaron Courville, and Yoshua Bengio. Deep learning, volume 1. MIT press Cambridge, 2016.
[6] F Maxwell Harper and Joseph A Konstan. The movielens datasets: History and context. Acm transactions on interactive intelligent systems (tiis), 5(4):19, 2016.
[7] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770–778, 2016.
[8] Ruining He, Wang-Cheng Kang, and Julian McAuley. Translation-based recommendation. In Proceedings of the Eleventh ACM Conference on Recommender Systems, pages 161–169. ACM, 2017.
[9] Balázs Hidasi and Alexandros Karatzoglou. Recurrent neural networks with top-k gains for session-based recommendations. In Proceedings of the 27th ACM International Conference on Information and Knowledge Management, pages 843–852. ACM, 2018.
[10] Balázs Hidasi, Alexandros Karatzoglou, Linas Baltrunas, and Domonkos Tikk. Session-based recommendations with recurrent neural networks. arXiv preprint arXiv:1511.06939, 2015.
[11] Will Hill, Larry Stead, Mark Rosenstein, and George Furnas. Recommending and evaluating choices in a virtual community of use. In Proceedings of the SIGCHI conference on Human factors in computing systems, pages 194–201. ACM Press/Addison-Wesley Publishing Co., 1995.
[12] Geoffrey E Hinton, Nitish Srivastava, Alex Krizhevsky, Ilya Sutskever, and Ruslan R Salakhutdinov. Improving neural networks by preventing co-adaptation of feature detectors. arXiv preprint arXiv:1207.0580, 2012.
[13] Arthur E Hoerl and Robert W Kennard. Ridge regression: Biased estimation for nonorthogonal problems. Technometrics, 12(1):55–67, 1970.
[14] Yifan Hu, Yehuda Koren, and Chris Volinsky. Collaborative filtering for implicit feedback datasets. In Data Mining, 2008. ICDM’08. Eighth IEEE International Conference on, pages 263–272. Ieee, 2008.
[15] Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv preprint arXiv:1502.03167, 2015.
[16] Wang-Cheng Kang and Julian McAuley. Self-attentive sequential recommendation. arXiv preprint arXiv:1808.09781, 2018.
[17] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
[18] Yehuda Koren. Factorization meets the neighborhood: a multifaceted collaborative filtering model. In Proceedings of the 14th ACM SIGKDD international conference on Knowledge discovery and data mining, pages 426–434. ACM, 2008.
[19] Yehuda Koren. The bellkor solution to the netflix grand prize. Netflix prize documentation, 81(2009):1–10, 2009.
[20] Yehuda Koren. Collaborative filtering with temporal dynamics. In Proceedings of the 15th ACM SIGKDD international conference on Knowledge discovery and data mining, pages 447–456. ACM, 2009.
[21] Yehuda Koren, Robert Bell, and Chris Volinsky. Matrix factorization techniques for recommender systems. Computer, (8):30–37, 2009.
[22] Anders Krogh and John A Hertz. A simple weight decay can improve generalization. In Advances in neural information processing systems, pages 950–957, 1992.
[23] Qiao Liu, Yifu Zeng, Refuoe Mokhosi, and Haibin Zhang. Stamp: short-term attention/memory priority model for session-based recommendation. In Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 1831–1839. ACM, 2018.
[24] Andriy Mnih and Ruslan R Salakhutdinov. Probabilistic matrix factorization. In Advances in neural information processing systems, pages 1257–1264, 2008.
[25] Razvan Pascanu, Tomas Mikolov, and Yoshua Bengio. On the difficulty of training recurrent neural networks. In International Conference on Machine Learning, pages 1310–1318, 2013.
[26] Steffen Rendle, Christoph Freudenthaler, Zeno Gantner, and Lars Schmidt-Thieme. Bpr: Bayesian personalized ranking from implicit feedback. In Proceedings of the twenty-fifth conference on uncertainty in artificial intelligence, pages 452–461. AUAI Press, 2009.
[27] Steffen Rendle, Christoph Freudenthaler, and Lars Schmidt-Thieme. Factorizing personalized markov chains for next-basket recommendation. In Proceedings of the 19th international conference on World wide web, pages 811–820. ACM, 2010.
[28] Badrul Munir Sarwar, George Karypis, Joseph A Konstan, John Riedl, et al. Item-based collaborative filtering recommendation algorithms. Www, 1:285–295, 2001.
[29] J Ben Schafer, Dan Frankowski, Jon Herlocker, and Shilad Sen. Collaborative filtering recommender systems. In The adaptive web, pages 291–324. Springer, 2007.
[30] Guy Shani, Max Chickering, and Christopher Meek. Mining recommendations from the web. In Proceedings of the 2008 ACM conference on Recommender systems, pages 35–42. ACM, 2008.
[31] Nathan Srebro, Jason Rennie, and Tommi S Jaakkola. Maximum-margin matrix factorization. In Advances in neural information processing systems, pages 1329–1336, 2005.
[32] Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. The Journal of Machine Learning Research, 15(1):1929–1958, 2014.
[33] Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to sequence learning with neural networks. In Advances in neural information processing systems, pages 3104–3112, 2014.
[34] Jiaxi Tang and Ke Wang. Personalized top-n sequential recommendation via convolutional sequence embedding. In Proceedings of the Eleventh ACM International Conference on Web Search and Data Mining, pages 565–573. ACM, 2018.
[35] Robert Tibshirani. Regression shrinkage and selection via the lasso. Journal of the Royal Statistical Society. Series B (Methodological), pages 267–288, 1996.
[36] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems, pages 5998–6008, 2017.
[37] Jun Wang, Arjen P De Vries, and Marcel JT Reinders. Unifying user-based and item-based collaborative filtering approaches by similarity fusion. In Proceedings of the 29th annual international ACM SIGIR conference on Research and development in information retrieval, pages 501–508. ACM, 2006.
[38] Markus Weimer, Alexandros Karatzoglou, Quoc V Le, and Alex J Smola. Cofi rank-maximum margin matrix factorization for collaborative ranking. In Advances in neural information processing systems, pages 1593–1600, 2008.
[39] Liwei Wu, Cho-Jui Hsieh, and James Sharpnack. Large-scale collaborative ranking in nearlinear time. In Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pages 515–524. ACM, 2017.
[40] Liwei Wu, Cho-Jui Hsieh, and James Sharpnack. Sql-rank: A listwise approach to collaborative ranking. In Proceedings of Machine Learning Research (35th International Conference on Machine Learning), volume 80, 2018.
[41] Liwei Wu, Shuqing Li, Cho-Jui Hsieh, and James Sharpnack. Stochastic shared embeddings: Data-driven regularization of embedding layers. arXiv preprint arXiv:1905.10630, 2019.
[42] Liwei Wu, Hsiang-Fu Yu, Nikhil Rao, James Sharpnack, and Cho-Jui Hsieh. Graph dna: Deep neighborhood aware graph encoding for collaborative filtering. arXiv preprint arXiv:1905.12217, 2019.
[43] Shuai Zhang, Lina Yao, Aixin Sun, and Yi Tay. Deep learning based recommender system: A survey and new perspectives. ACM Computing Surveys (CSUR), 52(1):5, 2019.