{"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/rethinking-pgd-attack-is-sign-function","title":"Rethinking PGD Attack: Is Sign Function Necessary?","arxiv_id":"2312.01260","date":"2023-12-03","proceeding":null,"authors":["Junjie Yang","Tianlong Chen","Xuxi Chen","Zhangyang Wang","Yingbin Liang"],"abstract":"Neural networks have demonstrated success in various domains, yet their performance can be significantly degraded by even a small input perturbation. Consequently, the construction of such perturbations, known as adversarial attacks, has gained significant attention, many of which fall within \"white-box\" scenarios where we have full access to the neural network. Existing attack algorithms, such as the projected gradient descent (PGD), commonly take the sign function on the raw gradient before updating adversarial inputs, thereby neglecting gradient magnitude information. In this paper, we present a theoretical analysis of how such sign-based update algorithm influences step-wise attack performance, as well as its caveat. We also interpret why previous attempts of directly using raw gradients failed. Based on that, we further propose a new raw gradient descent (RGD) algorithm that eliminates the use of sign. Specifically, we convert the constrained optimization problem into an unconstrained one, by introducing a new hidden variable of non-clipped perturbation that can move beyond the constraint. The effectiveness of the proposed RGD algorithm has been demonstrated extensively in experiments, outperforming PGD and other competitors in various settings, without incurring any additional computational overhead. The codes is available in https://github.com/JunjieYang97/RGD.","url_abs":"https://arxiv.org/abs/2312.01260v2","url_pdf":"https://arxiv.org/pdf/2312.01260v2.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":"rethinking-pgd-attack-is-sign-function","repo_url":"https://github.com/junjieyang97/rgd","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"LGPL-3.0"}}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2312.01260","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2312.01260"}},"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/junjieyang97/rgd","reach":{"status":"ok","spdx":"LGPL-3.0"}}],"summary":{"ran_draft_wrong":2,"ran_fixture":1,"ran":6,"unverified":1},"by_repo_kind":{"official":{"samples":10,"ran":9,"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":10,"samples":[{"code_sha256_prefix":"edab3f9c146ad457","entry":"L1_norm","repo":"junjieyang97/rgd","repo_kind":"official","path":"autoattack/other_utils.py","file_url":"https://github.com/junjieyang97/rgd/blob/HEAD/autoattack/other_utils.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"LGPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"edab3f9c146ad457"}},{"code_sha256_prefix":"7325c49fd8c6a7d2","entry":"L1_projection","repo":"junjieyang97/rgd","repo_kind":"official","path":"autoattack/autopgd_base.py","file_url":"https://github.com/junjieyang97/rgd/blob/HEAD/autoattack/autopgd_base.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"LGPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"7325c49fd8c6a7d2"}},{"code_sha256_prefix":"fa19820305aabe1d","entry":"L2_norm","repo":"junjieyang97/rgd","repo_kind":"official","path":"autoattack/other_utils.py","file_url":"https://github.com/junjieyang97/rgd/blob/HEAD/autoattack/other_utils.py","link_basis":"plan_row","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"LGPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"fa19820305aabe1d"}},{"code_sha256_prefix":"77fd60953273db9a","entry":"check_imgs","repo":"junjieyang97/rgd","repo_kind":"official","path":"autoattack/other_utils.py","file_url":"https://github.com/junjieyang97/rgd/blob/HEAD/autoattack/other_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"LGPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"77fd60953273db9a"}},{"code_sha256_prefix":"5d7ff050610414d0","entry":"check_range_output","repo":"junjieyang97/rgd","repo_kind":"official","path":"autoattack/checks.py","file_url":"https://github.com/junjieyang97/rgd/blob/HEAD/autoattack/checks.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"LGPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"5d7ff050610414d0"}},{"code_sha256_prefix":"f73ae9cbfd1838f6","entry":"get_cifar10_test_loader","repo":"junjieyang97/rgd","repo_kind":"official","path":"attack.py","file_url":"https://github.com/junjieyang97/rgd/blob/HEAD/attack.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"LGPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"f73ae9cbfd1838f6"}},{"code_sha256_prefix":"9647e1400ee744e4","entry":"projection_l1","repo":"junjieyang97/rgd","repo_kind":"official","path":"autoattack/fab_projections.py","file_url":"https://github.com/junjieyang97/rgd/blob/HEAD/autoattack/fab_projections.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"LGPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"9647e1400ee744e4"}},{"code_sha256_prefix":"a345677b413ef5ca","entry":"projection_l2","repo":"junjieyang97/rgd","repo_kind":"official","path":"autoattack/fab_projections.py","file_url":"https://github.com/junjieyang97/rgd/blob/HEAD/autoattack/fab_projections.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"LGPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"a345677b413ef5ca"}},{"code_sha256_prefix":"b8bdb6e496b4b5fa","entry":"projection_linf","repo":"junjieyang97/rgd","repo_kind":"official","path":"autoattack/fab_projections.py","file_url":"https://github.com/junjieyang97/rgd/blob/HEAD/autoattack/fab_projections.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"LGPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"b8bdb6e496b4b5fa"}},{"code_sha256_prefix":"2d5dc7a04c57cafa","entry":"get_cifar100_test_loader","repo":"junjieyang97/rgd","repo_kind":"official","path":"attack.py","file_url":"https://github.com/junjieyang97/rgd/blob/HEAD/attack.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"LGPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"2d5dc7a04c57cafa"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}