{"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/zeropur-succinct-training-free-adversarial","title":"ZeroPur: Succinct Training-Free Adversarial Purification","arxiv_id":"2406.03143","date":"2024-06-05","proceeding":null,"authors":["Erhu Liu","Zonglin Yang","Bo Liu","Bin Xiao","Xiuli Bi"],"abstract":"Adversarial purification is a kind of defense technique that can defend against various unseen adversarial attacks without modifying the victim classifier. Existing methods often depend on external generative models or cooperation between auxiliary functions and victim classifiers. However, retraining generative models, auxiliary functions, or victim classifiers relies on the domain of the fine-tuned dataset and is computation-consuming. In this work, we suppose that adversarial images are outliers of the natural image manifold, and the purification process can be considered as returning them to this manifold. Following this assumption, we present a simple adversarial purification method without further training to purify adversarial images, called ZeroPur. ZeroPur contains two steps: given an adversarial example, Guided Shift obtains the shifted embedding of the adversarial example by the guidance of its blurred counterparts; after that, Adaptive Projection constructs a directional vector by this shifted embedding to provide momentum, projecting adversarial images onto the manifold adaptively. ZeroPur is independent of external models and requires no retraining of victim classifiers or auxiliary functions, relying solely on victim classifiers themselves to achieve purification. Extensive experiments on three datasets (CIFAR-10, CIFAR-100, and ImageNet-1K) using various classifier architectures (ResNet, WideResNet) demonstrate that our method achieves state-of-the-art robust performance. The code will be publicly available.","url_abs":"https://arxiv.org/abs/2406.03143v3","url_pdf":"https://arxiv.org/pdf/2406.03143v3.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":"zeropur-succinct-training-free-adversarial","repo_url":"https://github.com/fra31/auto-attack","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"adversarial-purification","task_name":"Adversarial Purification"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2406.03143","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2406.03143"}},"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/rwightman/pytorch-image-models","reach":null},{"provenance":"deterministic:regex_extraction","url":"https://github.com/erhul/ZeroPur","reach":{"status":"ok"}}],"summary":{"ran":7,"unverified":6},"by_repo_kind":{"found_in_text":{"samples":13,"ran":7,"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":13,"samples":[{"code_sha256_prefix":"7fad0aef219ec2a6","entry":"create_window","repo":"erhul/ZeroPur","repo_kind":"found_in_text","path":"peceptual/distances.py","file_url":"https://github.com/erhul/ZeroPur/blob/HEAD/peceptual/distances.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":"7fad0aef219ec2a6"}},{"code_sha256_prefix":"a945dca82afbbec0","entry":"gaussian","repo":"erhul/ZeroPur","repo_kind":"found_in_text","path":"peceptual/distances.py","file_url":"https://github.com/erhul/ZeroPur/blob/HEAD/peceptual/distances.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":"a945dca82afbbec0"}},{"code_sha256_prefix":"5105d577deca7c37","entry":"get_pred","repo":"erhul/ZeroPur","repo_kind":"found_in_text","path":"utils.py","file_url":"https://github.com/erhul/ZeroPur/blob/HEAD/utils.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":"5105d577deca7c37"}},{"code_sha256_prefix":"f01fff0fc0c2503d","entry":"get_transforms","repo":"erhul/ZeroPur","repo_kind":"found_in_text","path":"utils.py","file_url":"https://github.com/erhul/ZeroPur/blob/HEAD/utils.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":"f01fff0fc0c2503d"}},{"code_sha256_prefix":"096fecc8a890169a","entry":"normalize_flatten_features","repo":"erhul/ZeroPur","repo_kind":"found_in_text","path":"peceptual/distances.py","file_url":"https://github.com/erhul/ZeroPur/blob/HEAD/peceptual/distances.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":"096fecc8a890169a"}},{"code_sha256_prefix":"984b130647734ed0","entry":"run_attack_with_random_targets","repo":"erhul/ZeroPur","repo_kind":"found_in_text","path":"stadv_eot/attacks.py","file_url":"https://github.com/erhul/ZeroPur/blob/HEAD/stadv_eot/attacks.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":"984b130647734ed0"}},{"code_sha256_prefix":"4df8b47f5cfc0bd1","entry":"select_random_neighbor","repo":"erhul/ZeroPur","repo_kind":"found_in_text","path":"transformations/quilting_fast.py","file_url":"https://github.com/erhul/ZeroPur/blob/HEAD/transformations/quilting_fast.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":"4df8b47f5cfc0bd1"}},{"code_sha256_prefix":"d79c1f192b2849e2","entry":"generate_patches","repo":"erhul/ZeroPur","repo_kind":"found_in_text","path":"transformations/quilting_fast.py","file_url":"https://github.com/erhul/ZeroPur/blob/HEAD/transformations/quilting_fast.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":"d79c1f192b2849e2"}},{"code_sha256_prefix":"28464a7d42500331","entry":"generate_quilted_images","repo":"erhul/ZeroPur","repo_kind":"found_in_text","path":"transformations/quilting_fast.py","file_url":"https://github.com/erhul/ZeroPur/blob/HEAD/transformations/quilting_fast.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":"28464a7d42500331"}},{"code_sha256_prefix":"fa9947c95b2f3518","entry":"get_accuracy","repo":"erhul/ZeroPur","repo_kind":"found_in_text","path":"utils.py","file_url":"https://github.com/erhul/ZeroPur/blob/HEAD/utils.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":"fa9947c95b2f3518"}},{"code_sha256_prefix":"84d62d2d23039e48","entry":"get_lpips_model","repo":"erhul/ZeroPur","repo_kind":"found_in_text","path":"peceptual/misc.py","file_url":"https://github.com/erhul/ZeroPur/blob/HEAD/peceptual/misc.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":"84d62d2d23039e48"}},{"code_sha256_prefix":"cbb5e6f16de9abd7","entry":"get_self_lpips_model","repo":"erhul/ZeroPur","repo_kind":"found_in_text","path":"peceptual/misc.py","file_url":"https://github.com/erhul/ZeroPur/blob/HEAD/peceptual/misc.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":"cbb5e6f16de9abd7"}},{"code_sha256_prefix":"38e917a54ba28703","entry":"set_loader","repo":"erhul/ZeroPur","repo_kind":"found_in_text","path":"comparison.py","file_url":"https://github.com/erhul/ZeroPur/blob/HEAD/comparison.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":"38e917a54ba28703"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}