
摘要
本文提出了SimCSE,一种简洁的对比学习框架,显著提升了句子嵌入(sentence embeddings)的当前技术水平。我们首先介绍了一种无监督方法:该方法以输入句子为输入,在对比学习目标下预测自身,仅使用标准的Dropout作为噪声。这一简单方法表现令人惊讶地出色,其性能与此前的监督式方法相当。我们发现,Dropout起到了最小程度的数据增强作用,若将其移除,则会导致表示空间的坍缩(representation collapse)。随后,我们提出了一种监督式方法,通过在对比学习框架中引入自然语言推理数据集中的标注样本,将“蕴含”(entailment)对作为正样本,将“矛盾”(contradiction)对作为困难负样本(hard negatives)。我们在标准的语义文本相似性(Semantic Textual Similarity, STS)任务上对SimCSE进行了评估,基于BERT-base的无监督与监督模型分别取得了76.3%和81.6%的Spearman相关系数,相较于此前最优结果分别提升了4.2%和2.2%。此外,我们从理论和实证两个层面证明,对比学习目标能够对预训练嵌入的各向异性空间进行正则化,使其分布更加均匀;在存在监督信号时,还能更有效地对齐正样本对。
代码仓库
shuxinyin/SimCSE-Pytorch
pytorch
GitHub 中提及
dltmddbs100/SimCSE
pytorch
GitHub 中提及
bm-k/kosimcse-skt
pytorch
GitHub 中提及
wakafengfan/simcse-pytorch
pytorch
GitHub 中提及
BM-K/KoSimCSE_SKT
pytorch
GitHub 中提及
princeton-nlp/SimCSE
官方
pytorch
GitHub 中提及
voidism/diffcse
jax
GitHub 中提及
liangyuxin42/SimCSE-reproduce
pytorch
GitHub 中提及
BM-K/KoSimCSE
pytorch
GitHub 中提及
bhuvanakundumani/SimCSE_unsupervised
pytorch
GitHub 中提及
dll-wu/is-cse
pytorch
GitHub 中提及
hooman650/supcl-seq
pytorch
GitHub 中提及
oneflow-inc/libai
GitHub 中提及
yaushian/msimcse
pytorch
GitHub 中提及
mcgill-nlp/llm2vec
pytorch
GitHub 中提及
jeongukjae/KR-BERT-SimCSE
tf
GitHub 中提及
sulcantonin/text_icalepcs23
pytorch
GitHub 中提及
nlpods/layerattpooler
pytorch
GitHub 中提及
exploration-lab/iitk-semeval-2024-task-1
pytorch
GitHub 中提及
cluebenchmark/simclue
pytorch
GitHub 中提及
vdogmcgee/SimCSE-Chinese-Pytorch
pytorch
GitHub 中提及
shuhewang1998/sim-gpt
pytorch
GitHub 中提及
基准测试
| 基准 | 方法 | 指标 |
|---|---|---|
| semantic-textual-similarity-on-sick | SimCSE-RoBERTalarge | Spearman Correlation: 0.8195 |
| semantic-textual-similarity-on-sts-benchmark | SimCSE-RoBERTalarge | Spearman Correlation: 0.867 |
| semantic-textual-similarity-on-sts12 | SimCSE-RoBERTa-base | Spearman Correlation: 0.7016 |
| semantic-textual-similarity-on-sts12 | SimCSE-RoBERTa-large | Spearman Correlation: 0.7746 |
| semantic-textual-similarity-on-sts13 | SimCSE-RoBERTa-base | Spearman Correlation: 0.8136 |
| semantic-textual-similarity-on-sts13 | SimCSE-RoBERTa-large | Spearman Correlation: 0.8727 |
| semantic-textual-similarity-on-sts13 | SimCSE-BERT-base | Spearman Correlation: 0.8241 |
| semantic-textual-similarity-on-sts14 | SimCSE-RoBERTalarge | Spearman Correlation: 0.8236 |
| semantic-textual-similarity-on-sts15 | SimCSE-RoBERTalarge | Spearman Correlation: 0.8666 |
| semantic-textual-similarity-on-sts16 | SimCSE-RoBERTalarge | Spearman Correlation: 0.8393 |