The goal of this project:
- We study whether randomized smoothing, a scalable certification framework, can be leveraged to certify cost-sensitive robustness.
- To certify cost-sensitive robustness, we propose a new practical certification pipeline to produce tight robustness guarantees for any given cost matrix.
- To train smoothed classifiers that are optimized for cost-sensitive robustness, we propose fine-grained certified radius optimization schemes.
-
Install PyTorch
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116
-
Install Other Dependencies
pip install scipy pandas statsmodels matplotlib seaborn
-
Certification for cost-sensitive robustness
python certify.py --dataset cifar10 --base_classifier checkpoint_dir --sigma 0.5 --outfile outfile --certify sensitive --type macer
-
Training for seedwise cost matrices
python train.py --dataset cifar10 --version v0 --ckptdir ckpt --lbd 3 --outfile outfile --arch cifar_resnet56 --sigma 0.5 --seed_type 3
-
Training for pairwise cost matrices
python train.py --dataset cifar10 --version v1 --ckptdir ckpt --lbd 3 --outfile outfile --arch cifar_resnet56 --sigma 0.5 --seed_type 3 --target_type single
CS-RS
, including:train.py
: implements detailed training pipelinemacer.py, pair_macer.py
: main functions for training provably robust cost-sensitive classifiers for seedwise and pairwise cost matricescertify
: implements detailed certification pipelinecore.py
: implements detailed practical certification algorithm for cost-sensitive robustnesssmooth_train.py
: implements the reweighting adaptation for standard randomized smoothing training methodsanalyze.py
: functions to draw the cost-sensitive robustness v.s. certified radius curves