{"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/revisiting-loss-landscape-for-adversarial","title":"Adversarial Weight Perturbation Helps Robust Generalization","arxiv_id":"2004.05884","date":"2020-04-13","proceeding":"NeurIPS 2020 12","authors":["Dongxian Wu","Shu-Tao Xia","Yisen Wang"],"abstract":"The study on improving the robustness of deep neural networks against adversarial examples grows rapidly in recent years. Among them, adversarial training is the most promising one, which flattens the input loss landscape (loss change with respect to input) via training on adversarially perturbed examples. However, how the widely used weight loss landscape (loss change with respect to weight) performs in adversarial training is rarely explored. In this paper, we investigate the weight loss landscape from a new perspective, and identify a clear correlation between the flatness of weight loss landscape and robust generalization gap. Several well-recognized adversarial training improvements, such as early stopping, designing new objective functions, or leveraging unlabeled data, all implicitly flatten the weight loss landscape. Based on these observations, we propose a simple yet effective Adversarial Weight Perturbation (AWP) to explicitly regularize the flatness of weight loss landscape, forming a double-perturbation mechanism in the adversarial training framework that adversarially perturbs both inputs and weights. Extensive experiments demonstrate that AWP indeed brings flatter weight loss landscape and can be easily incorporated into various existing adversarial training methods to further boost their adversarial robustness.","url_abs":"https://arxiv.org/abs/2004.05884v2","url_pdf":"https://arxiv.org/pdf/2004.05884v2.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":"revisiting-loss-landscape-for-adversarial","repo_url":"https://github.com/csdongxian/AWP","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"revisiting-loss-landscape-for-adversarial","repo_url":"https://github.com/fra31/auto-attack","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"revisiting-loss-landscape-for-adversarial","repo_url":"https://github.com/csdongxian/csdongxian","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok"}}],"tasks":[{"task_slug":"adversarial-robustness","task_name":"Adversarial Robustness"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2004.05884","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2004.05884"}},"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/fra31/auto-attack","reach":null},{"provenance":"deterministic:regex_extraction","url":"https://github.com/csdongxian/AWP","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/csdongxian/csdongxian","reach":{"status":"ok"}}],"summary":{"ran":1,"ran_fixture":1,"unverified":3},"by_repo_kind":{"official":{"samples":5,"ran":2,"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":"8f8ef6a488f75f7b","entry":"AdvWeightPerturb","repo":"csdongxian/AWP","repo_kind":"official","path":"AT_AWP/awp.py","file_url":"https://github.com/csdongxian/AWP/blob/HEAD/AT_AWP/awp.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":"8f8ef6a488f75f7b"}},{"code_sha256_prefix":"b20f1357b1d8dbf8","entry":"mixup_data","repo":"csdongxian/AWP","repo_kind":"official","path":"AT_AWP/train_cifar10.py","file_url":"https://github.com/csdongxian/AWP/blob/HEAD/AT_AWP/train_cifar10.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"b20f1357b1d8dbf8"}},{"code_sha256_prefix":"8a93e041134b597a","entry":"clamp","repo":"csdongxian/AWP","repo_kind":"official","path":"AT_AWP/train_cifar10.py","file_url":"https://github.com/csdongxian/AWP/blob/HEAD/AT_AWP/train_cifar10.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":"8a93e041134b597a"}},{"code_sha256_prefix":"054399a5be2d06b1","entry":"normalize","repo":"csdongxian/AWP","repo_kind":"official","path":"AT_AWP/awp.py","file_url":"https://github.com/csdongxian/AWP/blob/HEAD/AT_AWP/awp.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":"054399a5be2d06b1"}},{"code_sha256_prefix":"d06083a6e86b3bf6","entry":"normalize_grad_by_weights","repo":"csdongxian/AWP","repo_kind":"official","path":"AT_AWP/awp.py","file_url":"https://github.com/csdongxian/AWP/blob/HEAD/AT_AWP/awp.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":"d06083a6e86b3bf6"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}