SSE-PT: Sequential Recommendation Via Personalized Transformer

1 INTRODUCTION . The sequential recommendation problem has been an important open research question , yet using temporal information to improve recommendation performance has proven to be challenging . SASRec , proposed by ( Kang and McAuley , 2018 ) for sequential recommendation problems , has achieved stateof-the-art results and enjoyed more than 10x speed-up when compared to earlier CNN/RNN-based methods . However , the model used in SASRec is the standard Transformer which is inherently an un-personalized model . In practice , it is important to include a personalized Transformer in SASRec especially for recommender systems , but ( Kang and McAuley , 2018 ) found that adding additional personalized embeddings did not improve the performance of their Transformer model , and postulate that the failure of adding personalization is due to the fact that they already use the user history and the user embeddings only contribute to overfitting . In this work , we propose a novel method , Personalized Transformer ( SSE-PT ) , that successfully introduces personalization into self-attentive neural network architectures . Introducing user embeddings into the standard transformer model is intrinsically difficult with existing regularization techniques , as unavoidably a large number of user parameters are introduced , which is often at the same scale of the number of training data . But we show that personalization can greatly improve ranking performance with a recent regularization technique called Stochastic Shared Embeddings ( SSE ) ( Wu et al. , 2019 ) . The personalized Transformer ( SSE-PT ) model with SSE regularization works well for all 5 real-world datasets we consider without overfitting , outperforming previous state-of-the-art algorithm SASRec by almost 5 % in terms of NDCG @ 10 . Furthermore , after examining some random users ’ engagement history , 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 RELATED WORK . 2.1 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 ( Hidasi et al. , 2015 ) and sequential recommendations ( Kang and McAuley , 2018 ) 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 ( Kang and McAuley , 2018 ) . Both settings , do not explicitly require time-stamps : only the relative temporal orderings are assumed known ( in contrast to , for example , timeSVD++ ( Koren , 2009 ) using time-stamps ) . Initially , sequence data in temporal order are usually modelled with Markov models , in which a future observation is conditioned on the last few observed items ( Rendle et al. , 2010 ) . In ( Rendle et al. , 2010 ) , a personalized Markov model with user latent factors is proposed for more personalized results . In recent years , deep learning techniques , borrowed from natural language processing ( NLP ) literature , are getting widely used in tackling sequential data . Like word sentences in NLP , item sequences in recommendations can be similarly modelled by recurrent neural networks ( RNN ) ( Hidasi et al. , 2015 ; Hidasi and Karatzoglou , 2018 ) and convolutional neural network ( CNN ) ( Tang and Wang , 2018 ) models . Recently , attention models are increasingly used in both NLP ( Vaswani et al. , 2017 ; Devlin et al. , 2018 ) and recommender systems ( Liu et al. , 2018 ; Kang and McAuley , 2018 ) . SASRec ( Kang and McAuley , 2018 ) 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 ( Vaswani et al. , 2017 ) , SASRec utilizes a similar architecture to the encoder part of the Transformer model . Our proposed model , SSE-PT , is a personalized extension of the transformer model . 2.2 REGULARIZATION TECHNIQUES . In deep learning , models with many more parameters than data points can easily overfit to the training data . This may prevent us from adding user embeddings as additional parameters into complicated models like the Transformer model ( Kang and McAuley , 2018 ) , which can easily have 20 layers with millions of parameters for a medium-sized dataset like Movielens10M ( Harper and Konstan , 2016 ) . ` 2 regularization ( Hoerl and Kennard , 1970 ) is the most widely used approach and has been used in many matrix factorization models in recommender systems ; ` 1 regularization ( Tibshirani , 1996 ) is used when a sparse model is preferred . For deep neural networks , it has been shown that ` p regularizations are often too weak , while dropout ( Hinton et al. , 2012 ; Srivastava et al. , 2014 ) is more effective in practice . There are many other regularization techniques , including parameter sharing ( Goodfellow et al. , 2016 ) , max-norm regularization ( Srebro et al. , 2005 ) , gradient clipping ( Pascanu et al. , 2013 ) , etc . Very recently , a new regularization technique called Stochastic Shared Embeddings ( SSE ) ( Wu et al. , 2019 ) is proposed as a new means of regularizing embedding layers . We find that the base version SSE-SE is essential to the success of our Personalized Transformer ( SSE-PT ) model . 3 METHODOLOGY . 3.1 SEQUENTIAL RECOMMENDATION . Given n users and each user engaging with a subset of m items in a temporal order , the goal of sequential recommendation is to learn a good personalized ranking of top K items out of total m items for any given user at any given time point . We assume data in the format of n item sequences : si = ( ji1 , ji2 , . . . , jiT ) for 1 ≤ i ≤ n. ( 1 ) Sequences si of length T contain indices of the last T items that user i has interacted with in the temporal order ( from old to new ) . For different users , the sequence lengths can vary , but we can pad the shorter sequences so all of them have length T . We can not 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 the Appendix . 3.2 PERSONALIZED TRANSFORMER ARCHITECTURE . Our model , which we call SSE-PT , is motivated by the Transformer model in ( Vaswani et al. , 2017 ) and ( Kang and McAuley , 2018 ) . It also utilizes a new regularization technique called stochastic shared embeddings ( Wu et al. , 2019 ) . In the following sections , we are going to examine each important component of our Personalized Transformer ( SSE-PT ) model , especially the embedding layer , and the novel application of stochastic shared embeddings ( SSE ) regularization technique . Embedding Layer We define a learnable user embedding look-up table U ∈ Rn×du and item embedding look-up table V ∈ Rm×di , where du , di are the number of hidden units for user and item respectively . We also specify learnable positional encoding table P ∈ RT×d , where d = du + di . So each input sequence si ∈ RT will be represented by the following embedding : E = [ vji1 ; ui ] + p1 [ vji2 ; ui ] + p2 ... [ vjiT ; ui ] + pT ∈ RT×d , ( 2 ) where [ vjit ; ui ] represents concatenating item embedding vjit ∈ Rdi and user embedding ui ∈ Rdu into embedding Et ∈ Rd for time t. Note that the main difference between our model and ( Kang and McAuley , 2018 ) is that we introduce the user embeddings ui , making our model personalized . Transformer Encoder On top of the embedding layer , we have B blocks of self-attention layers and fully connected layers , where each layer extracts features for each time step based on the previous layer ’ s outputs . Since this part is identical to the Transformer encoder used in the original papers ( Vaswani et al. , 2017 ; Kang and McAuley , 2018 ) , we will skip the details . Prediction Layer At time t , the predicted probability of user i engaged item l is : pitl = σ ( ritl ) , ( 3 ) where σ is the sigmoid function and ritl is the predicted score of item l by user l at time point t , defined as : ritl = F B t−1 · [ vl ; ui ] , ( 4 ) where FBt−1 is the output hidden units associated with the transformer encoder at the last timestamp . Although we can use another set of user and item embedding look-up tables for the ui and vl , we find it better to use the same set of embedding look-up tables U , V as in the embedding layer . But regularization for those embeddings can be different . To distinguish the ui and vl in ( 4 ) from ui , vj in ( 2 ) , we call embeddings in ( 4 ) output embeddings and those in ( 2 ) input embeddings . The binary cross entropy loss between predicted probability for the positive item l = ji ( t+1 ) and one uniformly sampled negative item k ∈ Ω is given as − [ log ( pitl ) + log ( 1− pitk ) ] . Summing over si and t , we obtain the objective function that we want to minimize is : ∑ i ∑T−1 t=1 ∑ k∈Ω − [ log ( pitl ) + log ( 1− pitk ) ] . ( 5 ) At the inference time , top-K recommendations for user i at time t can be made by sorting scores ritl for all items ` and recommending the first K items in the sorted list . Novel Application of Stochastic Shared Embeddings The most important regularization technique to SSE-PT model is the Stochastic Shared Embeddings ( SSE ) ( Wu et al. , 2019 ) . The main idea of SSE is to stochastically replace embeddings with another embedding with some pre-defined probability during SGD , which has the effect of regularizing the embedding layers . Without SSE , all the existing well-known regularization techniques like layer normalization , dropout and weight decay fail and can not prevent the model from over-fitting badly after introducing user embeddings . ( Wu et al. , 2019 ) develops two versions of SSE , SSE-Graph and SSE-SE . In the simplest uniform case , SSE-SE replaces one embedding with another embedding uniformly with probability p , which is called SSE probability in ( Wu et al. , 2019 ) . Since we don ’ t have knowledge graphs for user or items , we simply apply the SSE-SE to our SSE-PT model . We find SSE-SE makes possible training this personalized model with O ( ndu ) additional parameters . 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 pu , pi and py respectively . Note that input user embedding and output user embedding are always replaced at the same time with SSE probability pu . 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 . Other Regularization Techniques Besides the SSE ( Wu et al. , 2019 ) , we also utilized other widely used regularization techniques , including layer normalization ( Ba et al. , 2016 ) , batch normalization ( Ioffe and Szegedy , 2015 ) , residual connections ( He et al. , 2016 ) , weight decay ( Krogh and Hertz , 1992 ) , and dropout ( Srivastava et al. , 2014 ) . Since they are used in the same way in the previous paper ( Kang and McAuley , 2018 ) , we omit the details to the Appendix .

Summary: In this paper, the authors study an important recommendation problem, i.e., sequential recommendation, and design a novel and improved model called SSE-PT (Stochastic Shared Embedding - Personalized Transformer). Specifically, the authors mainly follow the previous works of the Transformer model and the stochastic shared embedding (SSE) regularization technique. For the part of the personalized transfer (PT), the authors introduce the user embedding for each user $i$, i.e., $u_i$, shown in Eq.(2) and illustrated in Figure 1. For the part of regularization, the authors find that the SSE technique works well in terms of avoid overfiting in context of other regularization techniques.