Skip to main content
QUICK REVIEW

[Paper Review] DiffCSE: Difference-based Contrastive Learning for Sentence Embeddings

Yung-Sung Chuang, Rumen Dangovski|arXiv (Cornell University)|Apr 21, 2022
Topic ModelingComputer Science5 citations
TL;DR

DiffCSE proposes an unsupervised contrastive learning framework for sentence embeddings that explicitly models differences between original and masked-language-model-augmented sentences, improving semantic similarity performance. By combining standard dropout-based augmentation with MLM-based word replacement and training a difference prediction head, DiffCSE achieves state-of-the-art results, outperforming SimCSE by 2.3 absolute points on semantic textual similarity tasks.

ABSTRACT

We propose DiffCSE, an unsupervised contrastive learning framework for learning sentence embeddings. DiffCSE learns sentence embeddings that are sensitive to the difference between the original sentence and an edited sentence, where the edited sentence is obtained by stochastically masking out the original sentence and then sampling from a masked language model. We show that DiffSCE is an instance of equivariant contrastive learning (Dangovski et al., 2021), which generalizes contrastive learning and learns representations that are insensitive to certain types of augmentations and sensitive to other "harmful" types of augmentations. Our experiments show that DiffCSE achieves state-of-the-art results among unsupervised sentence representation learning methods, outperforming unsupervised SimCSE by 2.3 absolute points on semantic textual similarity tasks.

Motivation & Objective

  • To develop a contrastive learning framework for sentence embeddings that is sensitive to meaningful linguistic changes, rather than invariant to them.
  • To address the limitation of standard contrastive learning in NLP, where input-level augmentations like word replacement alter meaning and thus should not be ignored.
  • To operationalize equivariant contrastive learning in NLP by distinguishing between insensitive (dropout) and sensitive (MLM-based) transformations.
  • To improve sentence representation quality for zero-shot transfer and semantic similarity tasks without requiring labeled data.
  • To demonstrate that modeling the difference between original and edited sentences leads to better-aligned and more informative sentence embeddings.

Proposed method

  • DiffCSE uses a dual-augmentation strategy: one branch applies dropout to the original sentence (insensitive transformation), and another applies masked language modeling (sensitive transformation) to generate an edited sentence.
  • The model learns sentence embeddings via a contrastive loss between the original and dropout-augmented sentence representations, encouraging invariance to dropout.
  • An additional cross-entropy loss is introduced to predict the difference between the original and MLM-augmented sentence, making the representation sensitive to meaningful changes.
  • The difference prediction head is trained end-to-end with the sentence encoder, and during inference, only the sentence encoder is used, discarding the discriminator head.
  • The framework is grounded in equivariant contrastive learning, generalizing standard contrastive learning by learning representations invariant to some augmentations and sensitive to others.
  • Pretrained models and code are released at https://github.com/voidism/DiffCSE.

Experimental results

Research questions

  • RQ1Can modeling the difference between original and MLM-augmented sentences improve sentence representation learning in an unsupervised setting?
  • RQ2Does making sentence embeddings sensitive to meaningful linguistic changes—such as word replacement via masked language modeling—lead to better performance on semantic similarity tasks?
  • RQ3How does DiffCSE compare to SimCSE and other contrastive learning baselines in terms of alignment, uniformity, and downstream transfer performance?
  • RQ4To what extent does the difference prediction head improve the quality of the learned sentence embedding space?
  • RQ5Can equivariant contrastive learning be effectively adapted to natural language, where input-level augmentations often alter semantic meaning?

Key findings

  • DiffCSE achieves a 2.3 absolute point improvement over unsupervised SimCSE on semantic textual similarity (STS) benchmarks, setting a new state-of-the-art for unsupervised sentence representation learning.
  • On the STS-B test set, DiffCSE achieves a recall@10 of 97.42, compared to SimCSE's 95.88, demonstrating superior retrieval performance.
  • The cosine similarity distribution of DiffCSE is more consistent with human ratings than SimCSE, with higher similarities assigned to pairs with the same human annotation score.
  • DiffCSE achieves better alignment (0.097) than SimCSE (0.177) while maintaining similar uniformity (-1.438 vs. -2.313), indicating improved representation quality through better alignment.
  • Ablation studies confirm that both the contrastive loss and the difference prediction head contribute significantly to performance, with the latter being critical for sensitivity to semantic changes.
  • Qualitative analysis shows that DiffCSE learns more discriminative and semantically meaningful sentence representations, particularly in handling paraphrases and subtle semantic variations.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.