TextDefense: Adversarial Text Detection Based on Word Importance Score Dispersion
Natural language processing (NLP) models are widely used in various scenarios, yet they are vulnerable to adversarial attacks. Existing works aim to mitigate this vulnerability, but each work targets a specific attack category or has computational overhead limitations, making them vulnerable to adaptive attacks. In this paper, we exhaustively investigate the adversarial attack algorithms in NLP and discover that existing attack algorithms mainly disrupt the importance distribution of words in a text. A well-trained model can distinguish subtle importance distribution differences between clean and adversarial texts. Based on this intuition, we propose TextDefense, a new adversarial example detection framework that utilizes the target model’s capability to defend against adversarial attacks, requiring no prior knowledge. Unlike previous approaches, TextDefense is attack-type agnostic and outperforms existing methods in experiments with different architectures, datasets, and attack methods. We also discover that the target model’s generalizability is a leading factor influencing the performance of TextDefense. Finally, we provide insights into the adversarial attacks in NLP and the principles of our defense method by analyzing the properties of the target model and the adversarial example.
Authors
- Xing Yang (ORCID: https://orcid.org/0000-0002-8824-1356)
- Chunpeng Ge (ORCID: https://orcid.org/0000-0003-2629-7220)
- Shouling Ji (ORCID: https://orcid.org/0000-0003-4268-372X)
- Yuwen Pu (ORCID: https://orcid.org/0000-0003-2311-4943)
- Hao Peng (ORCID: https://orcid.org/0000-0001-5320-3117)
- Lujia Shen
- Xuhong Zhang (ORCID: https://orcid.org/0000-0002-8571-9780)
- Wei Wang (ORCID: https://orcid.org/0000-0002-9679-9480)
Institutions
- Ningbo University (CN)
- Zhejiang Normal University (CN)
- Shandong University (CN)
- Zhejiang University of Science and Technology (CN)
- National University of Defense Technology (CN)
- Beijing Jiaotong University (CN)
- Zhejiang University (CN)
Publication Details
- Journal
- IEEE Transactions on Dependable and Secure Computing
- Published
- 2025-03-14
- DOI
- https://doi.org/10.1109/tdsc.2025.3551162
- Citations
- 1
- Primary Topic
- Hate Speech and Cyberbullying Detection
- Type
- article
- Field-Weighted Citation Impact
- 2.48