{"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/targeted-adversarial-attacks-against-neural-1","title":"Targeted Adversarial Attacks against Neural Machine Translation","arxiv_id":"2303.01068","date":"2023-03-02","proceeding":null,"authors":["Sahar Sadrizadeh","AmirHossein Dabiri Aghdam","Ljiljana Dolamic","Pascal Frossard"],"abstract":"Neural Machine Translation (NMT) systems are used in various applications. However, it has been shown that they are vulnerable to very small perturbations of their inputs, known as adversarial attacks. In this paper, we propose a new targeted adversarial attack against NMT models. In particular, our goal is to insert a predefined target keyword into the translation of the adversarial sentence while maintaining similarity between the original sentence and the perturbed one in the source domain. To this aim, we propose an optimization problem, including an adversarial loss term and a similarity term. We use gradient projection in the embedding space to craft an adversarial sentence. Experimental results show that our attack outperforms Seq2Sick, the other targeted adversarial attack against NMT models, in terms of success rate and decrease in translation quality. Our attack succeeds in inserting a keyword into the translation for more than 75% of sentences while similarity with the original sentence stays preserved.","url_abs":"https://arxiv.org/abs/2303.01068v1","url_pdf":"https://arxiv.org/pdf/2303.01068v1.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":"targeted-adversarial-attacks-against-neural-1","repo_url":"https://github.com/sssadrizadeh/nmt-targeted-attack","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"adversarial-attack","task_name":"Adversarial Attack"},{"task_slug":"machine-translation","task_name":"Machine Translation"},{"task_slug":"nmt","task_name":"NMT"},{"task_slug":"sentence","task_name":"Sentence"},{"task_slug":"translation","task_name":"Translation"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2303.01068","atlas_url":"https://app.syntology.ai/?focus=2303.01068","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2303.01068"}},"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/sssadrizadeh/nmt-targeted-attack","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran":5,"unverified":1},"by_repo_kind":{"official":{"samples":6,"ran":5,"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":"ac625442d3f99225","entry":"attack_successful1","repo":"sssadrizadeh/nmt-targeted-attack","repo_kind":"official","path":"utils/attack.py","file_url":"https://github.com/sssadrizadeh/nmt-targeted-attack/blob/HEAD/utils/attack.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"ac625442d3f99225"}},{"code_sha256_prefix":"cb602a7f8b7ad741","entry":"character_difference","repo":"sssadrizadeh/nmt-targeted-attack","repo_kind":"official","path":"utils/attack.py","file_url":"https://github.com/sssadrizadeh/nmt-targeted-attack/blob/HEAD/utils/attack.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"cb602a7f8b7ad741"}},{"code_sha256_prefix":"de134be9694edba4","entry":"decode","repo":"sssadrizadeh/nmt-targeted-attack","repo_kind":"official","path":"utils/attack.py","file_url":"https://github.com/sssadrizadeh/nmt-targeted-attack/blob/HEAD/utils/attack.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"de134be9694edba4"}},{"code_sha256_prefix":"68e176862e9b8063","entry":"get_ids_adv_text","repo":"sssadrizadeh/nmt-targeted-attack","repo_kind":"official","path":"utils/load.py","file_url":"https://github.com/sssadrizadeh/nmt-targeted-attack/blob/HEAD/utils/load.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"68e176862e9b8063"}},{"code_sha256_prefix":"1f49576cf51b9a0c","entry":"load_tokenized_dataset","repo":"sssadrizadeh/nmt-targeted-attack","repo_kind":"official","path":"utils/load.py","file_url":"https://github.com/sssadrizadeh/nmt-targeted-attack/blob/HEAD/utils/load.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"1f49576cf51b9a0c"}},{"code_sha256_prefix":"5df6ce544b663688","entry":"preprocess_function","repo":"sssadrizadeh/nmt-targeted-attack","repo_kind":"official","path":"utils/load.py","file_url":"https://github.com/sssadrizadeh/nmt-targeted-attack/blob/HEAD/utils/load.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"5df6ce544b663688"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}