Skip to content

Hsuan-Tung/universal_attack_natural_trigger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

This code accompanies the paper "Universal Adversarial Attacks with Natural Triggers for Text Classification" https://arxiv.org/abs/2005.00174, accepted by NAACL 2021.

Dependencies

Pytorch, AllenNLP, Hugging Face Transformers (see requirements.txt).

Perform universal attacks

First, download the pretrained ARAE model here, and unzip into the "./ARAR/oneb_pretrained" folder.

Then, go to sst or snli directory and run python sst_attack.py or python snli_attack.py.
The argument attack_class is used to select the class label to attack, and the argument len_lim specifies the length of attack trigger.

About

Natural Universal Trigger Search (NUTS)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published