Chang Liu , Wenzhao Xiang , Yinpeng Dong , Xingxing Zhang , Liyuan Wang , Ranjie Duan , Shibao Zheng , Hang Su
{"title":"RobustPrompt: Learning to defend against adversarial attacks with adaptive visual prompts","authors":"Chang Liu , Wenzhao Xiang , Yinpeng Dong , Xingxing Zhang , Liyuan Wang , Ranjie Duan , Shibao Zheng , Hang Su","doi":"10.1016/j.patrec.2025.02.015","DOIUrl":null,"url":null,"abstract":"<div><div>Adversarial training stands out as one of the most effective techniques for enhancing robustness by enriching the training data with adversarial examples. Nonetheless, when faced with various perturbation budgets, the model’s performance can suffer notable degradation. This occurs because different perturbations induce distinct distribution shifts in adversarial examples. In order to enhance performance on specific perturbations, fine-tuning is commonly employed. However, this approach can lead to catastrophic forgetting, where improvements on specific tasks come at the cost of degrading performance on previously learned ones. We frame this challenge as an incremental domain learning problem in continual learning. Inspired by the application of prompt techniques in vision models, we introduce RobustPrompt, which integrates additional guidance information regarding perturbation characteristics into the adversarial training process. This approach enables the model to adaptively enhance its robustness under varying budget perturbations. Specifically, we define an adaptive prompt pool composed of a noise level predictor and corresponding prompts for different perturbations. During training, prompts are injected into different layers of the model, thereby guiding the model to focus on correct features. Experiments demonstrate that RobustPrompt enhances the adversarial robustness of the state-of-the-art Swin Transformer Base model, achieving an average improvement of 61.1% against PGD attacks and 56.9% against AutoAttack across five white-box settings; an average improvement of 76.1% against VMI-FGSM attacks across five black-box settings; an average improvement of 53.7% on five datasets with natural noise. Our results underscore the potential of RobustPrompt as a useful tool for enhancing the reliability and robustness of transformers in image classification tasks.</div></div>","PeriodicalId":54638,"journal":{"name":"Pattern Recognition Letters","volume":"190 ","pages":"Pages 161-168"},"PeriodicalIF":3.9000,"publicationDate":"2025-02-21","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Pattern Recognition Letters","FirstCategoryId":"94","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S0167865525000571","RegionNum":3,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q2","JCRName":"COMPUTER SCIENCE, ARTIFICIAL INTELLIGENCE","Score":null,"Total":0}
引用次数: 0
Abstract
Adversarial training stands out as one of the most effective techniques for enhancing robustness by enriching the training data with adversarial examples. Nonetheless, when faced with various perturbation budgets, the model’s performance can suffer notable degradation. This occurs because different perturbations induce distinct distribution shifts in adversarial examples. In order to enhance performance on specific perturbations, fine-tuning is commonly employed. However, this approach can lead to catastrophic forgetting, where improvements on specific tasks come at the cost of degrading performance on previously learned ones. We frame this challenge as an incremental domain learning problem in continual learning. Inspired by the application of prompt techniques in vision models, we introduce RobustPrompt, which integrates additional guidance information regarding perturbation characteristics into the adversarial training process. This approach enables the model to adaptively enhance its robustness under varying budget perturbations. Specifically, we define an adaptive prompt pool composed of a noise level predictor and corresponding prompts for different perturbations. During training, prompts are injected into different layers of the model, thereby guiding the model to focus on correct features. Experiments demonstrate that RobustPrompt enhances the adversarial robustness of the state-of-the-art Swin Transformer Base model, achieving an average improvement of 61.1% against PGD attacks and 56.9% against AutoAttack across five white-box settings; an average improvement of 76.1% against VMI-FGSM attacks across five black-box settings; an average improvement of 53.7% on five datasets with natural noise. Our results underscore the potential of RobustPrompt as a useful tool for enhancing the reliability and robustness of transformers in image classification tasks.
期刊介绍:
Pattern Recognition Letters aims at rapid publication of concise articles of a broad interest in pattern recognition.
Subject areas include all the current fields of interest represented by the Technical Committees of the International Association of Pattern Recognition, and other developing themes involving learning and recognition.