Exploring Multi-Lingual Bias of Large Code Models in Code Generation
Top Cited Papers
Open Access
- 3 January 2026
- journal article
- Published by Association for Computing Machinery (ACM) in ACM Transactions on Software Engineering and Methodology
- Vol. 35 (8) , 1-25
Abstract
Code generation aims to synthesize code and fulfill functional requirements based on natural language (NL) specifications, which can greatly improve development efficiency. In the era of large language models (LLMs), large code models (LCMs) have been recently proposed to generate source code. LCMs can generate highly feasible solutions for programming problems described in natural language. Despite the effectiveness, we observe a noticeable multilingual bias in the generation performance of LCMs. Specifically, LCMs demonstrate proficiency in generating solutions when provided with instructions in English, yet may falter when faced with semantically equivalent instructions in other NLs such as Chinese. Moreover, the ability of LCMs to generate code exhibits variety across different programming languages (PLs), such as Python and C++. The observed phenomenon indicates the presence of multi-lingual bias within the generative capabilities of LCMs, which has remained unexplored. In this paper, we aim to investigate the multi-lingual bias that exists in current LCMs. First, we initiate our investigation by constructing the first multi-lingual evaluation benchmark X-HumanEval-X , enabling us to systematically evaluate the extent of multi-lingual bias that exists in current LCMs. In our large-scale experiments on nine popular LCMs, we observe a pronounced multi-lingual bias of LCMs in code generation, including multi-NL and multi-PL bias. Specifically, when using Chinese instructions, the code generation capabilities of LCMs decrease by at least 13% in terms of the Pass@1 metric. Furthermore, LCMs perform variously across different programming languages, e.g., the performance gap between Python and C++ reaches as high as 20.9%. Then we explore the bias in the prompting phase and find that prompting LCMs through one-step and multi-step translation aids in mitigating such bias. We further explore the impact of instruction tuning based on a self-constructed multi-lingual dataset Multi-EvolInstruct-Code (MEIC) that contains two natural languages (i.e., English and Chinese) and more than twenty programming languages. Experiments on the nine popular LCMs demonstrate that the instruction tuning substantially reduces the multi-lingual bias (e.g., decreasing the multi-NL bias and multi-PL bias by up to 84% and 40%, respectively), while enhancing the efficacy of LCMs in code generation (e.g., increasing the Pass@1 metric by 31% \(\sim\) 46%). We finally provide insights and implications for researchers and developers aimed at mitigating the multi-lingual bias and improving the code generation capabilities of LCMs.
Keywords
All Related Versions
Funding Information
- National Natural Science Foundation of China (No. 62472126)
- Shenzhen-Hong Kong Jointly Funded Project (Category A, NOSGDX20230116 091246007)
- Research Grants Council of the Hong Kong Special Administrative Region, China (No. SRFS2425-4S03)
This publication has 27 references indexed in Scilit:
- How Practitioners Expect Code Completion?2023
- Protecting Intellectual Property of Large Language Model-Based Code Generation APIs via Watermarks2023
- Efficient Memory Management for Large Language Model Serving with PagedAttention2023
- CodeGeeX: A Pre-Trained Model for Code Generation with Multilingual Benchmarking on HumanEval-X2023
- CCTEST: Testing and Repairing Code Completion Systems2023
- Two Sides of the Same Coin: Exploiting the Impact of Identifiers in Neural Code Comprehension2023
- MultiPL-E: A Scalable and Polyglot Approach to Benchmarking Neural Code GenerationIEEE Transactions on Software Engineering, 2023
- No more fine-tuning? an experimental evaluation of prompt tuning in code intelligence2022
- Unleashing the power of compiler intermediate representation to enhance neural program embeddings2022
- ZeRO: Memory optimizations Toward Training Trillion Parameter Models2020