{"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/phrase-bert-improved-phrase-embeddings-from","title":"Phrase-BERT: Improved Phrase Embeddings from BERT with an Application to Corpus Exploration","arxiv_id":"2109.06304","date":"2021-09-13","proceeding":"EMNLP 2021 11","authors":["Shufan Wang","Laure Thompson","Mohit Iyyer"],"abstract":"Phrase representations derived from BERT often do not exhibit complex phrasal compositionality, as the model relies instead on lexical similarity to determine semantic relatedness. In this paper, we propose a contrastive fine-tuning objective that enables BERT to produce more powerful phrase embeddings. Our approach (Phrase-BERT) relies on a dataset of diverse phrasal paraphrases, which is automatically generated using a paraphrase generation model, as well as a large-scale dataset of phrases in context mined from the Books3 corpus. Phrase-BERT outperforms baselines across a variety of phrase-level similarity tasks, while also demonstrating increased lexical diversity between nearest neighbors in the vector space. Finally, as a case study, we show that Phrase-BERT embeddings can be easily integrated with a simple autoencoder to build a phrase-based neural topic model that interprets topics as mixtures of words and phrases by performing a nearest neighbor search in the embedding space. Crowdsourced evaluations demonstrate that this phrase-based topic model produces more coherent and meaningful topics than baseline word and phrase-level topic models, further validating the utility of Phrase-BERT.","url_abs":"https://arxiv.org/abs/2109.06304v2","url_pdf":"https://arxiv.org/pdf/2109.06304v2.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":"phrase-bert-improved-phrase-embeddings-from","repo_url":"https://github.com/sf-wa-326/phrase-bert-topic-model","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"phrase-bert-improved-phrase-embeddings-from","repo_url":"https://github.com/memray/llm_phrase_semantics","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"diversity","task_name":"Diversity"},{"task_slug":"paraphrase-generation","task_name":"Paraphrase Generation"},{"task_slug":"topic-models","task_name":"Topic Models"}],"methods":[{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"attention-dropout","method_name":"Attention Dropout"},{"method_slug":"bert","method_name":"BERT"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"linear-warmup-with-linear-decay","method_name":"Linear Warmup With Linear Decay"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"weight-decay","method_name":"Weight Decay"},{"method_slug":"wordpiece","method_name":"WordPiece"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2109.06304","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2109.06304"}},"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":"deterministic:regex_extraction","url":"https://github.com/sf-wa-326/phrase-bert-topic-model","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/memray/llm_phrase_semantics","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran_violates":1,"ran_honours":1,"unverified":7},"by_repo_kind":{"official":{"samples":2,"ran":2,"repositories":1},"listed":{"samples":7,"ran":0,"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":2,"samples":[{"code_sha256_prefix":"251934aa5746841d","entry":"compute_triplet_loss","repo":"sf-wa-326/phrase-bert-topic-model","repo_kind":"official","path":"phrase-topic-model/model_utils.py","file_url":"https://github.com/sf-wa-326/phrase-bert-topic-model/blob/HEAD/phrase-topic-model/model_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"251934aa5746841d"}},{"code_sha256_prefix":"5ce2a7a23084e4c8","entry":"l2_normalize_batch","repo":"sf-wa-326/phrase-bert-topic-model","repo_kind":"official","path":"phrase-topic-model/model_utils.py","file_url":"https://github.com/sf-wa-326/phrase-bert-topic-model/blob/HEAD/phrase-topic-model/model_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"5ce2a7a23084e4c8"}},{"code_sha256_prefix":"f683260388c1d177","entry":"conduct_turney_test","repo":"memray/llm_phrase_semantics","repo_kind":"listed","path":"phrase-semantic-eval/eval_turney.py","file_url":"https://github.com/memray/llm_phrase_semantics/blob/HEAD/phrase-semantic-eval/eval_turney.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":"f683260388c1d177"}},{"code_sha256_prefix":"809d9efd59171d4c","entry":"load_PiC_PS_data","repo":"memray/llm_phrase_semantics","repo_kind":"listed","path":"phrase-semantic-eval/eval_PiC_PS.py","file_url":"https://github.com/memray/llm_phrase_semantics/blob/HEAD/phrase-semantic-eval/eval_PiC_PS.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":"809d9efd59171d4c"}},{"code_sha256_prefix":"6bee788f8fa4c5d0","entry":"load_bird_dev_data","repo":"memray/llm_phrase_semantics","repo_kind":"listed","path":"phrase-semantic-eval/eval_bird.py","file_url":"https://github.com/memray/llm_phrase_semantics/blob/HEAD/phrase-semantic-eval/eval_bird.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":"6bee788f8fa4c5d0"}},{"code_sha256_prefix":"edf9e080104293c0","entry":"openai_conduct_PiCPS_test","repo":"memray/llm_phrase_semantics","repo_kind":"listed","path":"phrase-semantic-eval/eval_PiC_PS.py","file_url":"https://github.com/memray/llm_phrase_semantics/blob/HEAD/phrase-semantic-eval/eval_PiC_PS.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":"edf9e080104293c0"}},{"code_sha256_prefix":"f664f8b11ba8231e","entry":"openai_conduct_bird_test","repo":"memray/llm_phrase_semantics","repo_kind":"listed","path":"phrase-semantic-eval/eval_bird.py","file_url":"https://github.com/memray/llm_phrase_semantics/blob/HEAD/phrase-semantic-eval/eval_bird.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":"f664f8b11ba8231e"}},{"code_sha256_prefix":"d722ba66abb59aae","entry":"openai_conduct_turney_test","repo":"memray/llm_phrase_semantics","repo_kind":"listed","path":"phrase-semantic-eval/eval_turney.py","file_url":"https://github.com/memray/llm_phrase_semantics/blob/HEAD/phrase-semantic-eval/eval_turney.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":"d722ba66abb59aae"}},{"code_sha256_prefix":"f26677a468445f39","entry":"soft_cross_entropy","repo":"memray/llm_phrase_semantics","repo_kind":"listed","path":"phrase-topic-model/model_utils.py","file_url":"https://github.com/memray/llm_phrase_semantics/blob/HEAD/phrase-topic-model/model_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":"f26677a468445f39"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}