Adversarial Defence without Adversarial Defence: Enhancing Language Model Robustness via Instance-level Principal Component Removal

Yang Wang, Chenghao Xiao, Yizhi Li, Stuart E. Middleton, Noura Al Moubayed, Chenghua LinarXiv 2025 · DOI

Abstract

Pre-trained language models (PLMs) are highly effective but remain vulnerable to adversarial attacks, where minor input perturbations like synonym swaps can lead to incorrect predictions. Traditional defenses, such as adversarial training, are computationally expensive and often provide limited protection. This paper introduces PURE (Purified Representation), a simple, parameter-free module that enhances robustness by removing the dominant principal component from token embeddings. By promoting isotropy in the latent space, PURE mitigates the influence of high-frequency noise exploited by adversaries. Experimental results across eight benchmarks demonstrate that PURE significantly reduces the Performance Drop Rate (PDR) while maintaining high efficiency and clean accuracy.

Introduction

Despite their success, models like BERT and RoBERTa are surprisingly fragile. Small, human-imperceptible changes to a sentence can flip model predictions entirely. The authors identify a geometric "weak spot" in these models: their embedding spaces are often anisotropic, meaning they are stretched in specific directions. These dominant directions often capture high-frequency "noise" (such as stopwords) rather than semantic meaning, providing a predictable surface for adversaries to exploit.

Methodology: Purifying the Latent Space

The core of the proposed approach is Instance-level Principal Component Removal (PCR). PURE is a "plug-and-play" module integrated directly into the model's architecture. During fine-tuning, for every instance, the module performs a Singular Value Decomposition (SVD) on the token embeddings to identify and subtract the top principal component.

To maintain computational efficiency, the authors utilize Randomized SVD (rSVD). This stochastic approach not only speeds up the process but also acts as a form of implicit regularization, making the latent space a "moving target" for attackers. Following purification, a parameter-free self-attention mechanism (PFSA) pools the token embeddings into a single sentence-level representation.

Ablation study showing the impact of each PURE component on the Average Performance Drop Rate.

As shown in Figure 1, each component of the PURE pipeline contributes to a lower Performance Drop Rate (PDR). While removing the standard pooling layer initially increases vulnerability, the addition of PFSA and PCR modules significantly drives down the PDR from the 81.7 baseline to 58.4.

Experimental Results

The approach was evaluated across eight diverse Natural Language Understanding (NLU) benchmarks, including sentiment analysis (SST2) and commonsense reasoning (CSQA).

Robustness vs. Adversarial Training

A key finding is that PURE achieves "Adversarial Defence without Adversarial Defence." Because it fixes the model's internal geometry rather than training on specific "broken" examples, it avoids the 3-4x computational overhead of traditional adversarial training.

Comparison of PURE against various attack-augmented training methods across different dataset sizes.

Figure 2 illustrates that PURE (without any data augmentation) consistently outperforms models trained on datasets augmented by popular attack algorithms like TextFooler and TextBugger. While augmented models struggle to maintain low PDR even as the dataset size increases, PURE maintains a superior, stable robustness profile.

Key Insights

  • Efficiency: PURE adds only a tiny overhead (~1.2x training time) compared to the massive costs of adversarial training.
  • Clean Accuracy: The method maintains "clean" accuracy comparable to standard models, ensuring that robustness does not come at the cost of general performance.
  • Transferability: PURE showed superior "natural robustness" when transferred across different datasets, suggesting the geometric purification captures universal linguistic properties.

Conclusion

PURE offers a novel geometric perspective on model robustness. By removing dominant, noisy principal components, it forces models to rely on more stable semantic relationships. Future work may explore the application of PURE to generative tasks and its effectiveness in larger models (>1B parameters) where feature spaces are more complex.

Summary updated

Abstract

Pre-trained language models (PLMs) have driven substantial progress in natural language processing but remain vulnerable to adversarial attacks, raising concerns about their robustness in real-world applications. Previous studies have sought to mitigate the impact of adversarial attacks by introducing adversarial perturbations into the training process, either implicitly or explicitly. While both strategies enhance robustness, they often incur high computational costs. In this work, we propose a simple yet effective add-on module that enhances the adversarial robustness of PLMs by removing instance-level principal components, without relying on conventional adversarial defences or perturbing the original training data. Our approach transforms the embedding space to approximate Gaussian properties, thereby reducing its susceptibility to adversarial perturbations while preserving semantic relationships. This transformation aligns embedding distributions in a way that minimises the impact of adversarial noise on decision boundaries, enhancing robustness without requiring adversarial examples or costly training-time augmentation. Evaluations on eight benchmark datasets show that our approach improves adversarial robustness while maintaining comparable before-attack accuracy to baselines, achieving a balanced trade-off between robustness and generalisation.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
SST-2 · SST2PuRe (top-1 instance-level PC removal)TextFooler AUA30.37+20.49 vs baselinesplit: test
Source quote
L642: PuRe (Ours) │ 90.88 │ 30.37 │ 66.59 │ 134.01 │ 47.17 │ 48.10 │ 58.52 │ 36.02 │ 60.36 │ 139.97 │ 58.35
SST-2 · SST2PuRe (top-1 instance-level PC removal)Acc90.88split: test
Source quote
L642: PuRe (Ours) │ 90.88 │ 30.37 │ 66.59 │ 134.01 │ 47.17 │ 48.10 │ 58.52 │ 36.02 │ 60.36 │ 139.97 │ 58.35
SST-2 · SST2PuRe (top-1 instance-level PC removal)TextFooler AUA37.78+27.9 vs baselinesplit: test · backbone=DeBERTa-large
Source quote
L654: PuRe (Ours) │ 94.95 │ 37.78 │ 60.21 │ 156.56 │ 67.60 │ 28.80 │ 60.92 │ 46.90 │ 50.61 │ 151.65 │ 46.54
Reported baseline / comparator measurements (3)
BenchmarkMethodMetricScoreProtocol / Evidence
SST-2 · SST2Fine-tune baselineTextFooler AUA6.32split: test
Source quote
L641: Aua\uparrow │ Asr\downarrow │ AvgQ\uparrow │ Aua\uparrow │ Asr\downarrow │ AvgQ\uparrow │ Aua\uparrow │ Asr\downarrow │ AvgQ\uparrow │ \\\multirow{2}{*}{BERT-base} │ \multirow{2}{*}{109M} │ Fine-tune │ 92.09 │ 6.32 │ 93.14 │ 87.07 │ 30.37 │ 67.02 │ 41.19 │ 13.78 │ 85.03 │ 127.57 │ 81.73
SST-2 · SST2Fine-tune baselineAcc92.09split: test
Source quote
L641: Aua\uparrow │ Asr\downarrow │ AvgQ\uparrow │ Aua\uparrow │ Asr\downarrow │ AvgQ\uparrow │ Aua\uparrow │ Asr\downarrow │ AvgQ\uparrow │ \\\multirow{2}{*}{BERT-base} │ \multirow{2}{*}{109M} │ Fine-tune │ 92.09 │ 6.32 │ 93.14 │ 87.07 │ 30.37 │ 67.02 │ 41.19 │ 13.78 │ 85.03 │ 127.57 │ 81.73
SST-2 · SST2Fine-tune baselineTextFooler AUA9.88split: test · backbone=DeBERTa-large
Source quote
L653: \multirow{2}{*}{DeBERTa-large} │ \multirow{2}{*}{435M} │ Fine-tune │ 96.54 │ 9.88 │ 89.76 │ 104.12 │ 48.22 │ 50.06 │ 48.57 │ 22.19 │ 77.02 │ 139.09 │ 72.28
BibTeX
@misc{wang2025adversarial,
  author = {Yang Wang and Chenghao Xiao and Yizhi Li and Stuart E. Middleton and Noura Al Moubayed and Chenghua Lin},
  title = {{Adversarial Defence without Adversarial Defence: Enhancing Language Model Robustness via Instance-level Principal Component Removal}},
  year = {2025},
  eprint = {2507.21750},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2507.21750},
}
Figure