Skip to main content
Log in

Improving session-based recommendation with contrastive learning

  • Published:
User Modeling and User-Adapted Interaction Aims and scope Submit manuscript

Abstract

Session-based recommendation, which aims to predict the next item given anonymous behavior sequences of users, is critical in modern recommender systems. While prior works have made efforts to improve recommendation performance, two challenges remain unsolved. First, existing learning methodologies rely on mining sequential patterns within the individual session and use the next item as the supervised signal, which may not effectively capture the correlations among interactions. Second, previous solutions are also limited in learning the mixed dependencies inside flexibly ordered sessions, i.e., sequential dependencies among ordered interactions and non-sequential dependencies among unordered ones. This work presents a novel session recommender algorithm by distilling knowledge and supervision signals from sessions in a contrastive manner. We propose position-aware importance extraction module with contrastive learning, which utilizes the intrinsic dependencies to discover extra knowledge and augment the ability of information distillation. Besides, we introduce a bi-directional matching algorithm with contrastive loss to capture potential patterns through maximizing the mutual information between current interaction and historical behaviors. Moreover, we introduce a simple yet effective learnable position-coding mechanism with self-attention-based importance extraction to flexibly learn user browsing patterns. Extensive experiments conducted on two real-world datasets demonstrate that our proposed algorithm enhances the recommendation performance over existing state-of-the-art approaches.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10
Fig. 11
Fig. 12
Fig. 13

Similar content being viewed by others

Notes

  1. http://2015.recsyschallenge.com/challege.html .

  2. http://cikm2016.cs.iupui.edu/cikm-cupl .

  3. https://github.com/judiebig/PIE-CL .

  4. https://github.com/rn5l/session-rec

References

  • Adomavicius, G., Tuzhilin, A.: Toward the next generation of recommender systems: a survey of the state-of-the-art and possible extensions. IEEE Trans. Knowl. Data Eng. 17(6), 734–749 (2005)

    Article  Google Scholar 

  • Arora, S., Khandeparkar, H., Khodak, M., Plevrakis, O., Saunshi, N.: A theoretical analysis of contrastive unsupervised representation learning. In: 36th International Conference on Machine Learning, ICML 2019, pp. 9904–9923. International Machine Learning Society (IMLS) (2019)

  • Bai, T., Nie, J.Y., Zhao, W.X., Zhu, Y., Du, P., Wen, J.R.: An attribute-aware neural attentive model for next basket recommendation. In: The 41st International ACM SIGIR Conference on Research & Development in Information Retrieval, pp. 1201–1204 (2018)

  • Baxter, J.: A model of inductive bias learning. J. Artif. Intell. Res. 12, 149–198 (2000)

    Article  MathSciNet  MATH  Google Scholar 

  • Belghazi, M.I., Baratin, A., Rajeswar, S., Ozair, S., Bengio, Y., Courville, A., Hjelm, R.D.: Mine: mutual information neural estimation. arXiv preprint arXiv:1801.04062 (2018)

  • Benson, A.R., Kumar, R., Tomkins, A.: Modeling user consumption sequences. In: Proceedings of the 25th International Conference on World Wide Web, pp. 519–529 (2016)

  • Bingel, J., Søgaard, A.: Identifying beneficial task relations for multi-task learning in deep neural networks. In: EACL (2), pp. 164–169. Association for Computational Linguistics (2017)

  • Bollmann, M., Søgaard, A.: Improving historical spelling normalization with bi-directional lstms and multi-task learning. In: COLING, pp. 131–139. ACL (2016)

  • Campos, P.G., Díez, F., Cantador, I.: Time-aware recommender systems: a comprehensive survey and analysis of existing evaluation protocols. User Model. User-Adap. Int. 24(1), 67–119 (2014)

    Article  Google Scholar 

  • Caruana, R.: Multitask learning: a knowledge-based source of inductive bias icml. Google Scholar Google Scholar Digital Library Digital Library (1993)

  • Chen, T., Kornblith, S., Norouzi, M., Hinton, G.: A simple framework for contrastive learning of visual representations. In: International Conference on Machine Learning, pp. 1597–1607. PMLR (2020)

  • Covington, P., Adams, J., Sargin, E.: Deep neural networks for youtube recommendations. In: Proceedings of the 10th ACM Conference on Recommender Systems, pp. 191–198 (2016)

  • Davidson, J., Liebald, B., Liu, J., Nandy, P., Van Vleet, T., Gargi, U., Gupta, S., He, Y., Lambert, M., Livingston, B., et al.: The youtube video recommendation system. In: Proceedings of the fourth ACM Conference on Recommender Systems, pp. 293–296 (2010)

  • Devlin, J., Chang, M., Lee, K., Toutanova, K.: BERT: pre-training of deep bidirectional transformers for language understanding. In: NAACL-HLT (1), pp. 4171–4186. Association for Computational Linguistics (2019)

  • Garg, D., Gupta, P., Malhotra, P., Vig, L., Shroff, G.: Sequence and time aware neighborhood for session-based recommendations: Stan. In: Proceedings of the 42nd International ACM SIGIR Conference on Research and Development in Information Retrieval, pp. 1069–1072 (2019)

  • Gutmann, M., Hyvärinen, A.: Noise-contrastive estimation: a new estimation principle for unnormalized statistical models. In: AISTATS, pp. 297–304 (2010)

  • Hariri, N., Mobasher, B., Burke, R.: Adapting to user preference changes in interactive recommendation. In: Twenty-Fourth International Joint Conference on Artificial Intelligence (2015)

  • He, K., Fan, H., Wu, Y., Xie, S., Girshick, R.: Momentum contrast for unsupervised visual representation learning. In: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 9729–9738 (2020)

  • He, K., Girshick, R., Dollár, P.: Rethinking imagenet pre-training. In: Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 4918–4927 (2019)

  • He, X., Zhang, H., Kan, M.Y., Chua, T.S.: Fast matrix factorization for online recommendation with implicit feedback. In: Proceedings of the 39th International ACM SIGIR Conference on Research and Development in Information Retrieval, pp. 549–558 (2016)

  • Hidasi, B., Karatzoglou, A., Baltrunas, L., Tikk, D.: Session-based recommendations with recurrent neural networks. In: ICLR (Poster) (2016)

  • Hidasi, B., Quadrana, M., Karatzoglou, A., Tikk, D.: Parallel recurrent neural network architectures for feature-rich session-based recommendations. In: Proceedings of the 10th ACM Conference on Recommender Systems, pp. 241–248 (2016)

  • Hjelm, R.D., Fedorov, A., Lavoie-Marchildon, S., Grewal, K., Bachman, P., Trischler, A., Bengio, Y.: Learning deep representations by mutual information estimation and maximization. In: ICLR. OpenReview.net (2019)

  • Hu, L., Cao, L., Wang, S., Xu, G., Cao, J., Gu, Z.: Diversifying personalized recommendation with user-session context. In: IJCAI, pp. 1858–1864 (2017)

  • Jannach, D., Ludewig, M.: When recurrent neural networks meet the neighborhood for session-based recommendation. In: Proceedings of the Eleventh ACM Conference on Recommender Systems, pp. 306–310 (2017)

  • Ke, G., He, D., Liu, T.Y.: Rethinking positional encoding in language pre-training. In: International Conference on Learning Representations (2020)

  • Kendall, A., Gal, Y., Cipolla, R.: Multi-task learning using uncertainty to weigh losses for scene geometry and semantics. In: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 7482–7491 (2018)

  • Khosla, P., Teterwak, P., Wang, C., Sarna, A., Tian, Y., Isola, P., Maschinot, A., Liu, C., Krishnan, D.: Supervised contrastive learning. Adv. Neural Inf. Process. Syst. 33 (2020)

  • Kong, L., d’Autume, C.D.M., Ling, W., Yu, L., Dai, Z., Yogatama, D.: A mutual information maximization perspective of language representation learning. In: ICLR (2020)

  • Koren, Y., Bell, R., Volinsky, C.: Matrix factorization techniques for recommender systems. Computer 42(8), 30–37 (2009)

    Article  Google Scholar 

  • Kumar, B.G.V., Carneiro, G., Reid, I.: Learning local image descriptors with deep siamese and triplet convolutional networks by minimising global loss functions. In: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5385–5394 (2016)

  • LeCun, Y., Bengio, Y., Hinton, G.: Deep learning. Nature 521(7553), 436–444 (2015)

    Article  Google Scholar 

  • Li, J., Ren, P., Chen, Z., Ren, Z., Lian, T., Ma, J.: Neural attentive session-based recommendation. In: Proceedings of the 2017 ACM on Conference on Information and Knowledge Management, pp. 1419–1428 (2017)

  • Li, Y., Tarlow, D., Brockschmidt, M., Zemel, R.S.: Gated graph sequence neural networks. In: ICLR (Poster) (2016)

  • Liu, Q., Zeng, Y., Mokhosi, R., Zhang, H.: 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, pp. 1831–1839 (2018)

  • Liu, X., Zhang, F., Hou, Z., Wang, Z., Mian, L., Zhang, J., Tang, J.: Self-supervised learning: generative or contrastive. arXiv:2006.08218 (2020)

  • Ludewig, M., Mauro, N., Latifi, S., Jannach, D.: Empirical analysis of session-based recommendation algorithms. User Model. User-Adap. Int. 31(1), 149–181 (2021)

    Article  Google Scholar 

  • Mikolov, T., Chen, K., Corrado, G., Dean, J.: Efficient estimation of word representations in vector space. In: ICLR (Workshop) (2013)

  • Mobasher, B., Dai, H., Luo, T., Nakagawa, M.: Using sequential and non-sequential patterns in predictive web usage mining tasks. In: 2002 IEEE International Conference on Data Mining, 2002. Proceedings, pp. 669–672. IEEE (2002)

  • Niranjan, U., Subramanyam, R., Khanaa, V.: Developing a web recommendation system based on closed sequential patterns. In: International Conference on Advances in Information and Communication Technologies, pp. 171–179. Springer (2010)

  • Oord, A.v.d., Li, Y., Vinyals, O.: Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748 (2018)

  • Pan, Z., Cai, F., Chen, W., Chen, H., de Rijke, M.: Star graph neural networks for session-based recommendation. In: Proceedings of the 29th ACM International Conference on Information & Knowledge Management, pp. 1195–1204 (2020)

  • Pan, Z., Cai, F., Ling, Y., de Rijke, M.: Rethinking item importance in session-based recommendation. In: Proceedings of the 43rd International ACM SIGIR Conference on Research and Development in Information Retrieval, pp. 1837–1840 (2020)

  • Qiu, R., Huang, Z., Li, J., Yin, H.: Exploiting cross-session information for session-based recommendation with graph neural networks. ACM Trans. Inf. Syst. (TOIS) 38(3), 1–23 (2020)

    Article  Google Scholar 

  • Quadrana, M., Karatzoglou, A., Hidasi, B., Cremonesi, P.: Personalizing session-based recommendations with hierarchical recurrent neural networks. In: Proceedings of the Eleventh ACM Conference on Recommender Systems, pp. 130–137 (2017)

  • Ren, P., Chen, Z., Li, J., Ren, Z., Ma, J., de Rijke, M.: Repeatnet: a repeat aware neural recommendation machine for session-based recommendation. In: Proceedings of the AAAI Conference on Artificial Intelligence, vol. 33, pp. 4806–4813 (2019)

  • Rendle, S., Freudenthaler, C., Gantner, Z., Schmidt-Thieme, L.: BPR: bayesian personalized ranking from implicit feedback. In: UAI, pp. 452–461. AUAI Press (2012)

  • Rendle, S., Freudenthaler, C., Schmidt-Thieme, L.: Factorizing personalized markov chains for next-basket recommendation. In: Proceedings of the 19th International Conference on World Wide Web, pp. 811–820 (2010)

  • Sarwar, B., Karypis, G., Konstan, J., Riedl, J.: Item-based collaborative filtering recommendation algorithms. In: Proceedings of the 10th International Conference on World Wide Web, pp. 285–295 (2001)

  • Schmarje, L., Santarossa, M., Schröder, S.M., Koch, R.: A survey on semi, self-and unsupervised techniques in image classification. arXiv:2002.08721 (2020)

  • Shani, G., Heckerman, D., Brafman, R.I., Boutilier, C.: An mdp-based recommender system. J. Mach. Learn. Res. 6(9) (2005)

  • Socher, R., Lin, C.C., Manning, C., Ng, A.Y.: Parsing natural scenes and natural language with recursive neural networks. In: Proceedings of the 28th International Conference on Machine Learning (ICML-11), pp. 129–136 (2011)

  • Sutskever, I., Vinyals, O., Le, Q.V.: Sequence to sequence learning with neural networks. Adv. Neural. Inf. Process. Syst. 27, 3104–3112 (2014)

    Google Scholar 

  • Tang, J., Wang, K.: Personalized top-n sequential recommendation via convolutional sequence embedding. In: Proceedings of the Eleventh ACM International Conference on Web Search and Data Mining, pp. 565–573 (2018)

  • Tian, Y., Krishnan, D., Isola, P.: Contrastive multiview coding. In: ECCV (11). Lecture Notes in Computer Science, vol. 12356, pp. 776–794. Springer (2020)

  • Twardowski, B.: Modelling contextual information in session-aware recommender systems with neural networks. In: Proceedings of the 10th ACM Conference on Recommender Systems, pp. 273–276 (2016)

  • Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A.N., Kaiser, Ł., Polosukhin, I.: Attention is all you need. In: Advances in Neural Information Processing Systems, pp. 5998–6008 (2017)

  • Velickovic, P., Fedus, W., Hamilton, W.L., Liò, P., Bengio, Y., Hjelm, R.D.: Deep graph infomax. In: ICLR (Poster) (2019)

  • Wang, M., Ren, P., Mei, L., Chen, Z., Ma, J., de Rijke, M.: A collaborative session-based recommendation approach with parallel memory modules. In: Proceedings of the 42nd International ACM SIGIR Conference on Research and Development in Information Retrieval, pp. 345–354 (2019)

  • Wang, P., Guo, J., Lan, Y., Xu, J., Wan, S., Cheng, X.: Learning hierarchical representation model for nextbasket recommendation. In: Proceedings of the 38th International ACM SIGIR Conference on Research and Development in Information Retrieval, pp. 403–412 (2015)

  • Wang, S., Cao, L., Wang, Y., Sheng, Q.Z., Orgun, M., Lian, D.: A survey on session-based recommender systems. ACM Comput. Surv. (2021)

  • Wang, Z., Hamza, W., Florian, R.: Bilateral multi-perspective matching for natural language sentences. In: IJCAI, pp. 4144–4150. ijcai.org (2017)

  • Wei, H., Feng, L., Chen, X., An, B.: Combating noisy labels by agreement: a joint training method with co-regularization. In: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 13726–13735 (2020)

  • Wen, H., Zhang, J., Wang, Y., Lv, F., Bao, W., Lin, Q., Yang, K.: Entire space multi-task modeling via post-click behavior decomposition for conversion rate prediction. In: Proceedings of the 43rd International ACM SIGIR Conference on Research and Development in Information Retrieval, pp. 2377–2386 (2020)

  • Wu, C., Yan, M.: Session-aware information embedding for e-commerce product recommendation. In: Proceedings of the 2017 ACM on Conference on Information and Knowledge management, pp. 2379–2382 (2017)

  • Wu, S., Tang, Y., Zhu, Y., Wang, L., Xie, X., Tan, T.: Session-based recommendation with graph neural networks. In: Proceedings of the AAAI Conference on Artificial Intelligence, vol. 33, pp. 346–353 (2019)

  • Xu, C., Zhao, P., Liu, Y., Sheng, V.S., Xu, J., Zhuang, F., Fang, J., Zhou, X.: Graph contextualized self-attention network for session-based recommendation. In: IJCAI, vol. 19, pp. 3940–3946 (2019)

  • Xu, Y., Chen, J., Huang, C., Zhang, B., Xing, H., Dai, P., Bo, L.: Joint modeling of local and global behavior dynamics for session-based recommendation. In: ECAI 2020, pp. 545–552. IOS Press (2020)

  • Yang, Z., Cheng, Y., Liu, Y., Sun, M.: Reducing word omission errors in neural machine translation: A contrastive learning approach. In: Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 6191–6196 (2019)

  • Yu, F., Zhu, Y., Liu, Q., Wu, S., Wang, L., Tan, T.: Tagnn: Target attentive graph neural networks for session-based recommendation. In: Proceedings of the 43rd International ACM SIGIR Conference on Research and Development in Information Retrieval, pp. 1921–1924 (2020)

  • Yuan, F., Karatzoglou, A., Arapakis, I., Jose, J.M., He, X.: A simple convolutional generative network for next item recommendation. In: Proceedings of the Twelfth ACM International Conference on Web Search and Data Mining, pp. 582–590 (2019)

  • Zhang, C., Li, Y., Du, N., Fan, W., Yu, P.S.: Entity synonym discovery via multipiece bilateral context matching. In: IJCAI (2020)

  • Zhang, S., Tay, Y., Yao, L., Sun, A., An, J.: Next item recommendation with self-attentive metric learning. In: Thirty-Third AAAI Conference on Artificial Intelligence, vol. 9 (2019)

  • Zhang, S., Yao, L., Sun, A., Tay, Y.: Deep learning based recommender system: a survey and new perspectives. ACM Comput. Surv. (CSUR) 52(1), 1–38 (2019)

    Article  Google Scholar 

  • Zhang, Y., Yang, Q.: A survey on multi-task learning. IEEE Trans. Knowl. Data Eng. (2021)

  • Zhou, C., Ma, J., Zhang, J., Zhou, J., Yang, H.: Contrastive learning for debiased candidate generation in large-scale recommender systems. arXiv:cs.IR/2005.12964 (2020)

  • Zhou, F., Cao, C., Zhong, T., Geng, J.: Learning meta-knowledge for few-shot image emotion recognition. Expert Syst. Appl. 114274 (2021)

  • Zhou, F., Wang, P., Xu, X., Tai, W., Trajcevski, G.: Contrastive trajectory learning for tour recommendation. ACM Trans. Intell. Syst. Technol. (2021)

  • Zhou, F., Xu, X., Trajcevski, G., Zhang, K.: A survey of information cascade analysis: models, predictions, and recent advances. ACM Comput. Surv. 54(2), 27:1-27:36 (2021)

    Google Scholar 

  • Zhou, F., Yang, Q., Zhong, T., Chen, D., Zhang, N.: Variational graph neural networks for road traffic prediction in intelligent transportation systems. IEEE Trans. Ind. Inf. 17(4), 2802–2812 (2021). https://doi.org/10.1109/TII.2020.3009280

    Article  Google Scholar 

Download references

Acknowledgements

This work was supported by National Natural Science Foundation of China (Grant No. 62176043 and No. 62072077).

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Fan Zhou.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Appendix

Appendix

1.1 Notations

Table 11 Frequently used notations
Table 12 HR@K results on Yoochoose1/64, \(K=[1, 3, 5, 10, 15, 20]\)
Table 13 MRR@K results on Yoochoose1/64, \(K=[1, 3, 5, 10, 15, 20]\)
Table 14 nDCG@K results on Yoochoose1/64, \(K=[1, 3, 5, 10, 15, 20]\)
Table 15 Coverage@K results on Yoochoose 1/64, \(K=[1, 3, 5, 10, 15, 20]\)
Table 16 HR@K results on Yoochoose1/4, \(K=[1, 3, 5, 10, 15, 20]\)
Table 17 MRR@K results on Yoochoose1/4, \(K=[1, 3, 5, 10, 15, 20]\)
Table 18 nDCG@K results on Yoochoose1/4, \(K=[1, 3, 5, 10, 15, 20]\)
Table 19 Coverage@K results on Yoochoose1/4, \(K=[1, 3, 5, 10, 15, 20]\)
Table 20 HR@K results on Diginetica, \(K=[1, 3, 5, 10, 15, 20]\)
Table 21 MRR@K results on Diginetica, \(K=[1, 3, 5, 10, 15, 20]\)
Table 22 nDCG@K results on Diginetica, \(K=[1, 3, 5, 10, 15, 20]\)
Table 23 Coverage@K results on Diginetica, \(K=[1, 3, 5, 10, 15, 20]\)

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Tai, W., Lan, T., Wu, Z. et al. Improving session-based recommendation with contrastive learning. User Model User-Adap Inter 33, 1–42 (2023). https://doi.org/10.1007/s11257-022-09332-z

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11257-022-09332-z

Keywords

Navigation