SemAttack: Natural Textual Attacks via Different Semantic Spaces

Boxin Wang, Chejian Xu, Xiangyu Liu, Yu Cheng, Bo Li


Abstract
Recent studies show that pre-trained language models (LMs) are vulnerable to textual adversarial attacks. However, existing attack methods either suffer from low attack success rates or fail to search efficiently in the exponentially large perturbation space. We propose an efficient and effective framework SemAttack to generate natural adversarial text by constructing different semantic perturbation functions. In particular, SemAttack optimizes the generated perturbations constrained on generic semantic spaces, including typo space, knowledge space (e.g., WordNet), contextualized semantic space (e.g., the embedding space of BERT clusterings), or the combination of these spaces. Thus, the generated adversarial texts are more semantically close to the original inputs. Extensive experiments reveal that state-of-the-art (SOTA) large-scale LMs (e.g., DeBERTa-v2) and defense strategies (e.g., FreeLB) are still vulnerable to SemAttack. We further demonstrate that SemAttack is general and able to generate natural adversarial texts for different languages (e.g., English and Chinese) with high attack success rates. Human evaluations also confirm that our generated adversarial texts are natural and barely affect human performance. Our code is publicly available at https://github.com/AI-secure/SemAttack.
Anthology ID:
2022.findings-naacl.14
Volume:
Findings of the Association for Computational Linguistics: NAACL 2022
Month:
July
Year:
2022
Address:
Seattle, United States
Editors:
Marine Carpuat, Marie-Catherine de Marneffe, Ivan Vladimir Meza Ruiz
Venue:
Findings
SIG:
Publisher:
Association for Computational Linguistics
Note:
Pages:
176–205
Language:
URL:
https://aclanthology.org/2022.findings-naacl.14
DOI:
10.18653/v1/2022.findings-naacl.14
Bibkey:
Cite (ACL):
Boxin Wang, Chejian Xu, Xiangyu Liu, Yu Cheng, and Bo Li. 2022. SemAttack: Natural Textual Attacks via Different Semantic Spaces. In Findings of the Association for Computational Linguistics: NAACL 2022, pages 176–205, Seattle, United States. Association for Computational Linguistics.
Cite (Informal):
SemAttack: Natural Textual Attacks via Different Semantic Spaces (Wang et al., Findings 2022)
Copy Citation:
PDF:
https://aclanthology.org/2022.findings-naacl.14.pdf
Video:
 https://aclanthology.org/2022.findings-naacl.14.mp4
Code
 ai-secure/semattack
Data
GLUESNLI