{"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/contrastive-learning-of-sentence-embeddings","title":"Contrastive Learning of Sentence Embeddings from Scratch","arxiv_id":"2305.15077","date":"2023-05-24","proceeding":null,"authors":["Junlei Zhang","Zhenzhong Lan","Junxian He"],"abstract":"Contrastive learning has been the dominant approach to train state-of-the-art sentence embeddings. Previous studies have typically learned sentence embeddings either through the use of human-annotated natural language inference (NLI) data or via large-scale unlabeled sentences in an unsupervised manner. However, even in the case of unlabeled data, their acquisition presents challenges in certain domains due to various reasons. To address these issues, we present SynCSE, a contrastive learning framework that trains sentence embeddings with synthesized data. Specifically, we explore utilizing large language models to synthesize the required data samples for contrastive learning, including (1) producing positive and negative annotations given unlabeled sentences (SynCSE-partial), and (2) generating sentences along with their corresponding annotations from scratch (SynCSE-scratch). Experimental results on sentence similarity and reranking tasks indicate that both SynCSE-partial and SynCSE-scratch greatly outperform unsupervised baselines, and SynCSE-partial even achieves comparable performance to the supervised models in most settings.","url_abs":"https://arxiv.org/abs/2305.15077v2","url_pdf":"https://arxiv.org/pdf/2305.15077v2.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":"contrastive-learning-of-sentence-embeddings","repo_url":"https://github.com/hkust-nlp/syncse","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"contrastive-learning-of-sentence-embeddings","repo_url":"https://github.com/sjtu-lit/syncse","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"contrastive-learning","task_name":"Contrastive Learning"},{"task_slug":"natural-language-inference","task_name":"Natural Language Inference"},{"task_slug":"reranking","task_name":"Reranking"},{"task_slug":"sentence","task_name":"Sentence"},{"task_slug":"sentence-embeddings","task_name":"Sentence Embeddings"},{"task_slug":"sentence-similarity","task_name":"Sentence Similarity"}],"methods":[{"method_slug":"contrastive-learning","method_name":"Contrastive Learning"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2305.15077","atlas_url":"https://app.syntology.ai/?focus=2305.15077","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2305.15077"}},"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/sjtu-lit/syncse","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/hkust-nlp/syncse","reach":null}],"summary":{"ran_draft_wrong":2,"unverified":4},"by_repo_kind":{"official":{"samples":6,"ran":2,"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":0,"samples":[{"code_sha256_prefix":"4e0ff9c4d9a318ff","entry":"cl_forward","repo":"sjtu-lit/syncse","repo_kind":"official","path":"simcse/models.py","file_url":"https://github.com/sjtu-lit/syncse/blob/HEAD/simcse/models.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"4e0ff9c4d9a318ff"}},{"code_sha256_prefix":"cb67cd5ac977480d","entry":"sentemb_forward","repo":"sjtu-lit/syncse","repo_kind":"official","path":"simcse/model_mp.py","file_url":"https://github.com/sjtu-lit/syncse/blob/HEAD/simcse/model_mp.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"cb67cd5ac977480d"}},{"code_sha256_prefix":"395a2d0164d051ea","entry":"cl_forward","repo":"sjtu-lit/syncse","repo_kind":"official","path":"simcse/model_mp.py","file_url":"https://github.com/sjtu-lit/syncse/blob/HEAD/simcse/model_mp.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":"395a2d0164d051ea"}},{"code_sha256_prefix":"54ed7cc4d58f4f97","entry":"cl_forward","repo":"sjtu-lit/syncse","repo_kind":"official","path":"simcse/models_HSCL.py","file_url":"https://github.com/sjtu-lit/syncse/blob/HEAD/simcse/models_HSCL.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":"54ed7cc4d58f4f97"}},{"code_sha256_prefix":"1e563fb02ef1365c","entry":"cl_forward","repo":"sjtu-lit/syncse","repo_kind":"official","path":"simcse/models_aug.py","file_url":"https://github.com/sjtu-lit/syncse/blob/HEAD/simcse/models_aug.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":"1e563fb02ef1365c"}},{"code_sha256_prefix":"c34d7c6db1fe73eb","entry":"cl_forward","repo":"sjtu-lit/syncse","repo_kind":"official","path":"simcse/models_hard.py","file_url":"https://github.com/sjtu-lit/syncse/blob/HEAD/simcse/models_hard.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":"c34d7c6db1fe73eb"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}