Introduction
High-quality sentence embeddings—vector representations of textual meaning—are fundamental to modern Natural Language Processing (NLP) tasks such as semantic search, clustering, and information retrieval. While unsupervised contrastive learning methods like SimCSE have set strong benchmarks, they often struggle with capturing global semantic structures and are sensitive to noise introduced during data augmentation. This paper introduces ConPVP (Contrastive learning with Prompt-derived Virtual semantic Prototypes), a novel framework that leverages the latent knowledge within pre-trained language models (PLMs) to anchor sentence embeddings to broader semantic concepts.
The Limitations of Instance-wise Contrastive Learning
Standard unsupervised contrastive learning typically relies on "instance-wise" objectives. A model is trained to minimize the distance between a sentence and its augmented version (e.g., via dropout) while maximizing the distance from other sentences in the batch. However, this approach has two primary drawbacks:
- Local Smoothness vs. Global Structure: By focusing only on individual pairs, the model fails to learn the underlying semantic categories of the language.
- Semantic Drift: Simple augmentations can inadvertently alter the meaning of a sentence, leading the model to learn incorrect associations.
The ConPVP Framework: Mining Latent Prototypes
ConPVP addresses these issues by introducing "virtual semantic prototypes" derived directly from the PLM using prompt learning. Instead of clustering the dataset to find centroids, the method uses natural language templates to query the model's internal knowledge.
Prototype Extraction via Prompts
For any given sentence $<S>$, ConPVP wraps it in a template like "<S> is a [MASK] one". The hidden state of the [MASK] token serves as a positive prototype, representing the general semantic category of the sentence. To provide a more robust training signal, the authors also employ Semantically Opposite Templates (e.g., "<S> is not a [MASK] one") to generate negative prototypes.
Prototypical Contrastive Learning
The training objective is a modified prototypical contrastive loss. As shown in the architecture, the model learns to pull a sentence embedding closer to its corresponding positive prototype while pushing it away from its negative prototype and the prototypes of other sentences in the batch. This ensures that the embedding space is not only locally smooth but also globally structured.
Experimental Evaluation
The researchers evaluated ConPVP across several benchmarks, including Semantic Textual Similarity (STS), short text clustering, and transfer tasks.
- STS Performance: ConPVP achieved significant gains over SimCSE, with an average improvement of 2.60 points on BERT-base and 1.28 points on RoBERTa-large.
- Clustering Accuracy: The prototype-based approach improved short text clustering accuracy by up to 2.18 points, demonstrating its ability to group semantically related topics effectively.
- Few-Shot Stability: In low-resource settings (16 samples per class), ConPVP showed greater robustness and higher accuracy than previous state-of-the-art models.
Conclusion
ConPVP demonstrates that the [MASK] token in a prompt-wrapped sentence can effectively capture a "summary" of its semantic role. By aligning sentences with these virtual prototypes, the model creates a more discriminative and semantically meaningful embedding space without the need for labeled data. This approach paves the way for more sophisticated uses of prompt learning in unsupervised representation learning.
Reference: Zeng, J., Yin, Y., Jiang, Y., Wu, S., & Cao, Y. (2022). Contrastive Learning with Prompt-derived Virtual Semantic Prototypes for Unsupervised Sentence Embedding. Findings of EMNLP 2022.
Summary updated