Package: autovul
This project is a minimized runnable project cut fromtrojanzoo, which contains more datasets, models, attacks and defenses. This repo will not be maintained.This is a minimum code implementation of our USENIX'22 paperOn the Security Risks of AutoML.AbstractThe artifact discovers the vulnerability gap between manual models and automl models against various kinds of attacks (adversarial, poison, backdoor, extraction and membership) in image classification domain. It implements all datasets, models, and attacks used in our paper.We expect the artifact could support the paper's claim that automl models are more vulnerable than manual models against various kinds of attacks, which could be explained by their small gradient variance.ChecklistBinary:onpypiwith any platform.Model:Our pretrained models are available on Google Drive (link). Follow the model path style{model_dir}/image/{dataset}/{model}.pthto place them in correct location.Data set:CIFAR10, CIFAR100 and ImageNet32.Use--downloadflag to download them automatically at first running.ImageNet32 requires manual set-up at theirwebsitedue to legality.Run-time environment:At any platform (Windows and Ubuntu tested).Pytorchandtorchvisionrequired. (CUDA 11.3 recommended)adversarial-robustness-toolboxrequired for extraction attack and membership attack.Hardware:GPU with CUDA support is recommended.Execution:Model training and backdoor attack would be time-consuming. It would cost more than half day on a Nvidia Quodro RTX6000.Metrics:Model accuracy, attack success rate, clean accuracy drop and cross entropy.Output:console output and saved model files (.pth).Experiments:OS scripts. Recommend to run scripts 3-5 times to reduce the randomness of experiments.How much disk space is required (approximately):less than 5GB.How much time is needed to prepare workflow (approximately):within 1 hour.How much time is needed to complete experiments (approximately):3-4 days.Publicly available:on GitHub.Code licenses:GPL-3.Archived:GitHub commit5aeb0d8ad7ed7f2c58fc960694af81b118608b9b.DescriptionHow to accessGitHubpip install -e .PYPIpip install autovulDocker Hubdocker pull local0state/autovulGitHub Packagesdocker pull ghcr.io/ain-soph/autovulHardware DependenciesRecommend to use GPU with CUDA 11.3 and CUDNN 8.0.Less than 5GB disk space is needed.Software DependenciesYou need to installpython==3.9, pytorch==1.10.x, torchvision==0.11.xmanually.ART (IBM) is required for extraction attack and membership attack.pip install adversarial-robustness-toolboxData setWe use CIFAR10, CIFAR100 and ImageNet32 datasets.Use--downloadflag to download them automatically at first running.ImageNet32 requires manual set-up at theirwebsitedue to legality.ModelsOur pretrained models are available on Google Drive (link). Follow the model path style{model_dir}/image/{dataset}/{model}.pthto place them in correct location.InstallationGitHubPYPIpip install autovulDocker HubGitHub Packages(optional) Config PathYou can set the config files to customize data storage location and many other default settings. View/configs_exampleas an example config setting.We support 3 configs (priority ascend):package:(DO NOT MODIFY)autovul/base/configs/*.ymlautovul/vision/configs/*.ymluser:~/.autovul/configs/base/*.yml~/.autovul/configs/vision/*.ymlworkspace:./configs/base/*.yml./configs/vision/*.ymlExperiment WorkflowBash FilesCheck the bash files under/bashto reproduce our paper results.Train ModelsYou need to first run/bash/train.shto get pretrained models.If you run it for the first time, please run with--downloadflag to download the dataset:bash ./bash/train.sh "--download"It takes a relatively long time to train all models, here we provide our pretrained models on Google Drive (link). Follow the model path style{model_dir}/image/{dataset}/{model}.pthto place them in correct location. Note that it includes the pretrained models for mitigation architectures as well.Run Attacks/bash/adv_attack.sh
/bash/poison.sh
/bash/backdoor.sh
/bash/extraction.sh
/bash/membership.shRun Other ExpsGradient Variance/bash/grad_var.shMitigation Architecture/bash/mitigation_train.sh (optional)
/bash/mitigation_backdoor.sh
/bash/mitigation_extraction.shOptionally, You can generate these architectures based on DARTS_V2 usingpython ./projects/generate_mitigation.py. We have already put the generated archs inautovul.vision.utils.model_archs.darts.genotypes. Note that we have provided the pretrained models for mitigation architectures on Google Drive as well.For mitigation experiments, the architecture names in our paper map to:darts-i:diy_deepdarts-ii:diy_no_skipdarts-iii:diy_deep_noskipThese are the 3 options for--model_arch {arch}(with--model darts).To increase cell depth, we may re-wire existing models generated by NAS or modify the performance measure of candidate models. For the former case, we have provided the script to rewire a given model (link). Note that it is necessary to ensure the re-wiring doesn't cause a significant performance drop. For the latter case, we may increase the number of training steps in the single-step gradient descent used in DARTS.To suppress skip connects, we replace the skip connects in a given model with other operations (e.g., convolution) or modify the likelihood of them being selected in the search process. Fro the former case, we have provided the script to substitute skip connects with convolution operations (link). Note that it is necessary to ensure the substitution doesn't cause a significant performance drop. For the latter case, we may multiply the weight of skip connect $\alpha_\mathrm{skip}$ by a coefficient $\gamma \in (0, 1)$.Loss ContoursTake the parameter-space contour as an example. We pick the parameters of the first convolutional layer and randomly generate two orthogonal directions $d_1$ and $d_2$ in the parameter space. For simplicity, we set all each dimension of $d_1$ and $d_2$ to be either $+1$ or $-1$ in a random order and ensure that their orthogonality as $d_1 \cdot d_2 = 0$. We then follow Equation (12) in the paper to explore the mesh grid of $[-0.5, 0.5] \times [-0.5, 0.5]$ and plot the loss contour. A similar procedure is applied to plot the loss contour in the input space, but with the grid set as $[-0.2, 0.2] \times [-0.2, 0.2]$.Evaluation and Expected ResultOur paper claims that automl models are more vulnerable than manual models against various kinds of attacks, which could be explained by low gradient variance.Training(Table 1) Most models around 96%-97% accuracy on CIFAR10.AttackFor automl models on CIFAR10,adversarial(Figure 2) higher success rate around 10% (±4%).poison(Figure 6) lower accuracy drop around 5% (±2%).backdoor(Figure 7)
higher success rate around 2% (±1%)
lower accuracy drop around 1% (±1%).extraction(Figure 9) lower inference cross entropy around 0.3 (±0.1).membership(Figure 10) higher auc around 0.04 (±0.01).Othersgradient variance(Figure 12) automl with lower gradient variance (around 2.2).mitigation architecture(Table 4, Figure 16, 17) deep architectures (darts-i, darts-iii) have larger cross entropy for extraction attack (around 0.5), and higher accuracy drop for poisoning attack (around 7%).Experiment CustomizationUse-hor--helpflag for example python files to check available arguments.