Sentence representation learning is a foundational task in natural language processing (NLP), where unsupervised methods have emerged as prominent solutions for leveraging vast unlabeled corpora. However, existing unsupervised approaches based on contrastive learning suffer from limited sample diversity and vulnerability to adversarial attacks, which restricts their performance and real-world applicability. To overcome these limitations, we propose RobustCSE, a contrastive learning framework that integrates large language models (LLMs) and adversarial learning to produce high-quality, diverse sentence embeddings while bolstering model robustness. We employ task-specific prompts to guide LLMs (vicuna-13B) in generating varied positive and negative samples and introduce adversarial perturbations to enhance generalization and defense against attacks. The training process is supervised by an optimized contrastive loss function. Experiments on seven Semantic Textual Similarity (STS) tasks and seven transfer tasks show that our method substantially outperforms existing unsupervised models, as evidenced by higher Spearman’s rank correlation coefficients. Assessments on robustness tests against five adversarial attacks further validate the model’s enhanced generalization and resilience. This work demonstrates the significant potential of combining LLMs’ generative strengths with adversarial learning to advance unsupervised sentence representation learning. Our code has been made publicly available at https://github.com/CircleFish0330/RobustCSE .

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

RobustCSE: A Sentence Representation Method for Enhancing Contrastive Learning Framework with Large Language Models and Adversarial Training

  • Chunyu Xu,
  • Hongli Ding,
  • Jing Zhu

摘要

Sentence representation learning is a foundational task in natural language processing (NLP), where unsupervised methods have emerged as prominent solutions for leveraging vast unlabeled corpora. However, existing unsupervised approaches based on contrastive learning suffer from limited sample diversity and vulnerability to adversarial attacks, which restricts their performance and real-world applicability. To overcome these limitations, we propose RobustCSE, a contrastive learning framework that integrates large language models (LLMs) and adversarial learning to produce high-quality, diverse sentence embeddings while bolstering model robustness. We employ task-specific prompts to guide LLMs (vicuna-13B) in generating varied positive and negative samples and introduce adversarial perturbations to enhance generalization and defense against attacks. The training process is supervised by an optimized contrastive loss function. Experiments on seven Semantic Textual Similarity (STS) tasks and seven transfer tasks show that our method substantially outperforms existing unsupervised models, as evidenced by higher Spearman’s rank correlation coefficients. Assessments on robustness tests against five adversarial attacks further validate the model’s enhanced generalization and resilience. This work demonstrates the significant potential of combining LLMs’ generative strengths with adversarial learning to advance unsupervised sentence representation learning. Our code has been made publicly available at https://github.com/CircleFish0330/RobustCSE .