{"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/turning-dross-into-gold-loss-is-bert4rec","title":"Turning Dross Into Gold Loss: is BERT4Rec really better than SASRec?","arxiv_id":"2309.07602","date":"2023-09-14","proceeding":null,"authors":["Anton Klenitskiy","Alexey Vasilev"],"abstract":"Recently sequential recommendations and next-item prediction task has become increasingly popular in the field of recommender systems. Currently, two state-of-the-art baselines are Transformer-based models SASRec and BERT4Rec. Over the past few years, there have been quite a few publications comparing these two algorithms and proposing new state-of-the-art models. In most of the publications, BERT4Rec achieves better performance than SASRec. But BERT4Rec uses cross-entropy over softmax for all items, while SASRec uses negative sampling and calculates binary cross-entropy loss for one positive and one negative item. In our work, we show that if both models are trained with the same loss, which is used by BERT4Rec, then SASRec will significantly outperform BERT4Rec both in terms of quality and training speed. In addition, we show that SASRec could be effectively trained with negative sampling and still outperform BERT4Rec, but the number of negative examples should be much larger than one.","url_abs":"https://arxiv.org/abs/2309.07602v1","url_pdf":"https://arxiv.org/pdf/2309.07602v1.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":"turning-dross-into-gold-loss-is-bert4rec","repo_url":"https://github.com/antklen/sasrec-bert4rec-recsys23","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}},{"paper_slug":"turning-dross-into-gold-loss-is-bert4rec","repo_url":"https://github.com/facebookresearch/generative-recommenders","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"recommendation-systems","task_name":"Recommendation Systems"}],"methods":[{"method_slug":"softmax","method_name":"Softmax"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2309.07602","atlas_url":"https://app.syntology.ai/?focus=2309.07602","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2309.07602"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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/antklen/sasrec-bert4rec-recsys23","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/facebookresearch/generative-recommenders","reach":null}],"summary":{"ran":5,"unverified":1},"by_repo_kind":{"official":{"samples":6,"ran":5,"repositories":1}},"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":6,"samples":[{"code_sha256_prefix":"467b851e63127006","entry":"add_time_idx","repo":"antklen/sasrec-bert4rec-recsys23","repo_kind":"official","path":"src/preprocess.py","file_url":"https://github.com/antklen/sasrec-bert4rec-recsys23/blob/HEAD/src/preprocess.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"467b851e63127006"}},{"code_sha256_prefix":"09f52363a52754fb","entry":"compute_sampled_metrics","repo":"antklen/sasrec-bert4rec-recsys23","repo_kind":"official","path":"src/metrics.py","file_url":"https://github.com/antklen/sasrec-bert4rec-recsys23/blob/HEAD/src/metrics.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"09f52363a52754fb"}},{"code_sha256_prefix":"6ffa95356061fcd2","entry":"filter_items","repo":"antklen/sasrec-bert4rec-recsys23","repo_kind":"official","path":"src/preprocess.py","file_url":"https://github.com/antklen/sasrec-bert4rec-recsys23/blob/HEAD/src/preprocess.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"6ffa95356061fcd2"}},{"code_sha256_prefix":"d9dbb26131fc67ce","entry":"filter_users","repo":"antklen/sasrec-bert4rec-recsys23","repo_kind":"official","path":"src/preprocess.py","file_url":"https://github.com/antklen/sasrec-bert4rec-recsys23/blob/HEAD/src/preprocess.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d9dbb26131fc67ce"}},{"code_sha256_prefix":"14e5b7bc08bf8ed1","entry":"preds2recs","repo":"antklen/sasrec-bert4rec-recsys23","repo_kind":"official","path":"src/postprocess.py","file_url":"https://github.com/antklen/sasrec-bert4rec-recsys23/blob/HEAD/src/postprocess.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"14e5b7bc08bf8ed1"}},{"code_sha256_prefix":"f3a4bdf8809934fe","entry":"extract_validation_history","repo":"antklen/sasrec-bert4rec-recsys23","repo_kind":"official","path":"src/utils.py","file_url":"https://github.com/antklen/sasrec-bert4rec-recsys23/blob/HEAD/src/utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"f3a4bdf8809934fe"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}