{"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-attacks-in-a-hard","title":"Generating Natural Language Attacks in a Hard Label Black Box Setting","arxiv_id":"2012.14956","date":"2020-12-29","proceeding":null,"authors":["Rishabh Maheshwary","Saket Maheshwary","Vikram Pudi"],"abstract":"We study an important and challenging task of attacking natural language processing models in a hard label black box setting. We propose a decision-based attack strategy that crafts high quality adversarial examples on text classification and entailment tasks. Our proposed attack strategy leverages population-based optimization algorithm to craft plausible and semantically similar adversarial examples by observing only the top label predicted by the target model. At each iteration, the optimization procedure allow word replacements that maximizes the overall semantic similarity between the original and the adversarial text. Further, our approach does not rely on using substitute models or any kind of training data. We demonstrate the efficacy of our proposed approach through extensive experimentation and ablation studies on five state-of-the-art target models across seven benchmark datasets. In comparison to attacks proposed in prior literature, we are able to achieve a higher success rate with lower word perturbation percentage that too in a highly restricted setting.","url_abs":"https://arxiv.org/abs/2012.14956v2","url_pdf":"https://arxiv.org/pdf/2012.14956v2.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-attacks-in-a-hard","repo_url":"https://github.com/RishabhMaheshwary/hard-label-attack","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":null},{"paper_slug":"generating-natural-language-attacks-in-a-hard","repo_url":"https://github.com/jhl-hust/texthacker","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"generating-natural-language-attacks-in-a-hard","repo_url":"https://github.com/zhuhai-ustc/limeattack","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"adversarial-text","task_name":"Adversarial Text"},{"task_slug":"semantic-similarity","task_name":"Semantic Similarity"},{"task_slug":"semantic-textual-similarity","task_name":"Semantic Textual Similarity"},{"task_slug":"text-classification","task_name":"Text Classification"},{"task_slug":"text-classification-1","task_name":"text-classification"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2012.14956","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2012.14956"}},"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/jhl-hust/texthacker","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/RishabhMaheshwary/hard-label-attack","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/zhuhai-ustc/limeattack","reach":null}],"summary":{"ran_honours":1,"ran_draft_wrong":4,"ran_fixture":1},"by_repo_kind":{"official":{"samples":4,"ran":4,"repositories":1},"listed":{"samples":2,"ran":2,"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":6,"samples":[{"code_sha256_prefix":"c21e48ffeb28f27c","entry":"calc_sim","repo":"RishabhMaheshwary/hard-label-attack","repo_kind":"official","path":"classification_attack.py","file_url":"https://github.com/RishabhMaheshwary/hard-label-attack/blob/HEAD/classification_attack.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"c21e48ffeb28f27c"}},{"code_sha256_prefix":"42fd8b8cd0d91749","entry":"get_attack_result","repo":"RishabhMaheshwary/hard-label-attack","repo_kind":"official","path":"classification_attack.py","file_url":"https://github.com/RishabhMaheshwary/hard-label-attack/blob/HEAD/classification_attack.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"42fd8b8cd0d91749"}},{"code_sha256_prefix":"b91a5961fb87cb5e","entry":"load_obj","repo":"zhuhai-ustc/limeattack","repo_kind":"listed","path":"LimeAttack_classification.py","file_url":"https://github.com/zhuhai-ustc/limeattack/blob/HEAD/LimeAttack_classification.py","link_basis":"first_harvest_node","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":"b91a5961fb87cb5e"}},{"code_sha256_prefix":"87b2750a51e1c3e9","entry":"pick_most_similar_words_batch","repo":"RishabhMaheshwary/hard-label-attack","repo_kind":"official","path":"classification_attack.py","file_url":"https://github.com/RishabhMaheshwary/hard-label-attack/blob/HEAD/classification_attack.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"87b2750a51e1c3e9"}},{"code_sha256_prefix":"cee2b1928c7dcb6a","entry":"read_data","repo":"RishabhMaheshwary/hard-label-attack","repo_kind":"official","path":"nli_attack.py","file_url":"https://github.com/RishabhMaheshwary/hard-label-attack/blob/HEAD/nli_attack.py","link_basis":"first_harvest_node","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":"cee2b1928c7dcb6a"}},{"code_sha256_prefix":"8d7dd0e725cac033","entry":"split_token","repo":"zhuhai-ustc/limeattack","repo_kind":"listed","path":"LimeAttack_classification.py","file_url":"https://github.com/zhuhai-ustc/limeattack/blob/HEAD/LimeAttack_classification.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"8d7dd0e725cac033"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}