Large Language Model Text Adversarial Defense Method Based on Disturbance Detection and Error Correction
This study aims to effectively defend against complex and diverse adversarial attacks, enhance adversarial defense performance in the field of textual adversarial examples, and address existing issues in current defense methods such as models’ inability to accurately detect perturbations and perform effective error correction. To this end, we propose a Large Language Model Adversarial Defense (LLMAD) method based on perturbation detection and correction. The LLMAD framework consists of two modules: a perturbation detection module and a perturbation correction module. The detection module combines pre-trained models with soft-masking layers to rapidly determine whether samples contain adversarial perturbations. The correction module employs large language models fine-tuned using an adversarial example perturbation dataset constructed through data augmentation, enhancing task performance in adversarial defense and enabling efficient and accurate error correction of adversarial samples. Experimental results demonstrate that, across multiple datasets, various target models defended through the LLMAD method achieve satisfactory defense effectiveness against different types of adversarial attacks. The classification accuracy of defended models shows an average improvement of 66.8% compared to undefended baselines and outperforms existing methods by 13.4% on average. Additional perturbation detection performance tests and ablation studies further validate the accuracy of detection capabilities and the effectiveness of module combinations. A series of experiments confirm that the LLMAD method can significantly enhance defensive effectiveness against textual adversarial attacks.
Authors
- Lei Che
- Yan Hou (ORCID: https://orcid.org/0000-0002-9895-0391)
- Chao Wu (ORCID: https://orcid.org/0000-0003-2274-4097)
Institutions
- Beijing Information Science & Technology University (CN)
Publication Details
- Journal
- Electronics
- Published
- 2025-05-31
- DOI
- https://doi.org/10.3390/electronics14112267
- Citations
- 2
- Primary Topic
- Adversarial Robustness in Machine Learning
- Type
- article
- Field-Weighted Citation Impact
- 4.96
Funders
- Ministry of Education of the People's Republic of China