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

Liyang He, Chenglong Liu, Rui Li, Zhenya Huang, Shulan Ruan, Jun Zhou, Enhong Chen

Abstract

Traditional sentence embedding models often struggle to capture fine-grained semantic hierarchies because they are trained on simple binary pairs of similar or dissimilar text. This paper presents a novel approach to generate "ranking sentences"—sequences of text that exhibit a progressive, monotonic divergence in meaning. By implementing directionally controlled generation in the latent space of Large Language Models (LLMs), the authors create high-quality synthetic ranking data. Post-training existing embedding models on this data yields state-of-the-art performance across semantic textual similarity (STS) and reranking benchmarks with remarkable data efficiency.

Introduction

In natural language processing, sentence embeddings are typically optimized via contrastive learning, which pulls semantically similar sentences together while pushing dissimilar ones apart. While effective, this paradigm often relies on massive human-annotated datasets like Natural Language Inference (NLI) corpora.

Recent efforts have leveraged LLMs to automate the generation of these pairs. However, generating simple pairs overlooks the nuanced gradient of language; a pair indicates similarity but fails to distinguish between "highly similar," "somewhat similar," and "slightly different." Standard LLM prompting struggles to produce such ranked lists, as semantic distances often fluctuate unpredictably. This research addresses this gap by forcing LLMs to generate strictly ordered ranking sentences to provide a richer training signal for embedding models.

Methodology

The proposed framework consists of two primary stages: directionally controlled data generation and model post-training.

Directionally Controlled Generation

To ensure the LLM maintains a consistent semantic trajectory, the authors modify the decoding process. Rather than relying solely on the original prompt, the generation of each subsequent sentence is conditioned on the directional tendency established by the previous two sentences. This geometric approach—treating sentences as points in a latent space where two points define a line—forces the LLM to follow a consistent path, ensuring each new sentence is progressively more distant from the original premise.

Figure 4: Directionally controlled generation maintains a consistent semantic trajectory in the latent space by conditioning on previous directional tendencies.

Model Post-Training

Using premises from the NLI dataset, the authors generated over 16,000 ranking lists using LLaMA3-8B-Instruct. Because the semantic "gaps" between sentences in these lists are not perfectly uniform, the authors do not rely solely on ordinal rank. Instead, they fuse explicit ranking order with continuous semantic similarity scores derived from a base model (DiffCSE). The embedding models are then refined using a ListMLE loss function, which is optimized for learning-to-rank tasks.

Experimental Results and Insights

The method was evaluated across seven STS benchmarks and four reranking tasks. The results demonstrate that the synthetic ranking data significantly enhances the performance of various base models, including SimCSE, SynCSE, and MultiCSR.

Figure 5: Analysis of the impact of the hyperparameter ω and data percentage on STS performance, demonstrating high sample efficiency.

Key Findings

  • State-of-the-Art Performance: Applying this method to unsupervised SimCSE improved Spearman’s correlation by 7.11% (base) and 5.09% (large). It also boosted Mean Average Precision (MAP) in reranking tasks by an average of 1.35% for SynCSE.
  • High Data Efficiency: As shown in the experimental analysis, the post-training process is highly sample-efficient. Utilizing only 5% to 10% of the synthesized ranking dataset was sufficient to surpass the performance of the original base models significantly.
  • Versatility: The approach acts as a "plug-and-play" refinement step, successfully improving a wide variety of existing contrastive sentence embedding models.

Conclusion and Future Work

This research demonstrates that providing embedding models with structured ranking information—rather than simple pairs—leads to a more sophisticated understanding of semantic nuances. While the current method relies on a hyperparameter ((\omega)) to balance rank and similarity scores, future work may explore adaptive tuning methods. Additionally, further refining the synthetic data through advanced filtering techniques could potentially unlock even greater performance gains in sentence representation learning.

Summary updated

BibTeX
@inproceedings{he2025refining,
  author = {Liyang He and Chenglong Liu and Rui Li and Zhenya Huang and Shulan Ruan and Jun Zhou and Enhong Chen},
  title = {{Refining Sentence Embedding Model through Ranking Sentences Generation with Large Language Models}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure