TL;DR
McEval is a new, massive benchmark for Large Language Models (LLMs) that spans 40 programming languages with over 16,000 human-curated test samples. By moving beyond Python-centric evaluations and introducing a novel cross-lingual instruction-tuning approach, researchers have created a more realistic "stress test" for code models, revealing a significant performance gap between open-source models and closed-source giants like GPT-4o.
What Problem Does This Paper Address?
Most current code LLMs are evaluated on a very narrow slice of the programming world. Popular benchmarks like HumanEval and MBPP are almost entirely focused on Python. While some multilingual benchmarks exist (like MultiPL-E), they often rely on translating Python problems into other languages. This "translation-first" approach is problematic because it ignores the unique idioms, libraries, and paradigms of other languages—like the functional quirks of Haskell or the systems-level constraints of Rust.
Furthermore, most models are instruction-tuned primarily on English and Python data. This leads to a "multilingual tax" where a model might be a genius at writing Python but fails to follow basic instructions when asked to write Fortran or Lua. The community lacked a diverse, human-written, execution-based benchmark to measure how well models actually understand the "long tail" of programming languages.
Methods
The authors introduced a comprehensive framework to tackle these issues, encompassing a new benchmark, a novel instruction-tuning dataset, and a fine-tuned model.
- McEval Benchmark: Unlike previous datasets, McEval features 16,031 samples across 40 languages, including many "low-resource" ones. It covers three distinct tasks: Code Generation (writing from a prompt), Code Completion (filling in missing lines or spans), and Code Explanation (describing what code does).
- Cross-lingual Code Transfer: To build their instruction dataset (McEval-Instruct), the authors used a clever technique. They took high-quality code snippets from one language and tasked an LLM to adapt the logic into a different language while increasing the complexity. This ensures that the instruction-tuning data isn't just a repetitive translation but a diverse set of unique problems.
- mCoder: To prove the value of their data, they trained mCoder, a series of models fine-tuned on McEval-Instruct. They used a standard Supervised Fine-Tuning (SFT) approach but focused on the multilingual diversity of the input.
- Two-Pass Evaluation for Explanation: To evaluate "Code Explanation" (which is usually hard to grade), they used a "Code-to-NL-to-Code" method. The model explains the code in English, and then that explanation is used to try and reconstruct the original code. If the reconstructed code passes the original test cases, the explanation is deemed successful.
Datasets
- McEval: The core benchmark. 40 languages, 16k samples. It includes everything from giants like Java and C++ to niche or older languages like AWK, Fortran, and Lisp.
- McEval-Instruct: A massive instruction-tuning corpus containing 110,000 samples. 50k of these are Python-based, while the rest are distributed across the other 39 languages to facilitate cross-lingual learning.
Key Insights and Ideas
- The "Instruction Gap": One of the most interesting findings is that many open-source models actually have the knowledge of obscure languages but lack the instruction-following ability to use them. Fine-tuning on a small amount of diverse language data (via McEval-Instruct) significantly boosted performance in low-resource languages.
- Paradigm Matters: Models generally perform better in Object-Oriented and Multi-paradigm languages (which are high-resource) and struggle significantly with Functional (Haskell, Scheme) and Procedural languages.
- Diversity > Translation: By using human-written samples and cross-lingual transfer rather than simple translation, the benchmark reveals weaknesses that Python-centric benchmarks miss. For example, models often struggle with the complex structure of markup languages like JSON and Markdown when asked to explain them.
Key Results
- The Dominance of Closed-Source: GPT-4o and GPT-4 Turbo are the undisputed leaders, often outperforming the best open-source models by a wide margin (e.g., GPT-4o achieving a 65.2% average Pass@1 across all languages).
- Open-Source Contenders: DeepSeekCoder-V2 and CodeQwen-1.5 emerged as the strongest open-source baselines, performing admirably in high-resource languages but trailing in the more obscure ones.
- mCoder's Success: The authors' mCoder-7B (fine-tuned on McEval-Instruct) showed clear improvements over its base models. It demonstrated that even a relatively small model can become much more proficient across 40 languages if given the right variety of instruction data.
- Difficulty Scaling: As expected, performance drops sharply as problem difficulty moves from "Easy" to "Hard," but the drop is much more pronounced for open-source models than for the GPT series.
Limitations and Future Work
- Language Coverage: While 40 languages is a massive step forward, there are hundreds of programming languages in use. The authors aim to expand this range further.
- Task Diversity: The current benchmark focuses on generation, completion, and explanation. Future versions could include debugging, optimization, or security vulnerability detection.
- Scaling Laws: The paper doesn't deeply explore the scaling laws of cross-lingual transfer—specifically, exactly how much data from Language A is needed to improve Language B.
- Human Evaluation: While the benchmark is execution-based, the "Explanation" task still relies on a proxy (reconstruction). Direct human evaluation of explanations remains the gold standard but is difficult to scale.
Summary updated