{"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/searching-for-an-effective-defender","title":"Searching for an Effective Defender: Benchmarking Defense against Adversarial Word Substitution","arxiv_id":"2108.12777","date":"2021-08-29","proceeding":"EMNLP 2021 11","authors":["Zongyi Li","Jianhan Xu","Jiehang Zeng","Linyang Li","Xiaoqing Zheng","Qi Zhang","Kai-Wei Chang","Cho-Jui Hsieh"],"abstract":"Recent studies have shown that deep neural networks are vulnerable to intentionally crafted adversarial examples, and various methods have been proposed to defend against adversarial word-substitution attacks for neural NLP models. However, there is a lack of systematic study on comparing different defense approaches under the same attacking setting. In this paper, we seek to fill the gap of systematic studies through comprehensive researches on understanding the behavior of neural text classifiers trained by various defense methods under representative adversarial attacks. In addition, we propose an effective method to further improve the robustness of neural text classifiers against such attacks and achieved the highest accuracy on both clean and adversarial examples on AGNEWS and IMDB datasets by a significant margin.","url_abs":"https://arxiv.org/abs/2108.12777v2","url_pdf":"https://arxiv.org/pdf/2108.12777v2.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":"searching-for-an-effective-defender","repo_url":"https://github.com/rockylzy/textdefender","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"benchmarking","task_name":"Benchmarking"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2108.12777","atlas_url":"https://app.syntology.ai/?focus=2108.12777","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2108.12777"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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/rockylzy/textdefender","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"deterministic:regex_extraction","url":"https://github.com/RockyLzy/TextDefender","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":1,"ran_draft_wrong":1,"unverified":7},"by_repo_kind":{"official":{"samples":9,"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":0,"samples":[{"code_sha256_prefix":"875a0b28ba40c0a5","entry":"BaseTrainer","repo":"RockyLzy/TextDefender","repo_kind":"official","path":"trainer/ascc.py","file_url":"https://github.com/RockyLzy/TextDefender/blob/HEAD/trainer/ascc.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"875a0b28ba40c0a5"}},{"code_sha256_prefix":"950d3cda566f3244","entry":"convert_batch_to_bert_input_dict","repo":"RockyLzy/TextDefender","repo_kind":"official","path":"trainer/ascc.py","file_url":"https://github.com/RockyLzy/TextDefender/blob/HEAD/trainer/ascc.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":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"950d3cda566f3244"}},{"code_sha256_prefix":"dc62e1e5a832d72a","entry":"ASCCTrainer","repo":"RockyLzy/TextDefender","repo_kind":"official","path":"trainer/ascc.py","file_url":"https://github.com/RockyLzy/TextDefender/blob/HEAD/trainer/ascc.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":"dc62e1e5a832d72a"}},{"code_sha256_prefix":"54c850220fd6baa3","entry":"EmbeddingHook","repo":"RockyLzy/TextDefender","repo_kind":"official","path":"trainer/ascc.py","file_url":"https://github.com/RockyLzy/TextDefender/blob/HEAD/trainer/ascc.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":"54c850220fd6baa3"}},{"code_sha256_prefix":"780fac80a9c9ce61","entry":"EmbeddingLevelGradientTrainer","repo":"RockyLzy/TextDefender","repo_kind":"official","path":"trainer/ascc.py","file_url":"https://github.com/RockyLzy/TextDefender/blob/HEAD/trainer/ascc.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":"780fac80a9c9ce61"}},{"code_sha256_prefix":"4b67e8745a8f54ab","entry":"GradientTrainer","repo":"RockyLzy/TextDefender","repo_kind":"official","path":"trainer/ascc.py","file_url":"https://github.com/RockyLzy/TextDefender/blob/HEAD/trainer/ascc.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":"4b67e8745a8f54ab"}},{"code_sha256_prefix":"f353cbc87c6b9b65","entry":"normalize","repo":"rockylzy/textdefender","repo_kind":"official","path":"textattack/search_methods/particle_swarm_optimization.py","file_url":"https://github.com/rockylzy/textdefender/blob/HEAD/textattack/search_methods/particle_swarm_optimization.py","link_basis":"harvester_set","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":"f353cbc87c6b9b65"}},{"code_sha256_prefix":"a125d92bded563ec","entry":"register_trainer","repo":"RockyLzy/TextDefender","repo_kind":"official","path":"trainer/ascc.py","file_url":"https://github.com/RockyLzy/TextDefender/blob/HEAD/trainer/ascc.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":"a125d92bded563ec"}},{"code_sha256_prefix":"dba58334f3386aef","entry":"string_to_bool","repo":"rockylzy/textdefender","repo_kind":"official","path":"args.py","file_url":"https://github.com/rockylzy/textdefender/blob/HEAD/args.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":"dba58334f3386aef"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}