NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

HumanEval-XL: A Multilingual Code Generation Benchmark for Cross-lingual Natural Language Generalization

Qiwei Peng, Yekun Chai, Xuhong Li

Abstract

Large language models (LLMs) have made significant progress in generating codes from textual prompts. However, existing benchmarks have mainly concentrated on translating English prompts to multilingual codes or have been constrained to very limited natural languages (NLs). These benchmarks have overlooked the vast landscape of massively multilingual NL to multilingual code, leaving a critical gap in the evaluation of multilingual LLMs. In response, we introduce HumanEval-XL, a massively multilingual code generation benchmark specifically crafted to address this deficiency. HumanEval-XL establishes connections between 23 NLs and 12 programming languages (PLs), and comprises of a collection of 22,080 prompts with an average of 8.33 test cases. By ensuring parallel data across multiple NLs and PLs, HumanEval-XL offers a comprehensive evaluation platform for multilingual LLMs, allowing the assessment of the understanding of different NLs. Our work serves as a pioneering step towards filling the void in evaluating NL generalization in the area of multilingual code generation.

Introduction

While large language models excel at generating code from English prompts, their ability to understand coding instructions in other natural languages remains under-evaluated. Most existing benchmarks, such as HumanEval or MBPP, heavily index on English prompts and Python code. This leaves a significant gap: if a developer prompts an LLM in Turkish or Vietnamese to write a Java function, how well does the model understand the intent compared to an English prompt? HumanEval-XL addresses this by providing a comprehensive, parallel benchmark to rigorously assess the cross-lingual generalization capabilities of code-generating LLMs.

Methodology

To build the benchmark without manually rewriting thousands of prompts, the authors designed an iterative, LLM-assisted translation pipeline focused on semantic fidelity.

The four-stage pipeline for generating the HumanEval-XL benchmark, including extraction, translation, BERTScore-based quality checks, and final filtering.

The pipeline consists of four main stages:

  1. Extraction: Isolating the English natural language prompt from the base Multilingual HumanEval dataset.
  2. Translation & Back-Translation: Using GPT-4 to translate the prompt into 23 different NLs, followed by an immediate back-translation to English.
  3. Automated Quality Check: Computing the BERTScore between the original English prompt and the back-translated version. If the similarity score falls below 0.95, the prompt is rejected and re-translated.
  4. Manual Quality Control: Applying heuristic checks and manual sampling to ensure final translation fidelity.

Dataset Overview

HumanEval-XL contains 80 parallel coding problems translated across 23 Natural Languages (including Arabic, Chinese, French, Russian, Tagalog, and more) and 12 Programming Languages (Python, Java, Go, Kotlin, PHP, Ruby, Scala, JavaScript, C#, Perl, Swift, TypeScript). This creates a massive evaluation grid of 22,080 coding prompts, each supported by an average of 8.33 test cases. Unlike previous benchmarks like ODEX, which only cover a few NLs and one PL, HumanEval-XL provides fully parallel support across both spoken and programming languages.

Key Results and Insights

Evaluation of several LLM families—including CodeT5+, CodeGen2, GPT-3.5, and GPT-4—revealed several critical findings regarding cross-lingual performance.

Comprehensive pass@1 results for various LLMs across 12 programming languages and 23 natural languages, illustrating the performance gap between models and languages.
  • GPT-4 Dominance: GPT-4 consistently achieved the highest pass@1 scores across almost all PLs and NLs, significantly outperforming other models.
  • The Semantic Gap: Despite receiving prompts with identical semantic meaning, LLMs showed vastly different success rates across different natural languages. This suggests that models have not yet achieved true language-agnostic semantic understanding.
  • Resource Disparity: Performance drops noticeably for lower-resource languages. For example, GPT-4 scores ~78.5% on high-resource languages in Python but drops to ~77.6% for lower-resource languages like Turkish or Indonesian.
  • Language Family Bias: Prompts in Afro-Asiatic, Turkic, and certain Indo-European languages (Greek/Iranian) generally yielded lower pass rates compared to Germanic or Romance languages.
  • PL Difficulty: Python was universally the easiest programming language for the models to generate, while Scala and Go proved to be the most difficult.

Conclusion

HumanEval-XL highlights a persistent cross-lingual semantic gap in current LLMs. While scaling model size improves performance across all languages, the relative gaps between high- and low-resource languages remain. Future research should focus on improving the alignment of low-resource natural languages with programming languages during pre-training or instruction tuning to ensure equitable performance across the global developer community.

Summary updated

BibTeX
@inproceedings{peng2024humaneval,
  author = {Qiwei Peng and Yekun Chai and Xuhong Li},
  title = {{HumanEval-XL: A Multilingual Code Generation Benchmark for Cross-lingual Natural Language Generalization}},
  booktitle = {International Conference on Computational Linguistics},
  year = {2024},
  url = {https://openreview.net/forum?id=VfK1QDZ2V5},
}
Figure