Capturing the Relationship Between Sentence Triplets for LLM and Human-Generated Texts to Enhance Sentence Embeddings (2024)

Abstract: Deriving meaningful sentence embeddings is crucial in capturing the semantic relationship between texts. Recent advances in building sentence embedding models have centered on replacing traditional human-generated text datasets with those generated by LLMs. However, the properties of these widely used LLM-generated texts remain largely unexplored. Here, we evaluate the quality of the LLM-generated texts from four perspectives (Positive Text Repetition, Length Difference Penalty, Positive Score Compactness, and Negative Text Implausibility) and find that there exists an inherent difference between human and LLM-generated datasets. To further enhance sentence embeddings using both human and LLM-generated datasets, we propose a novel loss function that incorporates Positive-Negative sample Augmentation (PNA) within the contrastive learning objective. Our results demonstrate that PNA effectively mitigates the sentence anisotropy problem in Wikipedia corpus (-7% compared to CLHAIF) and simultaneously improves the Spearman’s correlation in standard Semantic Textual Similarity (STS) tasks (+1.47% compared to CLHAIF).

## introduction sentence embeddings with contextual representations are more informative than static text embeddings for various natural language processing (nlp) tasks @xcite . semantic similarity scoring has been an important fundamental testbed for understanding the quality of sentence embeddings @xcite . unsupervised sentence embedding model employs data augmentation strategies such as dropout to create positive pairs @xcite @xcite , but there is a limitation of creating diverse samples of semantically similar positives by modifying the embedding parameters in the latent space. thus, supervised models which are fine-tuned with human-generated data @xcite @xcite often surpass these unsupervised models. however, human subject experiments often take tremendous time and effort to manually create large-scale, high-quality data samples with few annotation artifacts @xcite . the emergence of billion-scale generative large language models (llms), such as gpt-3 @xcite and instructgpt @xcite , has allowed many researchers to explore their capability in diverse settings, such as generating datasets in natural language inference (nli) @xcite , reasoning @xcite , and text annotation @xcite . specifically in the context of semantic textual similarity (sts) @xcite @xcite @xcite @xcite , llms have been useful for generating positive and negative samples (defined in section 2.1) @xcite @xcite and obtaining llm feedback score to assess the similarity of reference and positives @xcite . despite the increasing utility of llms for data generation and model evaluation, numerous studies still use comparably smaller sized sentence embedding backbone models @xcite @xcite @xcite , such as bert-base (110m) @xcite , roberta-large (355m) @xcite , and t5-large (800m) @xcite to build neural evaluators for sts tasks. it is necessary to fine-tune these million-scale pretrained language models with human or llmgenerated positives and negatives to achieve a high correlation with human evaluations @xcite and to better understand how sentence embeddings are represented in a latent space @xcite , which cannot be done merely by prompting llms. based on the observation that llm-supervised models consistently underperform when compared to models trained on human-annotated data, they are often compared with less challenging, unsupervised models @xcite (figure 1 ), we seek to study the following research questions: 1. what kinds of properties exist in llm-generated positives/negatives that differ from human-generated texts for building sentence embedding models? 2. are the standard contrastive training objective losses (e.g., @xcite and clhaif @xcite ) sufficient to learn the relationship between sentence triplets? our main contributions are as follows: ## methods here we first present how we conduct a heuristic evaluation on human/llm-generated datasets (3.1). next, we propose a novel loss objective called positive-negative augmentation (pna) that can be applied to sentence embedding models that are to be fine-tuned with any type of sentence triplet datasets either generated with human, llm, or both (3.2). the explanation of proposing pna loss after the heuristic evaluation is stated in section 6. ## discussion what is the motivation for proposing pna loss after the heuristic evaluation? in this paper, we first explore why the llm-generated dataset, while widely used and cost-efficient, is less beneficial than the human-generated dataset for finetuning a sentence embedding model and evaluate the existing human-generated dataset (nli) whereas other models are only pre-trained not fine-tuned. and llm-generated datasets (dino and claif) and a newly introduced llm-generated dataset (dino-gpt-3.5) in four perspectives. the reason for this heuristic evaluation is that we originally wanted to show that it might be possible to outperform human-supervised simcse, which is the standard sota sentence embedding model without any prompt variations with the model fine-tuned with dino-gpt-3.5. however, similarly to @xcite , we find it difficult to generate high-quality texts to be on par with human-generated texts. hence, we instead delve into why a difference exists between llm and human-generated datasets. after analyzing the difference with our heuristic evaluation approach, we acknowledge the limitation of only using llm to build higher-quality datasets like nli. thus, rather than focusing on creating an llm-generated dataset more like a human-generated dataset, which is possibly due to the limitation of the current llm, we attempt to devise a way to improve any model, including the current sota sentence embedding model, which is human+llm-supervised clhaif that uses sentence triplets as the fine-tuning dataset. why is it important to consider the relationship between sentence triplets? although the clhaif model is fine-tuned to learn different levels of similarity between references and positives @xcite , we unexpectedly observe most of the cosine similarity scores are skewed to the overconfident or maximum value, 1.0 in figure 5 . we hypothesize that as the training proceeds, the model mostly focuses on learning the relations across the data instances by pushing different instances apart from each other. hence, the model seemingly forgets to learn the relations within each data instance, keeping reference and positive close together (figure 5a ) and the same for reference/positive and negative (figure 5b-c ). however, humans can differentiate the subtle different levels of closeness for each sentence triplet @xcite . for example, the sentence pairs "i love to explore nlp." and "i like to explore nlp." should show a slightly higher similarity score than the sentence pairs "i love to explore nlp in ai." and "i love to explore arts." if we are to regard "love" and "like" more similar than "nlp and "arts." for the reference/positivenegative pair, it is intuitively better to separate them, which adding the pna loss helps to achieve. why do llm-supervised models show lower performances than human-supervised models? though llms show remarkable abilities in generating and evaluating text data @xcite , we find that it is still very challenging to produce human-like positives and hard-negatives for each nli dataset instance. thus, the performances of llm-supervised sentence embedding models (e.g., claif) remain much lower than human-supervised models (e.g., simcse). here, we also attempt to make a newer version of dino @xcite than human-supervised models ( is it fair to compare llm-supervised models with unsupervised models? throughout this paper, we make a comparison of llm-supervised models with human-supervised models, whereas these models are generally compared with less challenging, unsupervised models @xcite @xcite . however, this comparison may not be entirely fair since models fine-tuned on llm-generated data can be viewed as weakly supervised rather than truly unsupervised since llms are pre-trained with a largescale dataset generated by humans or human feedback @xcite . hence, llm-generated texts could be viewed as the product of weaklysupervised human-generated texts, justifying our stricter comparison criterion. nevertheless, we leave for future work to discuss this open research question further. ## conclusion we study why llm-generated texts hinder a sentence embedding model from producing less semantically meaningful sentence representations 0 100 500 1k 5k 10k 50k compared to human-generated texts by analyzing their embedded properties. then, for the models fine-tuned with human-generated sentence triplets and feedback similarity scores for positive pairs, we enhance the sentence representations with our pna loss. not only does pna help the model to achieve high spearman's correlation and low sentence anisotropy, but it also captures a wide range of similarity scores between references and positives and returns lower cosine similarity between references/positives and negatives. we hope our work will catalyze efforts in exploring different aspects of llm-generated texts for various downstream tasks.