{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/180809781","title":"Self-Attentive Sequential Recommendation","arxiv_id":"1808.09781","date":"2018-08-20","proceeding":null,"authors":["Wang-Cheng Kang","Julian McAuley"],"abstract":"Sequential dynamics are a key feature of many modern recommender systems,\nwhich seek to capture the `context' of users' activities on the basis of\nactions they have performed recently. To capture such patterns, two approaches\nhave proliferated: Markov Chains (MCs) and Recurrent Neural Networks (RNNs).\nMarkov Chains assume that a user's next action can be predicted on the basis of\njust their last (or last few) actions, while RNNs in principle allow for\nlonger-term semantics to be uncovered. Generally speaking, MC-based methods\nperform best in extremely sparse datasets, where model parsimony is critical,\nwhile RNNs perform better in denser datasets where higher model complexity is\naffordable. The goal of our work is to balance these two goals, by proposing a\nself-attention based sequential model (SASRec) that allows us to capture\nlong-term semantics (like an RNN), but, using an attention mechanism, makes its\npredictions based on relatively few actions (like an MC). At each time step,\nSASRec seeks to identify which items are `relevant' from a user's action\nhistory, and use them to predict the next item. Extensive empirical studies\nshow that our method outperforms various state-of-the-art sequential models\n(including MC/CNN/RNN-based approaches) on both sparse and dense datasets.\nMoreover, the model is an order of magnitude more efficient than comparable\nCNN/RNN-based models. Visualizations on attention weights also show how our\nmodel adaptively handles datasets with various density, and uncovers meaningful\npatterns in activity sequences.","url_abs":"http://arxiv.org/abs/1808.09781v1","url_pdf":"http://arxiv.org/pdf/1808.09781v1.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"180809781","repo_url":"https://github.com/UlionTse/mlgb","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"unanswered"}},{"paper_slug":"180809781","repo_url":"https://github.com/facebookresearch/generative-recommenders","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"180809781","repo_url":"https://github.com/mangushev/mfgan","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"tf","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"180809781","repo_url":"https://github.com/otto-de/recsys-dataset","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"180809781","repo_url":"https://github.com/paddorch/SASRec.paddle","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"paddle","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"180809781","repo_url":"https://github.com/kang205/SASRec","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"tf","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"180809781","repo_url":"https://github.com/microsoft/recommenders","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"tf","reach":null},{"paper_slug":"180809781","repo_url":"https://github.com/pmixer/SASRec.pytorch","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"recommendation-systems","task_name":"Recommendation Systems"},{"task_slug":"sequential-recommendation","task_name":"Sequential Recommendation"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/recommendation-systems-on-amazon-beauty","task":"Recommendation Systems","dataset":"Amazon Beauty","model":"SASRec","rank_in_archive_order":6,"of":6,"metrics":{"Hit@10":"0.4854","nDCG@10":"0.3219"},"uses_additional_data":false},{"leaderboard":"/sota/recommendation-systems-on-amazon-games","task":"Recommendation Systems","dataset":"Amazon Games","model":"SASRec","rank_in_archive_order":5,"of":6,"metrics":{"Hit@10":"0.7410","nDCG@10":"0.5360"},"uses_additional_data":false},{"leaderboard":"/sota/recommendation-systems-on-amazon-book","task":"Recommendation Systems","dataset":"Amazon-Book","model":"SASRec","rank_in_archive_order":16,"of":16,"metrics":{"HR@10":"0.0306","HR@50":"0.0754","NDCG@10":"0.0164","NDCG@50":"0.0260"},"uses_additional_data":false},{"leaderboard":"/sota/collaborative-filtering-on-movielens-1m","task":"Recommendation Systems","dataset":"MovieLens 1M","model":"SASRec","rank_in_archive_order":18,"of":31,"metrics":{"HR@10":"0.8245","HR@10 (full corpus)":"0.2821","NDCG@10 (full corpus)":"0.1603","nDCG@10":"0.5905"},"uses_additional_data":false},{"leaderboard":"/sota/collaborative-filtering-on-movielens-20m","task":"Recommendation Systems","dataset":"MovieLens 20M","model":"SASRec","rank_in_archive_order":16,"of":18,"metrics":{"HR@10 (full corpus)":"0.2889","nDCG@10 (full corpus)":"0.1621"},"uses_additional_data":false},{"leaderboard":"/sota/recommendation-systems-on-steam","task":"Recommendation Systems","dataset":"Steam","model":"SASRec","rank_in_archive_order":1,"of":1,"metrics":{"Hit@10":"0.8729","nDCG@10":"0.6306"},"uses_additional_data":false},{"leaderboard":"/sota/sequential-recommendation-on-movielens-1m","task":"Sequential Recommendation","dataset":"MovieLens 1M","model":"SASRec","rank_in_archive_order":3,"of":4,"metrics":{"HR@10":"0.2137","HR@10 (99 Neg. Samples)":"0.7904","HR@20":"0.3245","HR@5":"0.1374","HR@5 (99 Neg. Samples)":"0.6874","MRR (99 Neg. Samples)":"0.5020","NDCG@10":"0.1116","NDCG@10 (99 Neg. Samples)":"0.5642","NDCG@20":"0.1395","NDCG@5":"0.0873","NDCG@5 (99 Neg. Samples)":"0.5308"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=1808.09781","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1808.09781"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/mangushev/mfgan","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/pmixer/SASRec.pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/microsoft/recommenders","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/UlionTse/mlgb","reach":{"status":"unanswered"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/paddorch/SASRec.paddle","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/facebookresearch/generative-recommenders","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/otto-de/recsys-dataset","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/kang205/SASRec","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran_fixture":1,"ran_honours":1,"ran_draft_wrong":1,"unverified":17},"by_repo_kind":{"listed":{"samples":20,"ran":3,"repositories":5}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"873e08c3f15eb1e4","entry":"dropout","repo":"mangushev/mfgan","repo_kind":"listed","path":"model.py","file_url":"https://github.com/mangushev/mfgan/blob/HEAD/model.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"873e08c3f15eb1e4"}},{"code_sha256_prefix":"13e1db5681123f3a","entry":"random_neq","repo":"kang205/SASRec","repo_kind":"listed","path":"sampler.py","file_url":"https://github.com/kang205/SASRec/blob/HEAD/sampler.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"13e1db5681123f3a"}},{"code_sha256_prefix":"7b84f3e6a96584b4","entry":"reshape_to_matrix","repo":"mangushev/mfgan","repo_kind":"listed","path":"model.py","file_url":"https://github.com/mangushev/mfgan/blob/HEAD/model.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"7b84f3e6a96584b4"}},{"code_sha256_prefix":"8f34807990e04010","entry":"build_index","repo":"pmixer/SASRec.pytorch","repo_kind":"listed","path":"python/utils.py","file_url":"https://github.com/pmixer/SASRec.pytorch/blob/HEAD/python/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"8f34807990e04010"}},{"code_sha256_prefix":"b69fecb2a2840c7b","entry":"data_partition","repo":"paddorch/SASRec.paddle","repo_kind":"listed","path":"sasrec/utils.py","file_url":"https://github.com/paddorch/SASRec.paddle/blob/HEAD/sasrec/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"b69fecb2a2840c7b"}},{"code_sha256_prefix":"fdc971ebe26e3773","entry":"embedding","repo":"kang205/SASRec","repo_kind":"listed","path":"modules.py","file_url":"https://github.com/kang205/SASRec/blob/HEAD/modules.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"fdc971ebe26e3773"}},{"code_sha256_prefix":"fcc7874cdb3add47","entry":"evaluate_session","repo":"otto-de/recsys-dataset","repo_kind":"listed","path":"src/evaluate.py","file_url":"https://github.com/otto-de/recsys-dataset/blob/HEAD/src/evaluate.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"fcc7874cdb3add47"}},{"code_sha256_prefix":"51a55750bad649a9","entry":"example","repo":"mangushev/mfgan","repo_kind":"listed","path":"prepare_data.py","file_url":"https://github.com/mangushev/mfgan/blob/HEAD/prepare_data.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"51a55750bad649a9"}},{"code_sha256_prefix":"50958618b65e514e","entry":"get_assignment_map_from_checkpoint","repo":"mangushev/mfgan","repo_kind":"listed","path":"training.py","file_url":"https://github.com/mangushev/mfgan/blob/HEAD/training.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"50958618b65e514e"}},{"code_sha256_prefix":"eab2ac5ffc1c2836","entry":"get_max_ts","repo":"otto-de/recsys-dataset","repo_kind":"listed","path":"src/testset.py","file_url":"https://github.com/otto-de/recsys-dataset/blob/HEAD/src/testset.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"eab2ac5ffc1c2836"}},{"code_sha256_prefix":"c573805ca4f55418","entry":"ground_truth","repo":"otto-de/recsys-dataset","repo_kind":"listed","path":"src/labels.py","file_url":"https://github.com/otto-de/recsys-dataset/blob/HEAD/src/labels.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"c573805ca4f55418"}},{"code_sha256_prefix":"2a23cef922cb4b79","entry":"normalize","repo":"kang205/SASRec","repo_kind":"listed","path":"modules.py","file_url":"https://github.com/kang205/SASRec/blob/HEAD/modules.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"2a23cef922cb4b79"}},{"code_sha256_prefix":"9567ab1b29ad4797","entry":"positional_encoding","repo":"kang205/SASRec","repo_kind":"listed","path":"modules.py","file_url":"https://github.com/kang205/SASRec/blob/HEAD/modules.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"9567ab1b29ad4797"}},{"code_sha256_prefix":"89eb96b11b86a9c2","entry":"prepare_labels","repo":"otto-de/recsys-dataset","repo_kind":"listed","path":"src/evaluate.py","file_url":"https://github.com/otto-de/recsys-dataset/blob/HEAD/src/evaluate.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"89eb96b11b86a9c2"}},{"code_sha256_prefix":"62f28fd0561698f8","entry":"prepare_predictions","repo":"otto-de/recsys-dataset","repo_kind":"listed","path":"src/evaluate.py","file_url":"https://github.com/otto-de/recsys-dataset/blob/HEAD/src/evaluate.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"62f28fd0561698f8"}},{"code_sha256_prefix":"3370499aacadb239","entry":"reshape_from_matrix","repo":"mangushev/mfgan","repo_kind":"listed","path":"model.py","file_url":"https://github.com/mangushev/mfgan/blob/HEAD/model.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"3370499aacadb239"}},{"code_sha256_prefix":"ed413c5d2cc8afc9","entry":"sample_function","repo":"kang205/SASRec","repo_kind":"listed","path":"sampler.py","file_url":"https://github.com/kang205/SASRec/blob/HEAD/sampler.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"ed413c5d2cc8afc9"}},{"code_sha256_prefix":"f54d868213b75be7","entry":"sample_function","repo":"paddorch/SASRec.paddle","repo_kind":"listed","path":"sasrec/data.py","file_url":"https://github.com/paddorch/SASRec.paddle/blob/HEAD/sasrec/data.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"f54d868213b75be7"}},{"code_sha256_prefix":"d64812b980f1617e","entry":"sample_function","repo":"pmixer/SASRec.pytorch","repo_kind":"listed","path":"python/utils.py","file_url":"https://github.com/pmixer/SASRec.pytorch/blob/HEAD/python/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"d64812b980f1617e"}},{"code_sha256_prefix":"77689c32893561dc","entry":"trim_session","repo":"otto-de/recsys-dataset","repo_kind":"listed","path":"src/testset.py","file_url":"https://github.com/otto-de/recsys-dataset/blob/HEAD/src/testset.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"77689c32893561dc"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}