Profile

Settings

Loading…

← Papers

Help

FAQ

Which features require signing in?

You can read the commentary, paper info, Model Structure and related papers of public papers without signing in. Sign in to manage your account or contact us about your inquiries.

Can I upload a PDF file?

Upload papers with an arXiv or DOI link; the commentary is public to everyone. Papers whose source and terms of use can't be verified, so the commentary can't be made public, can't be uploaded. Uploading PDF files and keeping papers private are for subscribers only, and a paper uploaded as a file is saved as private only. Searching for official info by title runs only when you press the button.

Are the figures and AI commentary accurate?

Figures come only from the original paper, and only those whose terms of use are verified are shown. The commentary is written by AI and may be wrong. Check important claims, numbers and figure context against the evidence in the original paper.

I want to report a copyright issue.

Terms of use and the source of the original paper are on the Paper info tab. If there's a problem, choose "Paper content, figures and copyright" under Contact us and send the paper link, the part in question, and evidence that you hold the rights. Receiving your report doesn't confirm any rights or remove anything right away. You can see the result of the review under My inquiries.

I forgot my password.

If you signed up with email, use Forgot password in the sign-in window to reset it with your verified email. If you signed up with Google, Naver or Kakao, change your password with that service.

What should I include in an inquiry?

Tell us which screen you were on and what you were doing when the problem happened, along with the paper link. Don't include personal information such as passwords, API keys, verification codes or phone numbers. Inquiries and replies are stored in Refivu and you can see them under My inquiries.

How do I delete my account?

In Settings, under My account, press Delete account. Review what will be deleted and complete identity verification to delete your account. For other requests, choose "Account" under Contact us.

Paper commentary

SimCSE: Simple Contrastive Learning of Sentence Embeddings

Contrastive learning with dropout noise produces strong sentence embeddings

  • Problem Contrastive learning for sentence embeddings needs positive pairs, and text has no clean equivalent of the crops and flips used for images. Word-level edits change meaning, so the positives are noisy.
  • Method SimCSE fine-tunes a BERT or RoBERTa encoder with a cross-entropy contrastive loss over cosine similarities. Unsupervised positives come from passing one sentence through the encoder twice under independent dropout masks, and supervised positives are NLI entailment pairs, with contradiction hypotheses added as hard negatives.
  • Results Unsupervised SimCSE-BERTbase reaches 76.25 average Spearman's correlation on the STS tasks, above CT-BERTbase at 72.05.

Why positive pairs are hard to get for sentences

Contrastive learning needs two inputs that should land close together, and for sentences the usual sources are labeled pairs or hand-written augmentations. In vision, two random transformations of one image serve as such a pair. Text does not transform this cleanly. Word deletion, reordering and substitution change the input in discrete steps, and each step can alter the meaning, so the positives are noisy.

Earlier sentence encoders often used a neighbouring sentence as the positive, as in the next-sentence objective that this paper later uses as a baseline. The study asks two questions: whether a contrastive objective can work when the only positive is the input sentence itself, and whether annotated NLI pairs can give a stronger training signal.

Dropout as the source of positives

Unsupervised SimCSE sets the second view of a sentence equal to the sentence itself. The two views differ only because each forward pass samples its own dropout mask on the fully connected layers and attention probabilities of the Transformer. The method adds no dropout of its own: it reuses the default rate of 0.1 that the Transformer already applies.

For a mini-batch of N sentences, the loss for sentence i is a cross-entropy over cosine similarities scaled by the temperature, where the positive is the second dropout view of the same sentence and the negatives are the other sentences in the batch. \[ \ell_i = -\log \frac{e^{\mathrm{sim}(h_i^{z_i}, h_i^{z_i'})/\tau}}{\sum_{j=1}^{N} e^{\mathrm{sim}(h_i^{z_i}, h_j^{z_j'})/\tau}} \]

The encoder is a pre-trained BERT or RoBERTa, and the [CLS] vector serves as the sentence representation during training. The MLP layer on top of [CLS] is kept only during training, because test-time embeddings with the MLP scored lower in the authors' ablation.

How dropout compares with other augmentations

On the STS-B development set with BERTbase, unsupervised SimCSE scores 82.5 Spearman's correlation. Cropping 10%, 20% and 30% of the sentence gives 77.8, 71.4 and 63.6. Word deletion at 10%, 20% and 30% gives 75.9, 72.2 and 68.2, deleting one word gives 75.9, synonym replacement gives 77.4, and MLM replacement of 15% of words gives 62.2.

Removing dropout entirely gives 74.2, so the dropout noise matters even inside the same design. The next-sentence objective reaches 67.1 with two encoders and 68.9 with one, while sampling one of the next three sentences gives 67.4 and 68.8. The self-prediction objective with one encoder reaches 82.5, and with two encoders it reaches 80.7.

Alignment and uniformity as the evaluation lens

Alignment is the expected distance between the embeddings of positive pairs, taken over the positive distribution and assuming normalized representations. It is defined as follows. \[ \ell_{align} \triangleq \mathbb{E}_{(x,x^+)\sim p_{pos}} \| f(x) - f(x^+) \|^2 \] Uniformity takes the logarithm of the average of a Gaussian-type potential over random pairs drawn from the data distribution, so that lower values mean the embeddings spread more evenly over the hypersphere.

What happens when dropout is removed or shared

On the STS-B development set, the dropout probability varies from 0.0 to 0.5. The scores are 71.1 at 0.0, 72.6 at 0.01, 81.1 at 0.05, 82.5 at 0.1, 81.4 at 0.15, 80.5 at 0.2 and 71.0 at 0.5. Using the default rate 0.1 but the same mask for both views drops the score to 43.6, so the two views must differ in their masks.

Tracking alignment and uniformity every 10 training steps, every variant improves uniformity from its pre-trained starting point. The no-dropout and fixed-mask variants, however, lose alignment sharply, while unsupervised SimCSE keeps alignment steady. Deleting one word improves alignment, but its gain in uniformity is smaller, and it finishes below unsupervised SimCSE.

The authors attribute the importance of the pre-trained start to the good initial alignment it provides.

Choosing supervised positive pairs

Supervised SimCSE takes premise and entailment-hypothesis pairs from SNLI and MNLI as positive instances, in place of a three-way classification head. The study compares this choice with QQP, Flickr30k, ParaNMT and the neutral and contradiction pairs. On the STS-B development set with BERTbase, the entailment pairs from SNLI and MNLI reach 84.1 with a 134k-pair subsample and 84.9 with the full 314k pairs.

Neutral pairs reach 82.6 and 82.9, contradiction pairs 77.5 and 77.6, and all NLI pairs together 81.7 and 81.9. QQP reaches 81.8 with both sampling choices, Flickr30k 81.5 and 81.4, and ParaNMT 79.7 and 78.7.

The authors suggest that NLI pairs work better because they are crowd-sourced and show less lexical overlap. The F1 overlap between bags of words is 39% for the entailment pairs, against 60% for QQP and 55% for ParaNMT.

Contradictions as hard negatives

For each premise, the objective keeps its entailment hypothesis as the positive and adds the paired contradiction hypothesis as a hard negative. The contradiction terms join the denominator alongside the in-batch terms. \[ \ell_i = -\log \frac{e^{\mathrm{sim}(h_i,h_i^+)/\tau}}{\sum_{j=1}^{N}\left(e^{\mathrm{sim}(h_i,h_j^+)/\tau}+e^{\mathrm{sim}(h_i,h_j^-)/\tau}\right)} \]

On the STS-B development set, adding the hard negatives raises the score from 84.9 to 86.2. Weighting the hard negatives by a factor alpha gives 86.1 at 0.5, 86.2 at 1.0 and 86.2 at 2.0, while also treating neutral hypotheses as hard negatives gives 85.3. The authors keep alpha at 1.0 in the final model. A dual-encoder version of supervised SimCSE lowers the score from 86.2 to 84.2, and adding ANLI brought no meaningful gain in the authors' tests.

Why contrastive learning flattens the spectrum

Pre-trained embeddings occupy a narrow cone, which is the anisotropy problem. Singular values of the word embedding matrix also decay quickly, with only a few dominating. With normalized embeddings and infinitely many negatives, the asymptotic form of the contrastive objective has a positive-pair term and a negative-pair term, and the authors study the negative term.

When the data distribution is uniform over a finite sample, Jensen's inequality bounds the negative term from below by a scaled sum of all inner products between sentence embeddings. \[ \frac{1}{m}\sum_{i=1}^{m}\log\frac{1}{m}\sum_{j=1}^{m}e^{h_i^\top h_j/\tau} \ge \frac{1}{\tau m^2}\sum_{i=1}^{m}\sum_{j=1}^{m} h_i^\top h_j \]

Writing W for the matrix whose rows are the normalized embeddings, the sum of all entries of WW^T is an upper bound on its largest eigenvalue when all entries are positive. The authors state that this positivity holds in most cases, citing their figure of the Gram matrix. Minimizing the negative term therefore reduces the top eigenvalue, which the authors read as flattening the singular spectrum.

Unlike post-processing methods that only push toward isotropy, the positive term also keeps positive pairs aligned.

Figure F.1 plots normalized singular values of the sentence embedding matrix from STS-B. Vanilla BERT and SBERT drop fastest, SimCSE flattens the curve, and the post-processing methods flatten it further.

Results on the STS tasks

Under the all setting with Spearman's correlation, unsupervised SimCSE-BERTbase averages 76.25 over the STS tasks, above CT-BERTbase at 72.05. Unsupervised SimCSE-RoBERTabase averages 76.57 and SimCSE-RoBERTalarge 78.90, from the same table.

With NLI supervision, SimCSE-BERTbase averages 81.57, above SBERTbase at 74.89, and SimCSE-RoBERTalarge reaches 83.76. The authors choose the all setting, which pools all topics of a year's STS challenge, together with no extra regressor and Spearman's correlation, and they reproduced some baselines under other settings.

Transfer tasks and the MLM variant

The transfer evaluation trains a logistic regression on top of frozen sentence embeddings. Unsupervised SimCSE-BERTbase averages 85.81 accuracy, close to IS-BERTbase at 85.83. Adding the MLM objective with lambda 0.1 lifts the unsupervised BERTbase average to 86.64 and the supervised BERTbase average to 86.86.

Post-processing with BERT-flow or BERT-whitening lowers transfer performance compared with the base models, and the authors read this as good uniformity not translating into transfer gains.

Limits of the evidence

Evaluation protocols differ across the papers compared, and the authors list the regressor, correlation metric and aggregation choice for each. Their own table reports baselines under several settings.

Most ablations and comparisons, including pooling, temperature and hard-negative weighting, were run on the STS-B development set. The spectrum argument rests on an analytic bound and on a figure of singular values, and the paper does not test whether the flattening alone explains the STS gains.

Paper info

Authors
Tianyu Gao, Xingcheng Yao, Danqi Chen
Venue
arXiv · Preprint
First published
2021-4-18
Added
2026-11-12
Updated
2022-5-18
Version
v4
arXiv
2104.08821
Category
cs.CL · cs.LG
Original paper terms
arXiv non-exclusive 1.0
What we show
Paper info and commentary

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

Quote from the paper

Tianyu Gao, Xingcheng Yao, Danqi Chen (2021). SimCSE: Simple Contrastive Learning of Sentence Embeddings. arXiv:2104.08821v4. https://arxiv.org/abs/2104.08821v4

BibTeX
@misc{gao2021simcse,
  title = {{SimCSE: Simple Contrastive Learning of Sentence Embeddings}},
  author = {Tianyu Gao and Xingcheng Yao and Danqi Chen},
  year = {2021},
  eprint = {2104.08821},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2104.08821v4}
}

See related papersBrowse other papers

Paper preview
Account security

Connect Google account

If you connect a Google account, you can sign in with it too.

Refivu

Delete account

Refivu
Refivu

Sign up