{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/once-for-all-adversarial-training-in-situ","title":"Once-for-All Adversarial Training: In-Situ Tradeoff between Robustness and Accuracy for Free","arxiv_id":"2010.11828","date":"2020-10-22","proceeding":"NeurIPS 2020 12","authors":["Haotao Wang","Tianlong Chen","Shupeng Gui","Ting-Kuei Hu","Ji Liu","Zhangyang Wang"],"abstract":"Adversarial training and its many variants substantially improve deep network robustness, yet at the cost of compromising standard accuracy. Moreover, the training process is heavy and hence it becomes impractical to thoroughly explore the trade-off between accuracy and robustness. This paper asks this new question: how to quickly calibrate a trained model in-situ, to examine the achievable trade-offs between its standard and robust accuracies, without (re-)training it many times? Our proposed framework, Once-for-all Adversarial Training (OAT), is built on an innovative model-conditional training framework, with a controlling hyper-parameter as the input. The trained model could be adjusted among different standard and robust accuracies \"for free\" at testing time. As an important knob, we exploit dual batch normalization to separate standard and adversarial feature statistics, so that they can be learned in one model without degrading performance. We further extend OAT to a Once-for-all Adversarial Training and Slimming (OATS) framework, that allows for the joint trade-off among accuracy, robustness and runtime efficiency. Experiments show that, without any re-training nor ensembling, OAT/OATS achieve similar or even superior performance compared to dedicatedly trained models at various configurations. Our codes and pretrained models are available at: https://github.com/VITA-Group/Once-for-All-Adversarial-Training.","url_abs":"https://arxiv.org/abs/2010.11828v2","url_pdf":"https://arxiv.org/pdf/2010.11828v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"once-for-all-adversarial-training-in-situ","repo_url":"https://github.com/VITA-Group/Once-for-All-Adversarial-Training","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"all","task_name":"All"}],"methods":[{"method_slug":"batch-normalization","method_name":"Batch Normalization"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2010.11828","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2010.11828"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"deterministic:regex_extraction","url":"https://github.com/VITA-Group/Once-for-All-Adversarial-Training","reach":null}],"summary":{"ran":5,"unverified":2},"by_repo_kind":{"official":{"samples":7,"ran":5,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"2b79c0a50303daf7","entry":"SlimmableConv2d","repo":"VITA-Group/Once-for-All-Adversarial-Training","repo_kind":"official","path":"models/cifar10/resnet_slimmable_OAT.py","file_url":"https://github.com/VITA-Group/Once-for-All-Adversarial-Training/blob/HEAD/models/cifar10/resnet_slimmable_OAT.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2b79c0a50303daf7"}},{"code_sha256_prefix":"4852e1cf4d0eef4b","entry":"SlimmableFiLM_Layer","repo":"VITA-Group/Once-for-All-Adversarial-Training","repo_kind":"official","path":"models/cifar10/resnet_slimmable_OAT.py","file_url":"https://github.com/VITA-Group/Once-for-All-Adversarial-Training/blob/HEAD/models/cifar10/resnet_slimmable_OAT.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"4852e1cf4d0eef4b"}},{"code_sha256_prefix":"c4f0802bcc8164a8","entry":"SlimmableLinear","repo":"VITA-Group/Once-for-All-Adversarial-Training","repo_kind":"official","path":"models/cifar10/resnet_slimmable_OAT.py","file_url":"https://github.com/VITA-Group/Once-for-All-Adversarial-Training/blob/HEAD/models/cifar10/resnet_slimmable_OAT.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"c4f0802bcc8164a8"}},{"code_sha256_prefix":"1d6c78561854755d","entry":"SwitchableBatchNorm2d","repo":"VITA-Group/Once-for-All-Adversarial-Training","repo_kind":"official","path":"models/cifar10/resnet_slimmable_OAT.py","file_url":"https://github.com/VITA-Group/Once-for-All-Adversarial-Training/blob/HEAD/models/cifar10/resnet_slimmable_OAT.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"1d6c78561854755d"}},{"code_sha256_prefix":"2690a11558053471","entry":"SwitchableDualBN2d","repo":"VITA-Group/Once-for-All-Adversarial-Training","repo_kind":"official","path":"models/cifar10/resnet_slimmable_OAT.py","file_url":"https://github.com/VITA-Group/Once-for-All-Adversarial-Training/blob/HEAD/models/cifar10/resnet_slimmable_OAT.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2690a11558053471"}},{"code_sha256_prefix":"5c7cd1b544475354","entry":"SlimmableBasicBlockOAT","repo":"VITA-Group/Once-for-All-Adversarial-Training","repo_kind":"official","path":"models/cifar10/resnet_slimmable_OAT.py","file_url":"https://github.com/VITA-Group/Once-for-All-Adversarial-Training/blob/HEAD/models/cifar10/resnet_slimmable_OAT.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"5c7cd1b544475354"}},{"code_sha256_prefix":"0fcabdc54608c92e","entry":"SlimmableResNet34OAT","repo":"VITA-Group/Once-for-All-Adversarial-Training","repo_kind":"official","path":"models/cifar10/resnet_slimmable_OAT.py","file_url":"https://github.com/VITA-Group/Once-for-All-Adversarial-Training/blob/HEAD/models/cifar10/resnet_slimmable_OAT.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0fcabdc54608c92e"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}