## 3 The ASLM Architecture
### Model Description
#### 3.3.2 Attention-Based Short-Term Intent Layer  
For predicting next items, a user's short-term preference is important. A user's short-term preference consists of different kinds of short-term intent on different categories of items. Previously, [PERSON] et al. [54] has done some research on combining long- and short-term preference for sequential recommendation. However, in the earlier works, researchers regard the user's short-term preference as a stationary property, and therefore items are given the same weights and the variation in short-term intent is not evaluated properly. To resolve this problem, we employ an attention-based encoder-decoder architecture, to assign weights to both long- and short-term session representations, to form the characteristics of user \(u\) comprehensively. In addition, we employ bi-directional LSTM and GRU as the encoder and decoder, respectively. One advantage of bi-directional LSTM over uni-directional LSTM is that it uses each event \(e_{t,i}^{u}\in S_{t}^{u}\) to predict recommendations based on each event's past and future contexts, rather than just its past ones, which can be sensitive to the variation in the user's short-term intent from both sides. Attention mechanism has been widely and successfully applied in many tasks, e.g., information retrieval [38], computer vision [39] and recommendation [40]. The key idea of attention is to learn to assign attentive weights (normalized by sum to 1) for a set of features: higher weights indicate that the corresponding features are informative for the task. It computes the importance of each item both in the short-term and long-term item sets of a given user and integrates these items' embeddings to build the representations of the user's intent and preference. The graph inside the purple box in Figure 2 illustrates the work flow of the Attention-based Short-term Intent Layer. In the following paragraphs, we state the functionality and the working procedure of each component in the Attention-based Short-term Intent Layer. _Encoder_. A bi-directional LSTM is employed as the encoder. We use item embeddings to represent each item. At the beginning of each session, each event \(e_{t,i}^{u}\) which consists of the embedded item representation is sent through a bi-directional LSTM to be processed together with its past and future contexts, to investigate the sequence patterns of the current session. Afterwards, the bi-directional LSTM produces its output vector, namely the source hidden states vector \(\left[\overline{\mathbf{h}_{1}}\ \overline{\mathbf{h}_{2}}\ \ldots\ \overline{\mathbf{h}_{i}}\right]\) where \(\overline{\mathbf{h}}_{i}\) is a source hidden state regarding the item \(v_{i}\), and includes the latent information of \(v_{i}\). Finally, they are sent to the architecture of attention mechanism. _Decoder_. A GRU is employed as the decoder. The procedure of capturing the characteristics of each step in the user behavior is stated below. At the beginning of each session, the GRU receives the user's long-term preference representation \(P_{L}^{u}\) from the Long-term Preference Layer as the initial hidden state. In the meantime, the GRU takes the context vector \(\mathbf{c}_{j}\) produced by the Attention procedure into consideration. In other words, \(\mathbf{c}_{j}\) provides the distribution of every event \(e_{t,i}^{u}\)'s influence upon the current target item prediction in the current session, from which it enables the GRU to find out which events are more important to the current choice. Apparently, the more important events are highly related to the user \(u\)'s current intent. Therefore, when the time step \(t\) increases and the previously important events become less important, the \(u\)'s intent probably has changed. The GRU is ready for capturing the variation of the user \(u\)'s current intent. In other words, our proposed model is aware of the variation of the user \(u\)'s short-term intent. Moreover, it makes the recommendation with the help of not only the short-term intent, but also the long-term preference.