InfoCSE: Information-aggregated Contrastive Learning of Sentence Embeddings

Xing Wu, Chaochen Gao, Zijia Lin, Jizhong Han, Zhongyuan Wang, Songlin Hu · DOI

Introduction

Sentence embeddings are fundamental to modern Natural Language Processing, providing vector representations that capture the semantic essence of entire sentences. Currently, SimCSE stands as the state-of-the-art for unsupervised learning, utilizing a contrastive objective where a model learns to pull different dropout-augmented versions of the same sentence together while pushing others away.

However, SimCSE's objective is often criticized as being "shallow." It encourages the model to learn just enough information to distinguish one sentence from another in a batch, rather than capturing a dense, comprehensive semantic representation. Previous attempts to integrate a Masked Language Model (MLM) task to force deeper information capture often resulted in performance degradation due to gradient interference between the contrastive and reconstruction objectives.

Methodology: The InfoCSE Framework

InfoCSE addresses the "shallow embedding" problem by introducing an information-aggregation mechanism that avoids gradient conflict. The core innovation is an Auxiliary Network designed to reconstruct masked tokens using a combination of the final [CLS] token and intermediate hidden states.

Comparison between SimCSE and InfoCSE architectures.

The architecture employs a "sidecar" approach:

  1. Information Bottleneck: The model is forced to "pack" missing semantic information into the 12th-layer [CLS] token.
  2. Auxiliary Transformer: An 8-layer auxiliary network takes the [CLS] embedding and the 6th-layer hidden states as input to perform the MLM task.
  3. Gradient Detaching: To prevent the MLM task from "over-updating" the encoder and introducing noise into the semantic space, gradients from the auxiliary task are detached before reaching the encoder's lower layers. They only flow back through the [CLS] token.
  4. Two-Stage Training: The process begins with pre-training the auxiliary network on the MLM task, followed by joint training with the contrastive objective.

By providing the auxiliary network with "insufficient" information from the middle layers, the [CLS] token becomes a high-pressure bottleneck, effectively forced to store the dense semantic details required for reconstruction.

Experimental Setup

The model was trained on 1 million sentences from English Wikipedia and BookCorpus. Evaluation focused on two primary domains:

  • Semantic Textual Similarity (STS): Seven standard datasets (STS12–16, STS-B, and SICK-R) measuring Spearman correlation.
  • Information Retrieval: The BEIR benchmark, encompassing 14 zero-shot retrieval tasks to test the robustness and generalization of the embeddings.

Results and Analysis

InfoCSE demonstrates significant improvements over existing unsupervised methods. On the STS benchmarks, InfoCSE-BERT<sub>base</sub> outperformed SimCSE by an average of 2.60%, achieving a state-of-the-art Spearman correlation of 85.49 on the STS-B development set.

Performance comparison on Semantic Textual Similarity (STS) tasks across various models.

Beyond similarity tasks, InfoCSE showed remarkable performance on the BEIR retrieval benchmark. Unlike many SimCSE variants that focus on refining negative samples, InfoCSE's focus on the quality of the positive representation itself leads to better generalization in large-scale retrieval scenarios. Ablation studies confirmed that both the "gradient detach" mechanism and the "pre-training" stage are critical, as removing either led to a measurable decline in performance.

Conclusion

InfoCSE successfully resolves the MLM integration paradox by utilizing an auxiliary network with detached gradients. This approach forces the [CLS] token to aggregate dense semantic information, resulting in superior sentence embeddings for both similarity and retrieval tasks. While currently focused on unsupervised settings, future research could explore the impact of this information-aggregation strategy on supervised fine-tuning and its application in Retrieval-Augmented Generation (RAG) systems.

Summary updated

BibTeX
@inproceedings{wu2022infocse,
  author = {Xing Wu and Chaochen Gao and Zijia Lin and Jizhong Han and Zhongyuan Wang and Songlin Hu},
  title = {{InfoCSE: Information-aggregated Contrastive Learning of Sentence Embeddings}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2022},
  doi = {10.18653/v1/2022.findings-emnlp.223},
}
Figure