Phrase-BERT: Improved Phrase Embeddings from BERT with an Application to Corpus Exploration

Shufan Wang, Laure Thompson, Mohit Iyyer

Abstract

While BERT has revolutionized natural language understanding, it exhibits a significant weakness in representing short phrases. Standard BERT models often rely on lexical overlap—matching specific words—rather than capturing true semantic meaning. We present Phrase-BERT, a model fine-tuned using a contrastive objective on diverse paraphrase datasets and phrases within their natural contexts. Phrase-BERT produces robust phrase embeddings that outperform existing models on semantic similarity tasks and enables more intuitive, phrase-based topic modeling.

Introduction: The Lexical Overlap Trap

Standard BERT models are typically pre-trained on long sequences, leaving them without a dedicated mechanism for phrasal compositionality. When generating embeddings for short phrases, BERT frequently falls back on string similarity. For example, if we query the nearest neighbors for the phrase "pulls the trigger," a standard BERT model returns phrases like "pulled the trigger" or "squeezed the trigger."

Comparison of nearest neighbors for "pulls the trigger" across different models.

As shown in the table above, while BERT and its variants (SpanBERT, Sent-BERT) focus on the literal words "the trigger," Phrase-BERT identifies semantically related but lexically distinct phrases such as "picks up his gun" or "takes aim." This reliance on lexical overlap makes standard embeddings less effective for tasks where meaning must transcend specific word choice.

Methodology: Teaching BERT Phrasal Semantics

To overcome the lexical overlap bias, Phrase-BERT is trained using a contrastive learning framework. The authors employ two primary strategies to "teach" the model how phrases function in isolation and in context:

  1. Lexically Diverse Paraphrasing: The model is trained on a dataset of paraphrases that share zero non-stopword tokens (e.g., "complete control" vs. "full power of the system"). This forces the model to prioritize semantic content over character matching.
  2. Phrases in Context: Using a massive book corpus (Books3), the model learns to place a phrase embedding near the embedding of its surrounding 120-token context, leveraging distributional semantics.

The Contrastive Objective

Both strategies utilize a triplet loss objective. For any given "anchor" phrase, the model is penalized if the anchor's vector is closer to a negative example (a random phrase or unrelated context) than it is to a positive example (its true paraphrase or actual context).

The contrastive objective pushes semantically related phrases and contexts together while pushing unrelated ones apart.

Evaluation and Key Results

Phrase-BERT was evaluated against standard benchmarks (Turney, BiRD, PPDB) and new adversarial datasets designed to strip away lexical cues (PPDB-filtered and PAWS-short).

  • Superior Semantic Accuracy: Phrase-BERT outperformed BERT, SpanBERT, and Sentence-BERT across all similarity tasks. On the adversarial PAWS-short dataset, Phrase-BERT achieved 58.9% accuracy, while standard BERT performed at 50.0%—no better than random guessing.
  • Increased Lexical Diversity: Analysis of nearest neighbors confirmed that Phrase-BERT's results share fewer word sequences with the query while remaining more semantically relevant than baseline models.
  • Enhanced Topic Modeling: By integrating Phrase-BERT embeddings into a neural topic model (PNTM), the authors created topics represented by a mix of words and complex phrases. Human evaluators found these phrase-augmented topics significantly more coherent than those produced by traditional word-only models like LDA.

Conclusion

Phrase-BERT addresses a fundamental limitation in transformer-based models by explicitly training for phrasal meaning. By breaking the reliance on lexical overlap through contrastive fine-tuning, the model provides a more powerful tool for semantic parsing, document exploration, and any NLP task where the nuance of short phrases is critical. Future work may involve integrating these phrasal representations directly into the initial pre-training phase of large language models.

Summary updated

BibTeX
@inproceedings{wang2021phrase,
  author = {Shufan Wang and Laure Thompson and Mohit Iyyer},
  title = {{Phrase-BERT: Improved Phrase Embeddings from BERT with an Application to Corpus Exploration}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2021},
  doi = {10.18653/v1/2021.emnlp-main.846},
}
Figure