{"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/towards-opening-the-black-box-of-neural","title":"Towards Opening the Black Box of Neural Machine Translation: Source and Target Interpretations of the Transformer","arxiv_id":"2205.11631","date":"2022-05-23","proceeding":null,"authors":["Javier Ferrando","Gerard I. Gállego","Belen Alastruey","Carlos Escolano","Marta R. Costa-jussà"],"abstract":"In Neural Machine Translation (NMT), each token prediction is conditioned on the source sentence and the target prefix (what has been previously translated at a decoding step). However, previous work on interpretability in NMT has mainly focused solely on source sentence tokens' attributions. Therefore, we lack a full understanding of the influences of every input token (source sentence and target prefix) in the model predictions. In this work, we propose an interpretability method that tracks input tokens' attributions for both contexts. Our method, which can be extended to any encoder-decoder Transformer-based model, allows us to better comprehend the inner workings of current NMT models. We apply the proposed method to both bilingual and multilingual Transformers and present insights into their behaviour.","url_abs":"https://arxiv.org/abs/2205.11631v2","url_pdf":"https://arxiv.org/pdf/2205.11631v2.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":"towards-opening-the-black-box-of-neural","repo_url":"https://github.com/mt-upc/transformer-contributions-nmt","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"decoder","task_name":"Decoder"},{"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/2205.11631","atlas_url":"https://app.syntology.ai/?focus=2205.11631","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2205.11631"}},"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/mt-upc/transformer-contributions-nmt","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran":7,"ran_fixture":1},"by_repo_kind":{"official":{"samples":8,"ran":8,"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":"b0fe901062fe44a7","entry":"contrib_tok2words","repo":"mt-upc/transformer-contributions-nmt","repo_kind":"official","path":"alignment/align.py","file_url":"https://github.com/mt-upc/transformer-contributions-nmt/blob/HEAD/alignment/align.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":"b0fe901062fe44a7"}},{"code_sha256_prefix":"ccfc9acc2f460939","entry":"contrib_tok2words_partial","repo":"mt-upc/transformer-contributions-nmt","repo_kind":"official","path":"alignment/align.py","file_url":"https://github.com/mt-upc/transformer-contributions-nmt/blob/HEAD/alignment/align.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":"ccfc9acc2f460939"}},{"code_sha256_prefix":"ee46b90a0484d484","entry":"contribution_source","repo":"mt-upc/transformer-contributions-nmt","repo_kind":"official","path":"wrappers/helper.py","file_url":"https://github.com/mt-upc/transformer-contributions-nmt/blob/HEAD/wrappers/helper.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"ee46b90a0484d484"}},{"code_sha256_prefix":"b6c6b6eaf480d4b6","entry":"get_greedy_decoding","repo":"mt-upc/transformer-contributions-nmt","repo_kind":"official","path":"wrappers/helper.py","file_url":"https://github.com/mt-upc/transformer-contributions-nmt/blob/HEAD/wrappers/helper.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":"b6c6b6eaf480d4b6"}},{"code_sha256_prefix":"83bb8ecb1a22ea52","entry":"get_normalized_rank","repo":"mt-upc/transformer-contributions-nmt","repo_kind":"official","path":"wrappers/utils.py","file_url":"https://github.com/mt-upc/transformer-contributions-nmt/blob/HEAD/wrappers/utils.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":"83bb8ecb1a22ea52"}},{"code_sha256_prefix":"fa9a832d249635ca","entry":"get_translation","repo":"mt-upc/transformer-contributions-nmt","repo_kind":"official","path":"wrappers/helper.py","file_url":"https://github.com/mt-upc/transformer-contributions-nmt/blob/HEAD/wrappers/helper.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":"fa9a832d249635ca"}},{"code_sha256_prefix":"4c5f47f52afaaae6","entry":"get_word_word_attention","repo":"mt-upc/transformer-contributions-nmt","repo_kind":"official","path":"alignment/align.py","file_url":"https://github.com/mt-upc/transformer-contributions-nmt/blob/HEAD/alignment/align.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":"4c5f47f52afaaae6"}},{"code_sha256_prefix":"1b48822629bead35","entry":"spearmanr","repo":"mt-upc/transformer-contributions-nmt","repo_kind":"official","path":"wrappers/utils.py","file_url":"https://github.com/mt-upc/transformer-contributions-nmt/blob/HEAD/wrappers/utils.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":"1b48822629bead35"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}