{"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/fighting-gradients-with-gradients-dynamic","title":"Fighting Gradients with Gradients: Dynamic Defenses against Adversarial Attacks","arxiv_id":"2105.08714","date":"2021-05-18","proceeding":"NeurIPS 2021 12","authors":["Dequan Wang","An Ju","Evan Shelhamer","David Wagner","Trevor Darrell"],"abstract":"Adversarial attacks optimize against models to defeat defenses. Existing defenses are static, and stay the same once trained, even while attacks change. We argue that models should fight back, and optimize their defenses against attacks at test time. We propose dynamic defenses, to adapt the model and input during testing, by defensive entropy minimization (dent). Dent alters testing, but not training, for compatibility with existing models and train-time defenses. Dent improves the robustness of adversarially-trained defenses and nominally-trained models against white-box, black-box, and adaptive attacks on CIFAR-10/100 and ImageNet. In particular, dent boosts state-of-the-art defenses by 20+ points absolute against AutoAttack on CIFAR-10 at $\\epsilon_\\infty$ = 8/255.","url_abs":"https://arxiv.org/abs/2105.08714v1","url_pdf":"https://arxiv.org/pdf/2105.08714v1.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":"fighting-gradients-with-gradients-dynamic","repo_url":"https://github.com/DequanWang/dent","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"fighting-gradients-with-gradients-dynamic","repo_url":"https://github.com/DequanWang/tent","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2105.08714","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2105.08714"}},"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":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/DequanWang/dent","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/DequanWang/tent","reach":null}],"summary":{"ran":3,"ran_draft_wrong":5,"ran_fixture":2,"unverified":3},"by_repo_kind":{"official":{"samples":6,"ran":4,"repositories":1},"listed":{"samples":2,"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":5,"samples":[{"code_sha256_prefix":"9b0b70ed44f66088","entry":"Tent","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"9b0b70ed44f66088"}},{"code_sha256_prefix":"fb3d07027ed3b46c","entry":"collect_params","repo":"DequanWang/tent","repo_kind":"listed","path":"tent.py","file_url":"https://github.com/DequanWang/tent/blob/HEAD/tent.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"fb3d07027ed3b46c"}},{"code_sha256_prefix":"c5f915703f30ab89","entry":"collect_stats","repo":"DequanWang/dent","repo_kind":"official","path":"norm.py","file_url":"https://github.com/DequanWang/dent/blob/HEAD/norm.py","link_basis":"plan_row","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":"c5f915703f30ab89"}},{"code_sha256_prefix":"8f537ee8d4a9b397","entry":"configure_model","repo":"DequanWang/dent","repo_kind":"official","path":"norm.py","file_url":"https://github.com/DequanWang/dent/blob/HEAD/norm.py","link_basis":"plan_row","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":"8f537ee8d4a9b397"}},{"code_sha256_prefix":"d203451c6493f65d","entry":"copy_model_and_optimizer","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"d203451c6493f65d"}},{"code_sha256_prefix":"dae52c9027c48afd","entry":"forward_and_adapt","repo":"DequanWang/tent","repo_kind":"listed","path":"tent.py","file_url":"https://github.com/DequanWang/tent/blob/HEAD/tent.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"dae52c9027c48afd"}},{"code_sha256_prefix":"1d10e9bc70ce18a5","entry":"forward_and_adapt","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"1d10e9bc70ce18a5"}},{"code_sha256_prefix":"721e565ebd5fda4e","entry":"setup_source","repo":"DequanWang/dent","repo_kind":"official","path":"cifar10c.py","file_url":"https://github.com/DequanWang/dent/blob/HEAD/cifar10c.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"721e565ebd5fda4e"}},{"code_sha256_prefix":"3078648c75e3e1e3","entry":"softmax_entropy","repo":"DequanWang/dent","repo_kind":"official","path":"tent.py","file_url":"https://github.com/DequanWang/dent/blob/HEAD/tent.py","link_basis":"plan_row","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"3078648c75e3e1e3"}},{"code_sha256_prefix":"60e9cb8fea03027c","entry":"softmax_entropy","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"60e9cb8fea03027c"}},{"code_sha256_prefix":"5014c3a1f79a6661","entry":"load_model_and_optimizer","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"5014c3a1f79a6661"}},{"code_sha256_prefix":"1a3691c12b2dbd54","entry":"shot","repo":"DequanWang/dent","repo_kind":"official","path":"dent.py","file_url":"https://github.com/DequanWang/dent/blob/HEAD/dent.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":"1a3691c12b2dbd54"}},{"code_sha256_prefix":"5a02af70018fdf00","entry":"tent","repo":"DequanWang/dent","repo_kind":"official","path":"dent.py","file_url":"https://github.com/DequanWang/dent/blob/HEAD/dent.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":"5a02af70018fdf00"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}