{"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/generating-natural-language-adversarial","title":"Generating Natural Language Adversarial Examples","arxiv_id":"1804.07998","date":"2018-04-21","proceeding":"EMNLP 2018 10","authors":["Moustafa Alzantot","Yash Sharma","Ahmed Elgohary","Bo-Jhang Ho","Mani Srivastava","Kai-Wei Chang"],"abstract":"Deep neural networks (DNNs) are vulnerable to adversarial examples,\nperturbations to correctly classified examples which can cause the model to\nmisclassify. In the image domain, these perturbations are often virtually\nindistinguishable to human perception, causing humans and state-of-the-art\nmodels to disagree. However, in the natural language domain, small\nperturbations are clearly perceptible, and the replacement of a single word can\ndrastically alter the semantics of the document. Given these challenges, we use\na black-box population-based optimization algorithm to generate semantically\nand syntactically similar adversarial examples that fool well-trained sentiment\nanalysis and textual entailment models with success rates of 97% and 70%,\nrespectively. We additionally demonstrate that 92.3% of the successful\nsentiment analysis adversarial examples are classified to their original label\nby 20 human annotators, and that the examples are perceptibly quite similar.\nFinally, we discuss an attempt to use adversarial training as a defense, but\nfail to yield improvement, demonstrating the strength and diversity of our\nadversarial examples. We hope our findings encourage researchers to pursue\nimproving the robustness of DNNs in the natural language domain.","url_abs":"http://arxiv.org/abs/1804.07998v2","url_pdf":"http://arxiv.org/pdf/1804.07998v2.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":"generating-natural-language-adversarial","repo_url":"https://github.com/nesl/nlp_adversarial_examples","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"tf","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"generating-natural-language-adversarial","repo_url":"https://github.com/alankarj/robust_nlp","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok"}},{"paper_slug":"generating-natural-language-adversarial","repo_url":"https://github.com/clips/gsoc2019_bias","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"tf","reach":{"status":"ok","spdx":"GPL-3.0"}},{"paper_slug":"generating-natural-language-adversarial","repo_url":"https://github.com/QData/TextAttack/blob/master/textattack/attack_recipes/genetic_algorithm_alzantot_2018.py","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"none","reach":null},{"paper_slug":"generating-natural-language-adversarial","repo_url":"https://github.com/makcedward/nlpaug","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"tf","reach":null}],"tasks":[{"task_slug":"diversity","task_name":"Diversity"},{"task_slug":"natural-language-inference","task_name":"Natural Language Inference"},{"task_slug":"sentiment-analysis","task_name":"Sentiment Analysis"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=1804.07998","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1804.07998"}},"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/QData/TextAttack/blob/master/textattack/attack_recipes/genetic_algorithm_alzantot_2018.py","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/makcedward/nlpaug","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/nesl/nlp_adversarial_examples","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/alankarj/robust_nlp","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/clips/gsoc2019_bias","reach":{"status":"ok","spdx":"GPL-3.0"}}],"summary":{"unverified":5},"by_repo_kind":{"official":{"samples":5,"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":"78ff89613e73a14f","entry":"LoadModel","repo":"nesl/nlp_adversarial_examples","repo_kind":"official","path":"lm_utils.py","file_url":"https://github.com/nesl/nlp_adversarial_examples/blob/HEAD/lm_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":"78ff89613e73a14f"}},{"code_sha256_prefix":"b32ff2d8081dfeeb","entry":"create_embeddings_matrix","repo":"nesl/nlp_adversarial_examples","repo_kind":"official","path":"glove_utils.py","file_url":"https://github.com/nesl/nlp_adversarial_examples/blob/HEAD/glove_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":"b32ff2d8081dfeeb"}},{"code_sha256_prefix":"6bc964b851519b55","entry":"html_render","repo":"nesl/nlp_adversarial_examples","repo_kind":"official","path":"display_utils.py","file_url":"https://github.com/nesl/nlp_adversarial_examples/blob/HEAD/display_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":"6bc964b851519b55"}},{"code_sha256_prefix":"13936ee55389baba","entry":"loadGloveModel","repo":"nesl/nlp_adversarial_examples","repo_kind":"official","path":"glove_utils.py","file_url":"https://github.com/nesl/nlp_adversarial_examples/blob/HEAD/glove_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":"13936ee55389baba"}},{"code_sha256_prefix":"63ad9da0d49a1689","entry":"load_glove_from_pickle","repo":"nesl/nlp_adversarial_examples","repo_kind":"official","path":"glove_utils.py","file_url":"https://github.com/nesl/nlp_adversarial_examples/blob/HEAD/glove_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":"63ad9da0d49a1689"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}