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—the process of mapping sentences into dense vector spaces—is a cornerstone of modern Natural Language Processing (NLP), powering applications from semantic search to recommendation systems. The current state-of-the-art approach involves contrastive learning, which trains models to distinguish between semantically similar "positive" pairs and dissimilar "negative" pairs.
While supervised datasets like Natural Language Inference (NLI) provide high-quality training pairs, they are labor-intensive to create. This has led researchers to use Large Language Models (LLMs) as synthetic data generators. However, LLMs often introduce noise; they may fail to follow complex instructions or produce "hallucinated" relationships (e.g., generating a paraphrase when a contradiction is requested). In contrastive learning, even a small percentage of mislabeled pairs can significantly degrade model performance. MultiCSR addresses this by introducing a three-stage refinement process to ensure data quality.
The MultiCSR Framework
MultiCSR (Multi-level Contrastive Sentence Representation learning) refines the synthetic data generation and training process at three distinct levels:
- Stage 1: Contrastive Generation: To mitigate instruction-following errors, MultiCSR uses logit arithmetic. When prompting for an entailment, the framework also runs a prompt for a contradiction. By subtracting the "contradiction" logits from the "entailment" logits, the model mathematically de-biases the generation, steering it away from common error patterns.
- Stage 2: Self-Curation: The LLM acts as its own quality controller. It scores the semantic similarity of the generated pairs, and the framework applies strict thresholds (denoted as $\alpha, \beta, \gamma$) to filter out low-quality triplets. This ensures that only the most reliable premises, entailments, and contradictions proceed to the training phase.
- Stage 3: Contrastive In-Batch Training: During the fine-tuning of the base embedding model (e.g., RoBERTa), the framework addresses the "false negative" problem. In any random training batch, two different samples might actually be semantically similar. MultiCSR uses a pre-trained model to create a similarity mask, ensuring the training objective doesn't accidentally penalize the model for recognizing these hidden similarities.
Experimental Results
The framework was evaluated across several standard Semantic Textual Similarity (STS) benchmarks (STS12-16, STS-B, and SICK-R). The results demonstrate that MultiCSR consistently outperforms existing state-of-the-art methods.
Performance Gains
MultiCSR applied to ChatGPT achieved a new state-of-the-art average score of 81.62 on RoBERTa-base STS tasks. Notably, the framework allows smaller, open-source models to "punch up." When using the 3-billion parameter Flan-T5-XL, MultiCSR produced training data that led to an average score of 81.01, significantly outperforming standard data generation using the much larger ChatGPT (76.19).
Efficiency and Robustness
Beyond raw accuracy, MultiCSR improves training efficiency. By filtering the initial corpus (e.g., 1M Wikipedia sentences) down to a smaller set of high-quality triplets (0.19M), the final training stage becomes nearly three times faster without sacrificing performance. The framework also showed remarkable success in low-resource settings; in Tagalog experiments, it improved embedding accuracy from 72.6% to 84.2%.
Conclusion
MultiCSR demonstrates that the quality of synthetic training data is more critical than the sheer volume or the size of the generating LLM. By refining LLM outputs through contrastive generation, self-curation, and masked in-batch training, MultiCSR enables even moderately sized open-source models to generate superior sentence representations. This framework provides a robust path forward for developing high-performance embedding models with reduced reliance on massive, closed-source APIs.
Summary updated