Abstract
RobustEmbed is a self-supervised framework designed to produce sentence embeddings that are both semantically accurate and resilient to adversarial attacks. By incorporating "high-risk" adversarial perturbations into the embedding space during contrastive pre-training, the model achieves significant improvements in robustness—reducing attack success rates by nearly half—while simultaneously enhancing performance on standard semantic similarity benchmarks.
Introduction
Pre-trained language models (PLMs) like BERT and RoBERTa have revolutionized NLP by creating dense vector representations of sentences. However, these models are notoriously brittle; small, human-imperceptible changes—such as swapping a word for a synonym—can radically alter their output. While existing methods like SimCSE focus on generalization to clean data, they often neglect robustness under attack. RobustEmbed bridges this gap by injecting "high-risk" adversarial perturbations directly into the embedding space during contrastive pre-training, providing a "best of both worlds" solution for semantic richness and adversarial resilience.
Methodology: High-Risk Perturbations
The core innovation of RobustEmbed lies in its use of noise during contrastive learning. Unlike standard approaches that use simple dropout masks, RobustEmbed generates adversarial noise in the continuous embedding space rather than the discrete text space.
The framework employs a three-step process:
- Iterative Perturbation Generation: Perturbations are optimized in the embedding space using a hybrid attack strategy.
- Hybrid Attack: It combines Projected Gradient Descent (PGD) for precision and the Fast Gradient Sign Method (FGSM) for speed, identifying the "worst-case" noise to challenge the model.
- Novel Contrastive Objective: The training loss forces the model to maintain proximity between the original embedding, the dropout-augmented embedding, and the adversarially perturbed embedding. This promotes "invariance," ensuring that malicious shifts in vector space do not change the underlying semantic meaning.
Experimental Setup and Results
RobustEmbed was pre-trained on 1 million sentences from English Wikipedia and evaluated across several benchmarks, including Semantic Textual Similarity (STS) tasks and various adversarial attack techniques (TextFooler, TextBugger, PWWS, BAE, and BERTAttack).
Robustness Gains
The model demonstrates massive improvements in robustness. For instance, on the BERTAttack benchmark, the attack success rate dropped from 75.51% (SimCSE) to 39.62% (RobustEmbed).
Generalization and Synergy
Contrary to the common belief that there is a trade-off between robustness and accuracy, the authors find that forcing the model to be robust actually helps it generalize better. RobustEmbed achieved an average Spearman’s correlation of 77.51% across STS tasks, outperforming the previous best self-supervised method (USCAL) by 1.20%. This suggests a synergy where robustness training helps the model better align semantically similar items in the vector space.
Discussion and Future Work
RobustEmbed's success is attributed to improved "alignment" (keeping similar items grouped) and "uniformity" (utilizing the full vector space). While highly effective for encoder models like BERT, future work will explore its applicability to generative decoder models (e.g., GPT) and the integration of "hard negatives" to further refine embedding boundaries. Although iterative perturbation adds some computational overhead, the authors found that just five iterations are sufficient for peak performance, maintaining a balance between efficiency and robustness.
Summary updated