ImSimCSE: Improving Contrastive Learning for Sentence Embeddings from Two Perspectives

Jiahao Xu, Wei Shao, Lihui Chen, Lemao Liu · DOI

Contrastive learning (CL) has become the cornerstone of modern sentence embedding techniques. By training models to pull semantically similar sentences together and push dissimilar ones apart, frameworks like SimCSE have set high benchmarks for Semantic Textual Similarity (STS). However, current implementations suffer from two subtle but significant flaws: the introduction of harmful noise in negative pairs and a mathematical "rank bottleneck" that prevents effective feature decorrelation.

This paper introduces SimCSE++, a refined approach that addresses these issues through two plug-and-play components: Off-dropout Sampling and Dimension-wise Contrastive Learning (DCL). These improvements yield a 1.8-point gain over the SimCSE baseline with minimal computational overhead.

Addressing the Noise Dilemma: Off-Dropout Sampling

In standard contrastive learning, dropout is used as a data augmentation technique to create "positive" pairs from the same sentence. While this noise is beneficial for creating distinct views of a positive pair, the authors discovered that applying the same dropout noise to negative samples is counterproductive.

Through empirical analysis, the researchers found that reducing noise in positive pairs actually degrades performance because the task becomes too trivial. Conversely, removing noise from negative pairs—a technique termed "off-dropout sampling"—significantly clarifies the training signal. By turning off dropout when calculating representations for negative samples, the model gains a stable, zero-variance anchor, leading to more robust embeddings.

Ablation study on the effect of noise in positive and negative pairs.

Solving the Rank Bottleneck with DCL

Ideally, every dimension in a sentence embedding should represent unique semantic information. Previous attempts to achieve this used methods like BarlowTwins to decorrelate dimensions. However, these methods often fail in NLP contexts due to the "rank bottleneck." When the batch size ($N$) is smaller than the embedding dimension ($D$), the correlation matrix cannot be full rank, making it impossible to properly spread information across all features.

SimCSE++ bypasses this by introducing Dimension-wise Contrastive Learning (DCL). Instead of forcing an absolute correlation matrix, DCL applies a contrastive objective across the dimensions themselves. This encourages each dimension to be more similar to itself across different views of the same sentence than it is to other dimensions. This relative optimization effectively decorrelates features regardless of batch size.

Key Results and Performance

SimCSE++ demonstrates superior performance across standard benchmarks. Using a BERT-base architecture, it achieved an average Spearman correlation of 78.05% on STS tasks, representing a substantial 1.8-point improvement over the original SimCSE.

Comparison of SimCSE++ with state-of-the-art baselines on STS tasks.

Beyond raw scores, the method proves to be highly versatile and efficient:

  • Universality: When integrated into the more complex DiffCSE framework, SimCSE++ still provided a 1.4-point gain.
  • Efficiency: The additions are computationally light, adding only approximately 9 minutes to the total training time (e.g., 1h 59m vs 1h 50m for BERT-base).
  • Qualitative Quality: Retrieval tests on the Flickr30k dataset showed that SimCSE++ is better at capturing fine-grained semantic details, such as specific actions and pronouns, where previous models often conflated distinct concepts.

Conclusion

SimCSE++ provides a simple yet powerful upgrade to contrastive sentence embedding frameworks. By identifying that noise is a "double-edged sword" and solving the rank bottleneck through dimension-wise contrast, the authors provide a more effective way to utilize the available feature space in transformer-based models. Future work may involve exploring more advanced sampling strategies for positive pairs to further push the boundaries of semantic representation.

Summary updated

BibTeX
@inproceedings{xu2023imsimcse,
  author = {Jiahao Xu and Wei Shao and Lihui Chen and Lemao Liu},
  title = {{ImSimCSE: Improving Contrastive Learning for Sentence Embeddings from Two Perspectives}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.emnlp-main.737},
}
Figure