[Paper Review] Certified Robustness to Text Adversarial Attacks by Randomized [MASK]
This paper proposes RanMASK, a certified robust defense for NLP models that uses randomized [MASK] masking to achieve provable robustness against word substitution and character-level adversarial attacks without requiring knowledge of the attacker's synonym generation method. It achieves certified robustness for over 50% of AGNEWS texts against up to five word perturbations and outperforms existing certified and empirical defenses.
Recently, few certified defense methods have been developed to provably guarantee the robustness of a text classifier to adversarial synonym substitutions. However, all existing certified defense methods assume that the defenders are informed of how the adversaries generate synonyms, which is not a realistic scenario. In this paper, we propose a certifiably robust defense method by randomly masking a certain proportion of the words in an input text, in which the above unrealistic assumption is no longer necessary. The proposed method can defend against not only word substitution-based attacks, but also character-level perturbations. We can certify the classifications of over 50% texts to be robust to any perturbation of 5 words on AGNEWS, and 2 words on SST2 dataset. The experimental results show that our randomized smoothing method significantly outperforms recently proposed defense methods across multiple datasets.
Motivation & Objective
- To address the limitation of existing certified defense methods that assume defenders know the attacker's synonym generation process, which is unrealistic in practice.
- To develop a defense method that guarantees robustness against both word substitution and character-level perturbations in NLP models.
- To enable scalable, generic, and provable robustness for large models like BERT without requiring access to attacker-specific synonym sets.
- To improve certified robust accuracy while maintaining high clean accuracy through a novel sampling strategy based on language model probabilities.
Proposed method
- Introduces RanMASK, a randomized smoothing-based defense that randomly masks a subset of words in the input text to certify robustness against adversarial perturbations.
- Employs a conditional probability measure β, defined as the probability that the base classifier predicts the same class on masked inputs where unmasked positions overlap with differing word indices between original and adversarial texts.
- Uses a Monte Carlo-based algorithm to estimate β, enabling tighter certification bounds than prior methods.
- Proposes an LM-based masking strategy where the probability of masking a word is proportional to its likelihood in a pre-trained BERT language model, reducing risk of misclassification.
- Applies the randomized smoothing framework to certify that the model's prediction remains unchanged under any perturbation within a bounded word or character-level edit distance.
- Leverages the convex hull of word embeddings for word substitutions and extends robustness to character-level perturbations through the masking mechanism.
Experimental results
Research questions
- RQ1Can randomized masking provide certified robustness against adversarial attacks in NLP without requiring knowledge of the attacker’s synonym generation method?
- RQ2How can the certification bound be tightened to improve robust accuracy while maintaining clean accuracy?
- RQ3To what extent can RanMASK defend against both word substitution and character-level perturbations in real-world scenarios?
- RQ4Can the proposed method scale to large models like BERT and achieve better certified robustness than existing methods?
Key findings
- RanMASK achieves certified robustness for over 50% of texts on the AGNEWS dataset against any perturbation of up to five words, significantly outperforming prior certified defenses.
- On the SST2 dataset, the method certifies robustness for over 50% of inputs against up to two word perturbations, demonstrating strong generalization across datasets.
- The method provides certified robustness against character-level perturbations, such as replacing 'football' with 'fo0tba1l', which existing methods often fail to handle.
- The LM-based masking strategy reduces the risk probability and improves robust accuracy with minimal degradation on clean data, achieving a favorable trade-off between robustness and accuracy.
- The theoretical analysis introduces a tighter certificate bound via the β parameter, which captures the overlap of unmasked indices between original and adversarial inputs, improving certification efficiency.
- Extensive experiments show that RanMASK outperforms both empirical defenses (e.g., adversarial training, DNE) and certified methods (e.g., SAFER, IBP-based) in terms of certified robust accuracy across multiple benchmarks.
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.