Skip to content

Han8931/rsmi_nlp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Randomized Smoothing with Masked Inference for Adversarially Robust NLP Systems

  • Accepted for Association for Computational Linguistics (ACL'23)

Train Models:

  • Fine-tune PLMs
CUDA_VISIBLE_DEVICES=0 python3 main_base.py --model_dir_path ./cls_task/checkpoint/ --dataset ag --batch_size 24 --epochs 10 --save_model base_roberta_ag --model roberta --save --max_seq_length 256 --lr 0.00001 --save
  • RSMI models
CUDA_VISIBLE_DEVICES=0 python3 main_rsmi.py --model_dir_path ./cls_task/checkpoint/ --dataset ag --batch_size 16 --epochs 10 --save_model rsmi_roberta_ag --model roberta --nth_layers 3 --noise_eps 0.2 --max_seq_length 256 --multi_mask 2 --custom_forward --save

Attack Models:

  • Fine-tuned PLMs
CUDA_VISIBLE_DEVICES=0 python3 textattack_main.py --model_dir_path ./cls_task/checkpoint/ --load_model base_roberta_ag_0 --dataset imdb --nth_data 0 --seed 0 --dataset_type test --save_data --model roberta --attack_method textfooler --n_success 1000 --batch_size 1 --max_seq_length 256 --model_type base --max_rate 1.0
  • RSMI models
CUDA_VISIBLE_DEVICES=0 python3 textattack_main.py --model_dir_path ./cls_task/checkpoint/ --load_model test_0 --dataset imdb --nth_data 0 --seed 0 --dataset_type test --save_data --model roberta --attack_method textfooler --n_success 1000 --batch_size 1 --nth_layer 3 --noise_eps 0.2 --multi_mask 2 --max_rate 1.0 --num_ensemble 5 --custom_forward --hf_model --max_seq_length 256 --model_type rsmi --adv_batch_size 20 --alpha_p 0.98 --two_step

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages