{"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/s-zero-gradient-based-optimization-of-ell-0","title":"$σ$-zero: Gradient-based Optimization of $\\ell_0$-norm Adversarial Examples","arxiv_id":"2402.01879","date":"2024-02-02","proceeding":null,"authors":["Antonio Emanuele Cinà","Francesco Villani","Maura Pintor","Lea Schönherr","Battista Biggio","Marcello Pelillo"],"abstract":"Evaluating the adversarial robustness of deep networks to gradient-based attacks is challenging. While most attacks consider $\\ell_2$- and $\\ell_\\infty$-norm constraints to craft input perturbations, only a few investigate sparse $\\ell_1$- and $\\ell_0$-norm attacks. In particular, $\\ell_0$-norm attacks remain the least studied due to the inherent complexity of optimizing over a non-convex and non-differentiable constraint. However, evaluating adversarial robustness under these attacks could reveal weaknesses otherwise left untested with more conventional $\\ell_2$- and $\\ell_\\infty$-norm attacks. In this work, we propose a novel $\\ell_0$-norm attack, called $\\sigma$-zero, which leverages a differentiable approximation of the $\\ell_0$ norm to facilitate gradient-based optimization, and an adaptive projection operator to dynamically adjust the trade-off between loss minimization and perturbation sparsity. Extensive evaluations using MNIST, CIFAR10, and ImageNet datasets, involving robust and non-robust models, show that $\\sigma$\\texttt{-zero} finds minimum $\\ell_0$-norm adversarial examples without requiring any time-consuming hyperparameter tuning, and that it outperforms all competing sparse attacks in terms of success rate, perturbation size, and efficiency.","url_abs":"https://arxiv.org/abs/2402.01879v3","url_pdf":"https://arxiv.org/pdf/2402.01879v3.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":"s-zero-gradient-based-optimization-of-ell-0","repo_url":"https://github.com/cinofix/sigma-zero-adversarial-attack","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}},{"paper_slug":"s-zero-gradient-based-optimization-of-ell-0","repo_url":"https://github.com/jeromerony/adversarial-library","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"s-zero-gradient-based-optimization-of-ell-0","repo_url":"https://github.com/sigma0-advx/sigma-zero","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"adversarial-robustness","task_name":"Adversarial Robustness"}],"methods":[{"method_slug":"hoc","method_name":"HOC"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2402.01879","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2402.01879"}},"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/sigma0-advx/sigma-zero","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/cinofix/sigma-zero-adversarial-attack","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/jeromerony/adversarial-library","reach":null}],"summary":{"ran_draft_wrong":3,"ran_fixture":2,"ran":5,"unverified":5},"by_repo_kind":{"official":{"samples":15,"ran":10,"repositories":2}},"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":13,"samples":[{"code_sha256_prefix":"2a80220dabcb742a","entry":"conv1x1","repo":"cinofix/sigma-zero-adversarial-attack","repo_kind":"official","path":"utils/resnet.py","file_url":"https://github.com/cinofix/sigma-zero-adversarial-attack/blob/HEAD/utils/resnet.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"2a80220dabcb742a"}},{"code_sha256_prefix":"600ff2c45e0de056","entry":"conv3x3","repo":"cinofix/sigma-zero-adversarial-attack","repo_kind":"official","path":"utils/resnet.py","file_url":"https://github.com/cinofix/sigma-zero-adversarial-attack/blob/HEAD/utils/resnet.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"600ff2c45e0de056"}},{"code_sha256_prefix":"8de30c9ed4a4827e","entry":"difference_of_logits","repo":"jeromerony/adversarial-library","repo_kind":"official","path":"adv_lib/attacks/sigma_zero.py","file_url":"https://github.com/jeromerony/adversarial-library/blob/HEAD/adv_lib/attacks/sigma_zero.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"8de30c9ed4a4827e"}},{"code_sha256_prefix":"ddce71a067599f06","entry":"dlr_loss_targeted","repo":"cinofix/sigma-zero-adversarial-attack","repo_kind":"official","path":"utils/attack_wrappers.py","file_url":"https://github.com/cinofix/sigma-zero-adversarial-attack/blob/HEAD/utils/attack_wrappers.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ddce71a067599f06"}},{"code_sha256_prefix":"cc62fb1a937874d2","entry":"drop_path","repo":"cinofix/sigma-zero-adversarial-attack","repo_kind":"official","path":"models/cifar10/c11_c12.py","file_url":"https://github.com/cinofix/sigma-zero-adversarial-attack/blob/HEAD/models/cifar10/c11_c12.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"cc62fb1a937874d2"}},{"code_sha256_prefix":"3038e0a67906d5b1","entry":"fixed_asr","repo":"cinofix/sigma-zero-adversarial-attack","repo_kind":"official","path":"utilities.py","file_url":"https://github.com/cinofix/sigma-zero-adversarial-attack/blob/HEAD/utilities.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"3038e0a67906d5b1"}},{"code_sha256_prefix":"db77c4e8aea690b7","entry":"get_norm_stats","repo":"cinofix/sigma-zero-adversarial-attack","repo_kind":"official","path":"utilities.py","file_url":"https://github.com/cinofix/sigma-zero-adversarial-attack/blob/HEAD/utilities.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"db77c4e8aea690b7"}},{"code_sha256_prefix":"f5f6eb3692c34ae6","entry":"sigma_zero","repo":"jeromerony/adversarial-library","repo_kind":"official","path":"adv_lib/attacks/sigma_zero.py","file_url":"https://github.com/jeromerony/adversarial-library/blob/HEAD/adv_lib/attacks/sigma_zero.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"f5f6eb3692c34ae6"}},{"code_sha256_prefix":"cd4fda681f389b4e","entry":"tp_relu","repo":"cinofix/sigma-zero-adversarial-attack","repo_kind":"official","path":"models/cifar10/c11_c12.py","file_url":"https://github.com/cinofix/sigma-zero-adversarial-attack/blob/HEAD/models/cifar10/c11_c12.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"cd4fda681f389b4e"}},{"code_sha256_prefix":"9c29c23a42e6a66b","entry":"tp_smoothed_relu","repo":"cinofix/sigma-zero-adversarial-attack","repo_kind":"official","path":"models/cifar10/c11_c12.py","file_url":"https://github.com/cinofix/sigma-zero-adversarial-attack/blob/HEAD/models/cifar10/c11_c12.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"9c29c23a42e6a66b"}},{"code_sha256_prefix":"88e37f205195a51a","entry":"PreActResNet18","repo":"cinofix/sigma-zero-adversarial-attack","repo_kind":"official","path":"models/cifar10/preact_resnet.py","file_url":"https://github.com/cinofix/sigma-zero-adversarial-attack/blob/HEAD/models/cifar10/preact_resnet.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"88e37f205195a51a"}},{"code_sha256_prefix":"741cc4bc602aecde","entry":"get_cifar_loaders","repo":"cinofix/sigma-zero-adversarial-attack","repo_kind":"official","path":"dataset.py","file_url":"https://github.com/cinofix/sigma-zero-adversarial-attack/blob/HEAD/dataset.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"741cc4bc602aecde"}},{"code_sha256_prefix":"d0d665da7580ee86","entry":"get_mnist_loaders","repo":"cinofix/sigma-zero-adversarial-attack","repo_kind":"official","path":"dataset.py","file_url":"https://github.com/cinofix/sigma-zero-adversarial-attack/blob/HEAD/dataset.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d0d665da7580ee86"}},{"code_sha256_prefix":"72b9398658504f03","entry":"get_predictions","repo":"cinofix/sigma-zero-adversarial-attack","repo_kind":"official","path":"utils/attack_wrappers.py","file_url":"https://github.com/cinofix/sigma-zero-adversarial-attack/blob/HEAD/utils/attack_wrappers.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"72b9398658504f03"}},{"code_sha256_prefix":"1a30faaa5c84a8d4","entry":"get_predictions_and_gradients","repo":"cinofix/sigma-zero-adversarial-attack","repo_kind":"official","path":"utils/attack_wrappers.py","file_url":"https://github.com/cinofix/sigma-zero-adversarial-attack/blob/HEAD/utils/attack_wrappers.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"1a30faaa5c84a8d4"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}