Refining Sentence Embedding Model through Ranking Sentences Generation with Large Language Models (2025)

Abstract: Sentence embedding is essential for many NLP tasks, with contrastive learning methods achieving strong performance using annotated datasets like NLI. Yet, the reliance on manual labels limits scalability. Recent studies leverage large language models (LLMs) to generate sentence pairs, reducing annotation dependency. However, they overlook ranking information crucial for fine-grained semantic distinctions. To tackle this challenge, we propose a method for controlling the generation direction of LLMs in the latent space. Unlike unconstrained generation, the controlled approach ensures meaningful semantic divergence. Then, we refine exist sentence embedding model by integrating ranking information and semantic information. Experiments on multiple benchmarks demonstrate that our method achieves new SOTA performance with a modest cost in ranking sentence synthesis.

## introduction sentence embedding is a fundamental task in natural language processing. it provides effective semantic representations for various downstream applications, such as semantic search @xcite ), text classification @xcite , question-answering systems @xcite , and other specialized domain systems @xcite . in recent years, significant progress has been made in the study of sentence embeddings, with methods based on contrastive learning standing out in particular. these approaches learn embeddings of sentences by bringing semantically similar sentences closer together and pushing dissimilar ones further apart. current mainstream research relies on highquality annotated data, especially natural language inference (nli) datasets @xcite . for instance, supervised contrastive learning methods based on nli have demonstrated a remarkable ability to surpass the unsupervised approaches @xcite . however, such annotated datasets are often unavailable in most real-world scenarios, and the manual construction of these datasets incurs extremely high costs. to reduce reliance on manually annotated data, recent studies have begun to explore leveraging the powerful generative capabilities of large language models (llms) to construct high-quality sentence pairs automatically. for instance, syncse @xcite employs llms to generate semantically similar sentence pairs, enhancing the effectiveness of contrastive learning. multicsr @xcite further evaluates the quality of llmgenerated outputs, filtering out erroneous results. gcse @xcite utilizes knowledge graphs to extract entities and quantities, enabling llms to generate more diverse and knowledge-enriched samples. these approaches significantly diminish the dependence on manual annotation. however, current research focuses on generating sentence pairs, overlooking the critical role of ranking sentences. while sentence pairs can capture the similarity between sentences, they fail to effectively distinguish between "highly similar" sentences and "slightly different". @xcite point out that the limitation of sentence pairs lies in their inability to represent finer-grained semantic distinctions. existing unsupervised methods, such as rankcse @xcite and rankencoder @xcite , attempt to construct ranking information using in-batch data to address this shortcoming. however, the ranking information in these methods is derived in an unsupervised manner, lacking explicit ranking supervision signals. as shown in figure 1 (a), the heatmap illustrates the similarity calculations between sentences acquired from the in-batch data. we observe that the relationships among sentences within the in-batch data are treated as equivalent, failing to capture the hierarchical semantic distinctions. thus, we propose a new research question: can llms be used to generate ranking sentences to enhance the performance of sentence embedding models? a straightforward method for generating ranking sentences is to directly prompt llms to produce them. however, such an unconstrained generation process will result in ambiguous sentence semantic relationships. as illustrated in figure 1 (b ) and (c), neither prompting the llm to generate complete ranking sentences at once nor guiding it to generate them step by step can ensure a gradual increase in semantic distance foot_0 . thus, it fails to provide high-quality ranking information for sentence embedding models. in this paper, we propose a latent space directional control method for ranking sentence generation and a post-training method for synthesized ranking sentences. specifically, we design a directionally controlled generation method that llms to produce ranking sentences. by utilizing the generation probabilities of the preceding two sentences, we ensure that the resulting latent space remains in a consistent direction. as shown in figure 1 (d ), our generated ranking sentences exhibit a gradual increase in semantic divergence within the semantic space. then, we integrate the ranking information and semantic information from the synthesized ranking sentences to refine existing sentence embedding models through post-training. the contributions of this paper can be summarized as follows: ## background in unsupervised sentence embedding models, a series of works represented by simcse @xcite employ contrastive learning to acquire effective embeddings by bringing semantically similar neighbours closer while pushing dissimilar ones apart. assume there exists an unlabeled dataset x . for each sentence @xmath0, simcse processes the same input through an encoder, such as bert (kenton and toutanova, 2019) or roberta @xcite , twice. it yields two embeddings h i and h + i for the i-th sentence with different dropout masks. the objective for the pair (h i , h + i ) within a minibatch of b is: ## related work unsupervised sentence embedding has been widely studied. early methods extended the word2vec framework @xcite to sentence-level embeddings, such as @xcite , fastsent @xcite , and quick-thought @xcite . with the rise of plms, models like bert (kenton and toutanova, 2019) and roberta @xcite have been explored for sentence representation. however, issues like anisotropy @xcite have led to post-processing techniques such as bertflow @xcite and bert-whitening @xcite to improve embedding quality. with the rise of contrastive learning, the focus shifted toward deriving sentence embeddings by maximizing agreement between different views of the same sentence. techniques like simcse @xcite utilized dropout-based augmentation to create positive pairs, inspiring follow-up methods @xcite @xcite @xcite . these methods proved highly effective. however, unsupervised approaches often lag behind their supervised counterparts, which leverage labeled datasets such as natural language inference (nli) corpora @xcite . yet, such datasets are not easily accessible due to the high annotation cost. to address these limitations, researchers began exploring sentence generation for unlabeled data @xcite using models like t5 @xcite . with the advent of large language models (llms), both data annotation and generation have seen significant improve-ments @xcite @xcite . @xcite leverages llms to generate semantically similar sentence pairs, enhancing the effectiveness of contrastive learning. multicsr @xcite and gcse @xcite further refine the utilization of llms for data generation. this line of research builds upon the training paradigm of supervised simcse @xcite , where a triplet is generated for contrastive learning. in contrast to these works, our approach shifts the generation objective towards ranking sentence generation, introducing a novel refinement strategy for contrastive learning models. ## conclusion in this paper, we investigate a method for synthesizing ranking sentences by leveraging llms to generate sentences progressively increasing semantic divergence, guided by a controlled direction in the latent space. furthermore, we explore a post-training approach that integrates ranking information and semantic information. experimental results demonstrate that our method achieves new sota performance with minimal cost in ranking sentence synthesis.