The adaptive certified training method (ACERT) improves clean accuracy and certified robustness tradeoffs of deep learning models by adaptively assigning certification budget to each training sample individually.
Python 3.7+ and PyTorch 1.11+ are required. We use auto-LiRPA
library for bound propagation, which recommends using PyTorch 1.11.
- (Optional) An example of conda environment with Python 3.9 and PyTorch 1.11 installed:
conda create -n acert-env python=3.9 -y
conda activate acert-env
For CUDA 11.3:
conda install -y pytorch==1.11.0 torchvision==0.12.0 torchaudio==0.11.0 cudatoolkit=11.3 -c pytorch
- Install dependencies in
requirements.txt
. Uncomment extra requirements if needed
pip install -r requirements.txt
- (Optional) Download datasets and set paths in dataset configs at configs/datamodule/. You can specify the paths using environment variables by providing values of
CIFAR_DATA_DIR
andTINYIMAGENET_DATA_DIR
in.env
file (rename.env.example
).
Find all experiment configurations in configs/experiment/, and run the experiments with the corresponding config names:
python src/train.py experiment=<config_name_to_paste>
python src/eval.py experiment=eval/<config_name_to_paste>
E.g. to train ACERT model with kappa=0.25 on CIFAR-10 dataset, run
python src/train.py experiment=eps_ibp_cifar10 model.kappa=0.25
E.g. to evaluate ACERT model with kappa=0.25 on CIFAR-10 dataset, run
python src/eval.py experiment=eval/eps_ibp_cifar10 model.kappa=0.25
If this code is useful in your research we would kindly ask you to cite our paper.
@InProceedings{nurlanov2024adaptive,
title = {Adaptive Certified Training: Towards Better Accuracy-Robustness Tradeoffs},
author = {Nurlanov, Zhakshylyk and Schmidt, Frank R. and Bernard, Florian},
booktitle = {European Conference on Machine Learning and Principles and Practice of Knowledge Discovery in Databases},
year = {2024},
month = {September}
}
This project is open sourced under the AGPL-3.0. For a list of other open source components included in the project, see the file 3rd-party-licenses.txt
This software is a research prototype, solely developed for and published as part of the publication cited above. It will neither be maintained nor monitored in any way.
Please feel free to open an issue or contact us personally if you have questions, need help, or need explanations.