[Paper Review] SAFER: A Structure-free Approach for Certified Robustness to Adversarial Word Substitutions
SAFER proposes a structure-free, black-box certified robustness method for NLP models against adversarial word substitutions using randomized smoothing with random synonym substitutions. It achieves state-of-the-art certified accuracy—87.35% on BERT for IMDB—without requiring model architecture access, outperforming prior IBP-based methods on both IMDB and Amazon datasets.
State-of-the-art NLP models can often be fooled by human-unaware transformations such as synonymous word substitution. For security reasons, it is of critical importance to develop models with certified robustness that can provably guarantee that the prediction is can not be altered by any possible synonymous word substitution. In this work, we propose a certified robust method based on a new randomized smoothing technique, which constructs a stochastic ensemble by applying random word substitutions on the input sentences, and leverage the statistical properties of the ensemble to provably certify the robustness. Our method is simple and structure-free in that it only requires the black-box queries of the model outputs, and hence can be applied to any pre-trained models (such as BERT) and any types of models (world-level or subword-level). Our method significantly outperforms recent state-of-the-art methods for certified robustness on both IMDB and Amazon text classification tasks. To the best of our knowledge, we are the first work to achieve certified robustness on large systems such as BERT with practically meaningful certified accuracy.
Motivation & Objective
- Address the critical need for certified robustness in NLP models against human-undetectable adversarial word substitutions.
- Overcome the limitations of existing certified defense methods that require model structure access or are restricted to continuous inputs.
- Enable certified robustness for arbitrary pre-trained models (e.g., BERT) and model types (word-level or subword-level) via a black-box, structure-free approach.
- Achieve practical certified accuracy on large-scale models like BERT, where prior certified methods were inapplicable.
Proposed method
- Construct a stochastic ensemble by applying random synonym substitutions to input sentences using a predefined synonym set.
- Leverage the statistical properties of the ensemble to derive provable certification bounds for robustness against any word substitution within a Hamming distance R.
- Apply randomized smoothing in a discrete, structured input space (sentences), extending the technique beyond continuous inputs like images.
- Use Monte Carlo sampling with 5,000 draws to estimate the robustness radius Δ_X for each input, ensuring statistical confidence in certification.
- Define a smoothed classifier f* that predicts the majority class among perturbed inputs, with certification based on the fraction of perturbations preserving the prediction.
- Prove that if the fraction of perturbations predicting class y exceeds a threshold (p_A ≥ q), the model is certified robust within radius R.
Experimental results
Research questions
- RQ1Can certified robustness be achieved for NLP models against word substitution attacks without requiring access to model architecture or gradients?
- RQ2Can randomized smoothing be effectively extended to discrete, structured inputs like sentences in NLP?
- RQ3Can this method achieve high certified accuracy on large pre-trained models such as BERT, where prior certified methods fail?
- RQ4How does the performance of this structure-free method compare to IBP-based certified defenses on standard NLP benchmarks?
- RQ5What is the practical certified accuracy achievable on real-world datasets like IMDB and Amazon using this black-box approach?
Key findings
- SAFER achieves 87.35% certified accuracy on the IMDB dataset when applied to BERT, a result not attainable with prior certified methods.
- The method significantly outperforms IBP-based approaches on both IMDB and Amazon text classification tasks, demonstrating superior robustness and accuracy.
- Certified robustness is achieved for the first time on large-scale models like BERT with practically meaningful accuracy, enabling real-world deployment.
- The method is structure-free and black-box, requiring only model query access, making it applicable to any NLP model, including word-level and subword-level models.
- On the Amazon dataset, SAFER maintains high certified accuracy despite the dataset's massive scale and high label diversity.
- The approach generalizes across model types, including text CNN, Char-CNN, and BERT, demonstrating broad applicability and robustness.
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.