Sentence Embeddings using Supervised Contrastive Learning

Danqi Liao
6/9/2021
cs.CLcs.LG
contrastive-ssl

Official code: Danqi7/584-final (3 stars, Python, last commit 2021-08-17).

Abstract

Sentence embeddings encode sentences in fixed dense vectors and have played an important role in various NLP tasks and systems. Methods for building sentence embeddings include unsupervised learning such as Quick-Thoughts and supervised learning such as InferSent.

Show full abstract

With the success of pretrained NLP models, recent research shows that fine-tuning pretrained BERT on SNLI and Multi-NLI data creates state-of-the-art sentence embeddings, outperforming previous sentence embeddings methods on various evaluation benchmarks. In this paper, we propose a new method to build sentence embeddings by doing supervised contrastive learning. Specifically our method fine-tunes pretrained BERT on SNLI data, incorporating both supervised crossentropy loss and supervised contrastive loss. Compared with baseline where fine-tuning is only done with supervised cross-entropy loss similar to current state-of-the-art method SBERT, our supervised contrastive method improves 2.8% in average on Semantic Textual Similarity (STS) benchmarks and 1.05% in average on various sentence transfer tasks.

View on arXivView PDF

Code Implementations(1)

Danqi7/584-finalOfficial100%

Sentence Embeddings using Supervised Contrastive Learning. Danqi Liao.

36Python, ShellApr 23, 20215 years ago

Similar Papers

Cite this paper

@article{liao2021sentence,
  title  = {Sentence Embeddings using Supervised Contrastive Learning},
  author = {Danqi Liao},
  year   = {2021},
  eprint = {2106.04791},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2106.04791}
}

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/2106.04791.svg)](https://codeofpaper.com/paper/2106.04791)

Discussion