Skip to content

Latest commit

 

History

History

zskt

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Experiments

The code is based on ZSKT.

Run Experiments

General

  • Single experiment. Distill from a badnet_grid-backoored teacher with arch WRN-16-2 to student with arch WRN-16-1.
    export CUDA_VISIBLE_DEVICES=0  # specify GPU
    python main.py --dataset=CIFAR10 --teacher_architecture=WRN-16-2 --student_architecture=WRN-16-1 --trigger_pattern=badnet_grid --seeds=3
  • Run sweeps. Choose a sweep command below where you can find all hparams. For example,
    wandb sweep sweeps/cifar10_wrn_poi.yml
    # get the `wandb agent <agent code>` from the CLI output.
    wandb agent <agent code>  # this will run one pair of hyper-params from `cifar10_wrn_poi.yml`.
    wandb agent <> can be run in parallel in different processes, which will auto select different params in yml file.
Trigger Teacher Student Acc/ASR
Acc/ASR ZSKT ZSKT+ABD Clean KD
BadNets (grid) 92.1/99.9 71.9/96.9 68.3/0.7 74.6/4.3
Trojan WM 93.8/100 82.7/93.9 78.2/22.5 77.5/11.1
Trojan 3x3 93.4/98.7 80.9/96.8 71.7/33.3 72.9/1.7
Blend 93.9/99.7 77.0/74.4 71.5/23.1 78.0/4.3
Trojan 8x8 93.7/99.6 80.5/57.2 72.6/17.8 75.2/9.3
BadNets (sq) 93.4/97.8 80.8/37.8 77.9/1.9 76.2/9.1
CL 91.2/94.3 76.8/17.5 67.4/10.2 69.4/2.1
Sig 90.5/97.3 77.9/0.0 72.2/0. 77.4/0.
l2_inv 93.9/100 82.0/0.3 70.7/1.9 77.2/1.2
l0_inv 92.4/99.6 72.8/8.3 69.4/0. 79.2/3.7

Distill from poisoned teachers

Evaluate different backdoors with ZSKT.

wandb sweep sweeps/cifar10_wrn_poi.yml
wandb sweep sweeps/gtsrb_wrn_poi.yml

Distill using clean data

# single run
python kd_distill.py --trigger_pattern=badnet_grid --no_log
wandb sweep sweeps/cifar10_wrn_poi_distill.yml
wandb sweep sweeps/gtsrb_wrn_poi_distill.yml

Customization

Add dataset: Edit get_test_loader in zskt/datasets/datasets.py.

Add model: Edit zskt/models/selector.py to add new architecture and pre-trained model paths.

Defense

  • CIFAR10
wandb sweep sweeps/cifar10_wrn_poi_defense.yml
  • GTSRB
wandb sweep sweeps/gtsrb_wrn_poi_defense.yml