{"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/align-after-pre-train-improving-multilingual","title":"Improving In-context Learning of Multilingual Generative Language Models with Cross-lingual Alignment","arxiv_id":"2311.08089","date":"2023-11-14","proceeding":null,"authors":["Chong Li","Shaonan Wang","Jiajun Zhang","Chengqing Zong"],"abstract":"Multilingual generative models obtain remarkable cross-lingual in-context learning capabilities through pre-training on large-scale corpora. However, they still exhibit a performance bias toward high-resource languages and learn isolated distributions of multilingual sentence representations, which may hinder knowledge transfer across languages. To bridge this gap, we propose a simple yet effective cross-lingual alignment framework exploiting pairs of translation sentences. It aligns the internal sentence representations across different languages via multilingual contrastive learning and aligns outputs by following cross-lingual instructions in the target language. Experimental results show that even with less than 0.1 {\\textperthousand} of pre-training tokens, our alignment framework significantly boosts the cross-lingual abilities of generative language models and mitigates the performance gap. Further analyses reveal that it results in a better internal multilingual representation distribution of multilingual models.","url_abs":"https://arxiv.org/abs/2311.08089v2","url_pdf":"https://arxiv.org/pdf/2311.08089v2.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":"align-after-pre-train-improving-multilingual","repo_url":"https://github.com/chongli17/crosslingualalignment","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"contrastive-learning","task_name":"Contrastive Learning"},{"task_slug":"in-context-learning","task_name":"In-Context Learning"},{"task_slug":"sentence","task_name":"Sentence"},{"task_slug":"transfer-learning","task_name":"Transfer Learning"}],"methods":[{"method_slug":"contrastive-learning","method_name":"Contrastive Learning"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2311.08089","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2311.08089"}},"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/chongli17/crosslingualalignment","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":11,"unverified":1},"by_repo_kind":{"official":{"samples":12,"ran":11,"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":"72bf5e3daa978af0","entry":"add2list_p","repo":"chongli17/crosslingualalignment","repo_kind":"official","path":"src/generate_sup_data.py","file_url":"https://github.com/chongli17/crosslingualalignment/blob/HEAD/src/generate_sup_data.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":"72bf5e3daa978af0"}},{"code_sha256_prefix":"30d3b444d7a9af9f","entry":"avg_list","repo":"chongli17/crosslingualalignment","repo_kind":"official","path":"src/trainers.py","file_url":"https://github.com/chongli17/crosslingualalignment/blob/HEAD/src/trainers.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"30d3b444d7a9af9f"}},{"code_sha256_prefix":"099c24f9f0ef7fc7","entry":"batch_prompts_inference_choices","repo":"chongli17/crosslingualalignment","repo_kind":"official","path":"src/trainers.py","file_url":"https://github.com/chongli17/crosslingualalignment/blob/HEAD/src/trainers.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":"099c24f9f0ef7fc7"}},{"code_sha256_prefix":"455ae9e7f7997cfc","entry":"flatten_in","repo":"chongli17/crosslingualalignment","repo_kind":"official","path":"src/decoder_models.py","file_url":"https://github.com/chongli17/crosslingualalignment/blob/HEAD/src/decoder_models.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":"455ae9e7f7997cfc"}},{"code_sha256_prefix":"2bb8b7594e127350","entry":"get_prompt_format","repo":"chongli17/crosslingualalignment","repo_kind":"official","path":"src/trainers.py","file_url":"https://github.com/chongli17/crosslingualalignment/blob/HEAD/src/trainers.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":"2bb8b7594e127350"}},{"code_sha256_prefix":"a7bcb37f1e8879a5","entry":"get_random_item","repo":"chongli17/crosslingualalignment","repo_kind":"official","path":"src/generate_sup_data.py","file_url":"https://github.com/chongli17/crosslingualalignment/blob/HEAD/src/generate_sup_data.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a7bcb37f1e8879a5"}},{"code_sha256_prefix":"f8dc24ef54ba330b","entry":"get_random_items_no_replace","repo":"chongli17/crosslingualalignment","repo_kind":"official","path":"src/paws_x_prompt.py","file_url":"https://github.com/chongli17/crosslingualalignment/blob/HEAD/src/paws_x_prompt.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f8dc24ef54ba330b"}},{"code_sha256_prefix":"6dca7ca4ad3e5ce8","entry":"iterate_in","repo":"chongli17/crosslingualalignment","repo_kind":"official","path":"src/decoder_models.py","file_url":"https://github.com/chongli17/crosslingualalignment/blob/HEAD/src/decoder_models.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":"6dca7ca4ad3e5ce8"}},{"code_sha256_prefix":"3b1e6bd407417bb8","entry":"read_prompt","repo":"chongli17/crosslingualalignment","repo_kind":"official","path":"src/paws_x_prompt.py","file_url":"https://github.com/chongli17/crosslingualalignment/blob/HEAD/src/paws_x_prompt.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":"3b1e6bd407417bb8"}},{"code_sha256_prefix":"0eff3bae8fd00d8d","entry":"read_tsv_data","repo":"chongli17/crosslingualalignment","repo_kind":"official","path":"src/generate_sup_data.py","file_url":"https://github.com/chongli17/crosslingualalignment/blob/HEAD/src/generate_sup_data.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":"0eff3bae8fd00d8d"}},{"code_sha256_prefix":"7ec5fc874e53ea4e","entry":"read_xnli_tsv","repo":"chongli17/crosslingualalignment","repo_kind":"official","path":"src/xnli_prompt.py","file_url":"https://github.com/chongli17/crosslingualalignment/blob/HEAD/src/xnli_prompt.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":"7ec5fc874e53ea4e"}},{"code_sha256_prefix":"add1c9f6ecb908c4","entry":"cl_forward","repo":"chongli17/crosslingualalignment","repo_kind":"official","path":"src/decoder_models.py","file_url":"https://github.com/chongli17/crosslingualalignment/blob/HEAD/src/decoder_models.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":"add1c9f6ecb908c4"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}