{"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/attacking-text-classifiers-via-sentence","title":"R&R: Metric-guided Adversarial Sentence Generation","arxiv_id":"2104.08453","date":"2021-04-17","proceeding":null,"authors":["Lei Xu","Alfredo Cuesta-Infante","Laure Berti-Equille","Kalyan Veeramachaneni"],"abstract":"Adversarial examples are helpful for analyzing and improving the robustness of text classifiers. Generating high-quality adversarial examples is a challenging task as it requires generating fluent adversarial sentences that are semantically similar to the original sentences and preserve the original labels, while causing the classifier to misclassify them. Existing methods prioritize misclassification by maximizing each perturbation's effectiveness at misleading a text classifier; thus, the generated adversarial examples fall short in terms of fluency and similarity. In this paper, we propose a rewrite and rollback (R&R) framework for adversarial attack. It improves the quality of adversarial examples by optimizing a critique score which combines the fluency, similarity, and misclassification metrics. R&R generates high-quality adversarial examples by allowing exploration of perturbations that do not have immediate impact on the misclassification metric but can improve fluency and similarity metrics. We evaluate our method on 5 representative datasets and 3 classifier architectures. Our method outperforms current state-of-the-art in attack success rate by +16.2%, +12.8%, and +14.0% on the classifiers respectively. Code is available at https://github.com/DAI-Lab/fibber","url_abs":"https://arxiv.org/abs/2104.08453v3","url_pdf":"https://arxiv.org/pdf/2104.08453v3.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":"attacking-text-classifiers-via-sentence","repo_url":"https://github.com/DAI-Lab/fibber","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"tf","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"adversarial-attack","task_name":"Adversarial Attack"},{"task_slug":"classification","task_name":"General Classification"},{"task_slug":"semantic-similarity","task_name":"Semantic Similarity"},{"task_slug":"semantic-textual-similarity","task_name":"Semantic Textual Similarity"},{"task_slug":"sentence","task_name":"Sentence"},{"task_slug":"sentence-rewriting","task_name":"Sentence ReWriting"},{"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=2104.08453","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2104.08453"}},"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/DAI-Lab/fibber","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":"e30cd903b99a9c16","entry":"check_file_md5","repo":"DAI-Lab/fibber","repo_kind":"official","path":"fibber/download_utils.py","file_url":"https://github.com/DAI-Lab/fibber/blob/HEAD/fibber/download_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":"e30cd903b99a9c16"}},{"code_sha256_prefix":"ebf311a4c4bc53de","entry":"convert_to_data_list","repo":"DAI-Lab/fibber","repo_kind":"official","path":"fibber/datasets/process_dataset.py","file_url":"https://github.com/DAI-Lab/fibber/blob/HEAD/fibber/datasets/process_dataset.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":"ebf311a4c4bc53de"}},{"code_sha256_prefix":"bc90593e7f7c141c","entry":"reorder_columns","repo":"DAI-Lab/fibber","repo_kind":"official","path":"fibber/benchmark/benchmark_utils.py","file_url":"https://github.com/DAI-Lab/fibber/blob/HEAD/fibber/benchmark/benchmark_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":"bc90593e7f7c141c"}},{"code_sha256_prefix":"0e00c66a59122b8e","entry":"setup_custom_logger","repo":"DAI-Lab/fibber","repo_kind":"official","path":"fibber/log.py","file_url":"https://github.com/DAI-Lab/fibber/blob/HEAD/fibber/log.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":"0e00c66a59122b8e"}},{"code_sha256_prefix":"6c6a9fdb373fe331","entry":"subsample_dataset","repo":"DAI-Lab/fibber","repo_kind":"official","path":"fibber/datasets/dataset_utils.py","file_url":"https://github.com/DAI-Lab/fibber/blob/HEAD/fibber/datasets/dataset_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":"6c6a9fdb373fe331"}},{"code_sha256_prefix":"7aa4f20ffb669b0a","entry":"text_md5","repo":"DAI-Lab/fibber","repo_kind":"official","path":"fibber/datasets/dataset_utils.py","file_url":"https://github.com/DAI-Lab/fibber/blob/HEAD/fibber/datasets/dataset_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":"7aa4f20ffb669b0a"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}