Abstract
Recently, large language models (LLMs) have emerged as a groundbreaking technology and their unparalleled text generation capabilities have sparked interest in their application to the fundamental sentence representation learning task. Existing methods have explored utilizing LLMs as data annotators to generate synthesized data for training contrastive learning based sentence embedding models such as SimCSE. However, since contrastive learning models are sensitive to the quality of sentence pairs, the effectiveness of these methods is largely influenced by the content generated from LLMs, highlighting the need for more refined generation in the context of sentence representation learning. Building upon this premise, we propose MultiCSR, a multi-level contrastive sentence representation learning framework that decomposes the process of prompting LLMs to generate a corpus for training base sentence embedding models into three stages (i.e., sentence generation, sentence pair construction, in-batch training) and refines the generated content at these three distinct stages, ensuring only high-quality sentence pairs are utilized to train a base contrastive learning model. Our extensive experiments reveal that MultiCSR enables a less advanced LLM to surpass the performance of ChatGPT, while applying it to ChatGPT achieves better state-of-the-art results. Comprehensive analyses further underscore the potential of our framework in various application scenarios and achieving better sentence representation learning with LLMs.
Introduction
Sentence representation learning is a fundamental task in Natural Language Processing (NLP), focused on mapping sentences into a high-dimensional vector space where semantic similarity is reflected by geometric proximity. The current state-of-the-art approach involves contrastive learning, which requires high-quality pairs of positive (semantically similar) and negative (semantically dissimilar) sentences. While Large Language Models (LLMs) offer a promising way to generate these pairs at scale, they are often noisy and prone to instruction-following failures. For instance, an LLM might generate a paraphrase when asked for a contradiction, or refuse to process certain inputs due to safety filters. Because contrastive learning is highly sensitive to data quality, even minor noise can significantly degrade the resulting embeddings.
The MultiCSR Framework
To address these challenges, we propose MultiCSR, a three-stage framework that integrates contrastive techniques throughout the data generation and training pipeline to ensure high-quality sentence representation learning.
Stage 1: Contrastive Generation
To mitigate common LLM errors during data generation, we employ a technique inspired by "instructive decoding." When prompting a model to generate an entailment, we simultaneously calculate the logits for a "noisy" or opposite instruction (e.g., a contradiction). By subtracting these undesired logits from the target logits during the decoding process, we steer the model away from its typical failure modes, resulting in more accurate and diverse sentence pairs.
Stage 2: Contrastive Sentence Pair Construction (Self-Curation)
After the initial generation, the LLM serves as its own quality controller. We prompt the model to score the semantic similarity of the generated triplets (Premise, Entailment, Contradiction). We apply strict geometric thresholds: only triplets where the entailment is highly similar to the premise and the contradiction is sufficiently distinct are retained. This self-curation process ensures that the training corpus consists only of high-fidelity samples.
Stage 3: Contrastive In-Batch Training
During the training of the base embedding model (such as RoBERTa), we address the "false negative" problem inherent in large-batch contrastive learning. In any random batch, some samples labeled as negatives may actually be semantically similar to the anchor. MultiCSR utilizes a pre-trained model to identify and mask these false negatives, preventing the model from learning to push similar concepts apart in the vector space.
Experimental Results
We evaluated MultiCSR across standard benchmarks, including the Semantic Textual Similarity (STS) tasks (2012–2016) and the STS-Benchmark. Our results demonstrate that the framework significantly boosts the performance of both open-source and proprietary LLMs.
Key Findings
- Surpassing ChatGPT: One of the most striking results is that MultiCSR allows a smaller, open-source model like Flan-T5-XL (3B parameters) to achieve an average Spearman’s correlation of 81.01 on STS tasks. This significantly outperforms the direct output of ChatGPT (71.58) and ChatGPT with In-Context Learning (76.19).
- New State-of-the-Art: When MultiCSR is applied to data generated by ChatGPT, it achieves a score of 81.62, setting a new state-of-the-art for LLM-based sentence representation learning.
- Low-Resource Versatility: In experiments on Tagalog using the TED2020 dataset, MultiCSR improved retrieval accuracy from 72.6% to 84.2%, highlighting its effectiveness for languages with limited human-annotated resources.
Conclusion
MultiCSR demonstrates that the quality of generated data is more critical than quantity for sentence representation learning. By treating LLMs as both creators and judges, and by refining the training process to account for false negatives, we can leverage relatively small models to achieve results that exceed much larger, black-box systems. Future work will explore extending this framework to longer text formats and more diverse domains.
Summary updated