{"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/pixeldefend-leveraging-generative-models-to","title":"PixelDefend: Leveraging Generative Models to Understand and Defend against Adversarial Examples","arxiv_id":"1710.10766","date":"2017-10-30","proceeding":"ICLR 2018 1","authors":["Yang Song","Taesup Kim","Sebastian Nowozin","Stefano Ermon","Nate Kushman"],"abstract":"Adversarial perturbations of normal images are usually imperceptible to\nhumans, but they can seriously confuse state-of-the-art machine learning\nmodels. What makes them so special in the eyes of image classifiers? In this\npaper, we show empirically that adversarial examples mainly lie in the low\nprobability regions of the training distribution, regardless of attack types\nand targeted models. Using statistical hypothesis testing, we find that modern\nneural density models are surprisingly good at detecting imperceptible image\nperturbations. Based on this discovery, we devised PixelDefend, a new approach\nthat purifies a maliciously perturbed image by moving it back towards the\ndistribution seen in the training data. The purified image is then run through\nan unmodified classifier, making our method agnostic to both the classifier and\nthe attacking method. As a result, PixelDefend can be used to protect already\ndeployed models and be combined with other model-specific defenses. Experiments\nshow that our method greatly improves resilience across a wide variety of\nstate-of-the-art attacking methods, increasing accuracy on the strongest attack\nfrom 63% to 84% for Fashion MNIST and from 32% to 70% for CIFAR-10.","url_abs":"http://arxiv.org/abs/1710.10766v3","url_pdf":"http://arxiv.org/pdf/1710.10766v3.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":"pixeldefend-leveraging-generative-models-to","repo_url":"https://github.com/Microsoft/PixelDefend","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"tf","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"hypothesis-testing","task_name":"Two-sample testing"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=1710.10766","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1710.10766"}},"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/Microsoft/PixelDefend","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"unverified":6},"by_repo_kind":{"official":{"samples":6,"ran":0,"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":"8444dfceccf614a8","entry":"analyze","repo":"Microsoft/PixelDefend","repo_kind":"official","path":"utils.py","file_url":"https://github.com/Microsoft/PixelDefend/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":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"8444dfceccf614a8"}},{"code_sha256_prefix":"ad1ad8f799b295cc","entry":"cache_v_stack_variable","repo":"Microsoft/PixelDefend","repo_kind":"official","path":"fast_pixel_cnn_pp/model.py","file_url":"https://github.com/Microsoft/PixelDefend/blob/HEAD/fast_pixel_cnn_pp/model.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":"ad1ad8f799b295cc"}},{"code_sha256_prefix":"08849564ada141ce","entry":"stretch","repo":"Microsoft/PixelDefend","repo_kind":"official","path":"attacks/attacks.py","file_url":"https://github.com/Microsoft/PixelDefend/blob/HEAD/attacks/attacks.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":"08849564ada141ce"}},{"code_sha256_prefix":"21013d75136943c0","entry":"undo_zeroth_column_bias_when_rightshifting","repo":"Microsoft/PixelDefend","repo_kind":"official","path":"fast_pixel_cnn_pp/model.py","file_url":"https://github.com/Microsoft/PixelDefend/blob/HEAD/fast_pixel_cnn_pp/model.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":"21013d75136943c0"}},{"code_sha256_prefix":"d235cfeeb89121f0","entry":"undo_zeroth_row_bias_when_downshifting","repo":"Microsoft/PixelDefend","repo_kind":"official","path":"fast_pixel_cnn_pp/model.py","file_url":"https://github.com/Microsoft/PixelDefend/blob/HEAD/fast_pixel_cnn_pp/model.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":"d235cfeeb89121f0"}},{"code_sha256_prefix":"b84804b8fc540494","entry":"verify","repo":"Microsoft/PixelDefend","repo_kind":"official","path":"utils.py","file_url":"https://github.com/Microsoft/PixelDefend/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":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"b84804b8fc540494"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}