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 Lin
TL;DR
PuRe addresses the vulnerability of PLMs to adversarial perturbations by introducing an instance-level purification process that removes the top principal component from final-layer embeddings, pushing the representation space toward isotropy. The method, implemented as a light, plug-in module using randomised SVD for efficiency, does not rely on adversarial examples or training-time augmentation. Across eight NLP datasets, PuRe achieves improved adversarial robustness while maintaining competitive before-attack accuracy, revealing a favorable trade-off between robustness and generalisation. This approach offers a practical, model-agnostic defense mechanism with low computational overhead and broad applicability to discriminative NLP tasks, setting the stage for adaptive PCR strategies and extensions to generation tasks.
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.
