Improved Universal Sentence Embeddings with Prompt-based Contrastive Learning and Energy-based Learning

Yuxin Jiang, Linhan Zhang, Wei Wang
3/14/2022
cs.CL
contrastive-ssl

Official code: YJiangcm/PromCSE (136 stars, Python, PyTorch, last commit 2023-11-17).

Abstract

Contrastive learning has been demonstrated to be effective in enhancing pre-trained language models (PLMs) to derive superior universal sentence embeddings. However, existing contrastive methods still have two limitations.

Show full abstract

Firstly, previous works may acquire poor performance under domain shift settings, thus hindering the application of sentence representations in practice. We attribute this low performance to the over-parameterization of PLMs with millions of parameters. To alleviate it, we propose PromCSE (Prompt-based Contrastive Learning for Sentence Embeddings), which only trains small-scale \emph{Soft Prompt} (i.e., a set of trainable vectors) while keeping PLMs fixed. Secondly, the commonly used NT-Xent loss function of contrastive learning does not fully exploit hard negatives in supervised learning settings. To this end, we propose to integrate an Energy-based Hinge loss to enhance the pairwise discriminative power, inspired by the connection between the NT-Xent loss and the Energy-based Learning paradigm. Empirical results on seven standard semantic textual similarity (STS) tasks and a domain-shifted STS task both show the effectiveness of our method compared with the current state-of-the-art sentence embedding models. Our code is publicly avaliable at https://github.com/YJiangcm/PromCSE

View on arXivView PDF

Code Implementations(1)

YJiangcm/PromCSEOfficial100%
PyTorch

[EMNLP 2022] Improved Universal Sentence Embeddings with Prompt-based Contrastive Learning and Energy-based Learning

13616Python, ShellJan 1, 20223 years ago
contrastive-learningenergy-based-learningpromptpytorchsentence-embeddings

Similar Papers

Cite this paper

@article{jiang2022improved,
  title  = {Improved Universal Sentence Embeddings with Prompt-based Contrastive Learning and Energy-based Learning},
  author = {Yuxin Jiang and Linhan Zhang and Wei Wang},
  year   = {2022},
  eprint = {2203.06875},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2203.06875}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2203.06875.svg)](https://codeofpaper.com/paper/2203.06875)

Discussion