{"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/mitigating-the-language-mismatch-and","title":"Mitigating the Language Mismatch and Repetition Issues in LLM-based Machine Translation via Model Editing","arxiv_id":"2410.07054","date":"2024-10-09","proceeding":null,"authors":["Weichuan Wang","Zhaoyi Li","Defu Lian","Chen Ma","Linqi Song","Ying WEI"],"abstract":"Large Language Models (LLMs) have recently revolutionized the NLP field, while they still fall short in some specific down-stream tasks. In the work, we focus on utilizing LLMs to perform machine translation, where we observe that two patterns of errors frequently occur and drastically affect the translation quality: language mismatch and repetition. The work sets out to explore the potential for mitigating these two issues by leveraging model editing methods, e.g., by locating Feed-Forward Network (FFN) neurons or something that are responsible for the errors and deactivating them in the inference time. We find that directly applying such methods either limited effect on the targeted errors or has significant negative side-effect on the general translation quality, indicating that the located components may also be crucial for ensuring machine translation with LLMs on the rails. To this end, we propose to refine the located components by fetching the intersection of the locating results under different language settings, filtering out the aforementioned information that is irrelevant to targeted errors. The experiment results empirically demonstrate that our methods can effectively reduce the language mismatch and repetition ratios and meanwhile enhance or keep the general translation quality in most cases.","url_abs":"https://arxiv.org/abs/2410.07054v1","url_pdf":"https://arxiv.org/pdf/2410.07054v1.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":"mitigating-the-language-mismatch-and","repo_url":"https://github.com/weichuanw/llm-based-mt-via-model-editing","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"machine-translation","task_name":"Machine Translation"},{"task_slug":"model-editing","task_name":"Model Editing"},{"task_slug":"translation","task_name":"Translation"}],"methods":[{"method_slug":"focus","method_name":"Focus"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2410.07054","atlas_url":"https://app.syntology.ai/?focus=2410.07054","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2410.07054"}},"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/weichuanw/llm-based-mt-via-model-editing","reach":{"status":"ok"}}],"summary":{"ran":12,"ran_draft_wrong":1,"unverified":4},"by_repo_kind":{"official":{"samples":17,"ran":13,"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":17,"samples":[{"code_sha256_prefix":"722313ab50fd2d34","entry":"add_function_vector","repo":"weichuanw/llm-based-mt-via-model-editing","repo_kind":"official","path":"Model_Editing_Adaptation/fv_task_adaptation/src/utils/intervention_utils.py","file_url":"https://github.com/weichuanw/llm-based-mt-via-model-editing/blob/HEAD/Model_Editing_Adaptation/fv_task_adaptation/src/utils/intervention_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"722313ab50fd2d34"}},{"code_sha256_prefix":"7a8316d866693800","entry":"batch_token_account","repo":"weichuanw/llm-based-mt-via-model-editing","repo_kind":"official","path":"Support_Utils/model_inner_extraction.py","file_url":"https://github.com/weichuanw/llm-based-mt-via-model-editing/blob/HEAD/Support_Utils/model_inner_extraction.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"7a8316d866693800"}},{"code_sha256_prefix":"a9853ae06ebc5529","entry":"compute_best_token_rank","repo":"weichuanw/llm-based-mt-via-model-editing","repo_kind":"official","path":"Model_Editing_Adaptation/fv_task_adaptation/src/utils/eval_utils.py","file_url":"https://github.com/weichuanw/llm-based-mt-via-model-editing/blob/HEAD/Model_Editing_Adaptation/fv_task_adaptation/src/utils/eval_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"a9853ae06ebc5529"}},{"code_sha256_prefix":"06461c0c4a4708ce","entry":"compute_individual_token_rank","repo":"weichuanw/llm-based-mt-via-model-editing","repo_kind":"official","path":"Model_Editing_Adaptation/fv_task_adaptation/src/utils/eval_utils.py","file_url":"https://github.com/weichuanw/llm-based-mt-via-model-editing/blob/HEAD/Model_Editing_Adaptation/fv_task_adaptation/src/utils/eval_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"06461c0c4a4708ce"}},{"code_sha256_prefix":"6351069e7766eb7a","entry":"compute_top_k_accuracy","repo":"weichuanw/llm-based-mt-via-model-editing","repo_kind":"official","path":"Model_Editing_Adaptation/fv_task_adaptation/src/utils/eval_utils.py","file_url":"https://github.com/weichuanw/llm-based-mt-via-model-editing/blob/HEAD/Model_Editing_Adaptation/fv_task_adaptation/src/utils/eval_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"6351069e7766eb7a"}},{"code_sha256_prefix":"4096df2df6445be6","entry":"create_fewshot_primer","repo":"weichuanw/llm-based-mt-via-model-editing","repo_kind":"official","path":"Model_Editing_Adaptation/fv_task_adaptation/src/utils/prompt_utils.py","file_url":"https://github.com/weichuanw/llm-based-mt-via-model-editing/blob/HEAD/Model_Editing_Adaptation/fv_task_adaptation/src/utils/prompt_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"4096df2df6445be6"}},{"code_sha256_prefix":"ec0d04fa7b78facd","entry":"create_partial_fewshot_primer","repo":"weichuanw/llm-based-mt-via-model-editing","repo_kind":"official","path":"Model_Editing_Adaptation/fv_task_adaptation/src/utils/prompt_utils.py","file_url":"https://github.com/weichuanw/llm-based-mt-via-model-editing/blob/HEAD/Model_Editing_Adaptation/fv_task_adaptation/src/utils/prompt_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ec0d04fa7b78facd"}},{"code_sha256_prefix":"5daf29ec78f21d13","entry":"create_prompt","repo":"weichuanw/llm-based-mt-via-model-editing","repo_kind":"official","path":"Model_Editing_Adaptation/fv_task_adaptation/src/utils/prompt_utils.py","file_url":"https://github.com/weichuanw/llm-based-mt-via-model-editing/blob/HEAD/Model_Editing_Adaptation/fv_task_adaptation/src/utils/prompt_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"5daf29ec78f21d13"}},{"code_sha256_prefix":"8953f9ef90cf6afd","entry":"get_module","repo":"weichuanw/llm-based-mt-via-model-editing","repo_kind":"official","path":"Model_Editing_Adaptation/fv_task_adaptation/src/utils/intervention_utils.py","file_url":"https://github.com/weichuanw/llm-based-mt-via-model-editing/blob/HEAD/Model_Editing_Adaptation/fv_task_adaptation/src/utils/intervention_utils.py","link_basis":"harvester_set","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":"8953f9ef90cf6afd"}},{"code_sha256_prefix":"eb98fe7a8942206d","entry":"inter_output_vector","repo":"weichuanw/llm-based-mt-via-model-editing","repo_kind":"official","path":"Support_Utils/model_inner_intervention.py","file_url":"https://github.com/weichuanw/llm-based-mt-via-model-editing/blob/HEAD/Support_Utils/model_inner_intervention.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"eb98fe7a8942206d"}},{"code_sha256_prefix":"582681dd786a9140","entry":"remove_tensor_elements","repo":"weichuanw/llm-based-mt-via-model-editing","repo_kind":"official","path":"Model_Editing_Adaptation/KN_Error_Extraction.py","file_url":"https://github.com/weichuanw/llm-based-mt-via-model-editing/blob/HEAD/Model_Editing_Adaptation/KN_Error_Extraction.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"582681dd786a9140"}},{"code_sha256_prefix":"7b3b641df5d1d225","entry":"scaled_input","repo":"weichuanw/llm-based-mt-via-model-editing","repo_kind":"official","path":"Support_Utils/model_IG_compute.py","file_url":"https://github.com/weichuanw/llm-based-mt-via-model-editing/blob/HEAD/Support_Utils/model_IG_compute.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"7b3b641df5d1d225"}},{"code_sha256_prefix":"37b8bf35aa127ee5","entry":"top_k_elements","repo":"weichuanw/llm-based-mt-via-model-editing","repo_kind":"official","path":"Support_Utils/model_IG_compute.py","file_url":"https://github.com/weichuanw/llm-based-mt-via-model-editing/blob/HEAD/Support_Utils/model_IG_compute.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"37b8bf35aa127ee5"}},{"code_sha256_prefix":"8079a3674f90f335","entry":"batch_token_indices_selection","repo":"weichuanw/llm-based-mt-via-model-editing","repo_kind":"official","path":"Support_Utils/model_inner_extraction.py","file_url":"https://github.com/weichuanw/llm-based-mt-via-model-editing/blob/HEAD/Support_Utils/model_inner_extraction.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"8079a3674f90f335"}},{"code_sha256_prefix":"4436a1b19f702127","entry":"error_prompt_pairs","repo":"weichuanw/llm-based-mt-via-model-editing","repo_kind":"official","path":"Model_Editing_Adaptation/KN_Error_Extraction.py","file_url":"https://github.com/weichuanw/llm-based-mt-via-model-editing/blob/HEAD/Model_Editing_Adaptation/KN_Error_Extraction.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"4436a1b19f702127"}},{"code_sha256_prefix":"96d96c981da2e3cb","entry":"load_gpt_model_and_tokenizer","repo":"weichuanw/llm-based-mt-via-model-editing","repo_kind":"official","path":"Model_Editing_Adaptation/fv_task_adaptation/src/utils/model_utils.py","file_url":"https://github.com/weichuanw/llm-based-mt-via-model-editing/blob/HEAD/Model_Editing_Adaptation/fv_task_adaptation/src/utils/model_utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"96d96c981da2e3cb"}},{"code_sha256_prefix":"d1a0863f570b64cc","entry":"task_prompt_construct","repo":"weichuanw/llm-based-mt-via-model-editing","repo_kind":"official","path":"Model_Editing_Adaptation/KN_Task_Extraction.py","file_url":"https://github.com/weichuanw/llm-based-mt-via-model-editing/blob/HEAD/Model_Editing_Adaptation/KN_Task_Extraction.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d1a0863f570b64cc"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}