Skip to content

Official implementation of "Adaptive Certified Training: Towards Better Accuracy-Robustness Tradeoffs" (ECML-PKDD 2024)

License

Notifications You must be signed in to change notification settings

boschresearch/adaptive_robust_training

Repository files navigation

Adaptive Certified Training: Towards Better Accuracy-Robustness Tradeoffs

arXiv ECML

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.

Accuracy-robustness tradeoff CIFAR-10 Accuracy-robustness tradeoff TinyImageNet

Installation

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 and TINYIMAGENET_DATA_DIR in .env file (rename .env.example).

Run code

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>

Train ACERT models

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

Evaluate ACERT models

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

Citation

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}
}

License

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

Purpose of the project

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.

Contact

Please feel free to open an issue or contact us personally if you have questions, need help, or need explanations.

[email protected]

About

Official implementation of "Adaptive Certified Training: Towards Better Accuracy-Robustness Tradeoffs" (ECML-PKDD 2024)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published