promptbench icon indicating copy to clipboard operation
promptbench copied to clipboard

Can promptbench be used to attack samples instead of prompts?

Open WanliYoung opened this issue 2 years ago • 4 comments

Hi~ Thanks to your great contribution to the community. I would like to try attacking the samples of datasets using promptbench instead of attacking the prompt. Is this feasible? Do you have any suggestions? Thank you so much!

WanliYoung avatar Sep 02 '24 02:09 WanliYoung

Hi, if you would like to attack samples, you could refer to the textattack repo, which is the base of prompt attacks.

kaijiezhu11 avatar Sep 12 '24 05:09 kaijiezhu11

Thank you very much for your reply. I am referring to TextAttack. I found TextAttack has a parameter like --pct-words-to-swap to limit the range of perturbations to the text. May I ask, in promptbench, what is the default magnitude of perturbation? Are there any constraints?

WanliYoung avatar Sep 13 '24 13:09 WanliYoung

Yes, please refer to this file where we defines the constraints of different attacks.

Also, we have the LabelConstraint where we prevent the attack from modifying certain words (such as the label 'positive' for sentiment analysis).

kaijiezhu11 avatar Sep 13 '24 15:09 kaijiezhu11

Thank you very much for solving my problem~

WanliYoung avatar Sep 14 '24 01:09 WanliYoung