[Paper Review] Detection of Word Adversarial Examples in Text Classification: Benchmark and Baseline via Robust Density Estimation
This paper proposes a robust density estimation (RDE) method for detecting word-level adversarial examples in text classification without requiring adversarial training data or attack-specific assumptions. By leveraging kernel PCA and Minimum Covariance Determinant for stable density estimation in BERT-based feature space, RDE achieves state-of-the-art AUC on 29 out of 30 dataset-attack-model combinations, establishing a strong, attack-agnostic baseline for adversarial detection in NLP.
Word-level adversarial attacks have shown success in NLP models, drastically decreasing the performance of transformer-based models in recent years. As a countermeasure, adversarial defense has been explored, but relatively few efforts have been made to detect adversarial examples. However, detecting adversarial examples may be crucial for automated tasks (e.g. review sentiment analysis) that wish to amass information about a certain population and additionally be a step towards a robust defense system. To this end, we release a dataset for four popular attack methods on four datasets and four models to encourage further research in this field. Along with it, we propose a competitive baseline based on density estimation that has the highest AUC on 29 out of 30 dataset-attack-model combinations. Source code is available in https://github.com/anoymous92874838/text-adv-detection.
Motivation & Objective
- To address the lack of effective, generalizable detection methods for word-level adversarial examples in NLP.
- To develop a detection framework that does not require adversarial training data or validation sets per attack type.
- To establish a benchmark for evaluating adversarial example detection across diverse datasets, models, and attack methods.
- To demonstrate that density estimation in deep feature space can effectively detect semantically intact, human-imperceptible adversarial perturbations.
- To provide a model-agnostic, attack-agnostic baseline that outperforms existing methods on multiple standard benchmarks.
Proposed method
- The method uses feature representations from pre-trained language models (e.g., BERT) as input to a parametric density estimation model.
- It applies kernel PCA to reduce dimensionality and mitigate the curse of dimensionality in high-dimensional feature spaces.
- Minimum Covariance Determinant (MCD) is used to estimate robust multivariate location and scatter, improving outlier detection in the presence of sparse data and noisy features.
- The likelihood score of each input sample is computed based on the fitted density model, with low likelihood indicating potential adversarial input.
- The approach is entirely unsupervised and does not require any adversarial examples during training or validation.
- The method is applied to sentence-level inputs, making it compatible with standard text classification pipelines.
Experimental results
Research questions
- RQ1Can a density estimation-based method detect word-level adversarial examples without requiring adversarial training data or attack-specific assumptions?
- RQ2How does robust density estimation using kernel PCA and MCD compare to existing frequency- or learning-based detection methods in terms of generalization across attacks and models?
- RQ3To what extent does the proposed method maintain detection performance when faced with stronger, adaptive, or oracle-level adversaries?
- RQ4How sensitive is the method to hyperparameters such as the support fraction in MCD and the number of principal components?
- RQ5Can the method detect adversarial examples that are semantically and grammatically intact, thus evading human inspection?
Key findings
- The proposed RDE method achieves the highest AUC score on 29 out of 30 dataset-attack-model combinations, demonstrating strong generalization across diverse settings.
- On 25 of the 30 combinations, RDE also achieves the best performance in terms of true positive rate (TPR) and F1 score, confirming its robustness and sensitivity.
- The method maintains high detection performance even when the adversary uses adaptive or oracle-level strategies, though such attacks become highly perceptible (evidenced by grammatical errors and high PPL).
- Hyperparameter analysis shows that the method is stable across a wide range of support fractions (h) and principal component counts (P), with optimal performance achieved at default settings.
- Qualitative analysis confirms that higher support fractions (h) lead to wider probability contours, and using all samples for estimation can degrade detection performance due to contamination by outliers.
- The benchmark dataset, released alongside the paper, covers four popular text classification datasets, four NLP models, and four word-level attack methods, enabling standardized evaluation in the field.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.