CRUXEVAL-X: A Benchmark for Multilingual Code Reasoning, Understanding and Execution

Ruiyang Xu, Jialun Cao, Yaojie Lu, Ming Wen, Hongyu Lin, Xianpei Han, Ben He, Shing-Chi Cheung, Le Sun

Abstract

CRUXEVAL-X is a comprehensive multilingual benchmark designed to evaluate the code reasoning capabilities of Large Language Models (LLMs) across 19 programming languages. Unlike traditional benchmarks that focus primarily on code generation in Python, CRUXEVAL-X emphasizes "mental execution"—the ability to predict program inputs and outputs. By utilizing an automated translation and repair pipeline, the researchers demonstrate that LLMs possess significant cross-lingual reasoning capabilities, often generalizing logic from Python to languages with diverse syntaxes and type systems.

Introduction: Addressing Bias in Code Evaluation

Current evaluations of LLMs in the coding domain face two primary challenges: programming language bias and task bias. Over 95% of existing benchmarks are centered on Python, leaving a significant gap in understanding model performance for languages like Java, C++, or Rust. Furthermore, most benchmarks evaluate code generation (writing code from natural language) rather than code reasoning (understanding and executing code logic). CRUXEVAL-X addresses these gaps by providing a massive, content-consistent dataset for testing execution logic across 19 languages, including C++, Java, Rust, Go, TypeScript, and Racket.

Methods: The Automated Translation Pipeline

To scale the original Python-only CRUXEVAL benchmark, the authors developed a robust, test-guided pipeline. This process ensures that the logical core of each test case remains consistent across translations.

The CRUXEVAL-X automated translation pipeline, featuring function signature translation, test suite mapping, and iterative repair.

The pipeline consists of three critical stages:

  1. Function Signature Translation: Since Python is dynamically typed, the system uses syntax trees and test cases to infer types and generate correct function signatures for statically typed languages (like C++ or Java).
  2. Test Suite Translation: Python test cases are mapped to target languages using specific transition rules to handle structured types like Lists and Dictionaries.
  3. Iterative Generation & Repair: The core of the pipeline uses a "multi-round generation and repair" strategy. LLMs attempt to translate the code; if the translation fails execution tests, the model is provided with the error message and asked to repair the code.

Key Insights and Results

The benchmark revealed several surprising aspects of LLM behavior. Most notably, models exhibit strong cross-language generalization. Reasoning appears to be a high-level skill that transfers across different syntaxes. For instance, the phi-1 model, despite being trained primarily on Python, showed unexpected zero-shot transfer capabilities to languages like Perl.

Input and Output reasoning performance across various languages for the phi-1 and phi-1.5 models.

Performance analysis showed that GPT-4o leads the field with approximately 70% Pass@1, while open-source models like DeepSeekCoder-V2 provide competitive alternatives, outperforming GPT-4o-mini. Interestingly, the complexity of a task (input length and variable count) proved to be a more significant predictor of model failure than the specific type system of the language. Furthermore, languages with high syntactic similarity (e.g., JavaScript and TypeScript) showed high performance correlation, while functional languages like Racket presented unique challenges.

Conclusion and Future Work

CRUXEVAL-X demonstrates that code reasoning is a high-level skill in LLMs that transcends specific programming syntax. The findings suggest that being proficient at writing code does not always equate to a deep understanding of its execution logic. Future research will likely focus on expanding the benchmark to include more complex, multi-file projects and exploring how fine-tuning on diverse reasoning tasks can further improve a model's "mental execution" capabilities.

Summary updated

BibTeX
@inproceedings{xu2025cruxeval,
  author = {Ruiyang Xu and Jialun Cao and Yaojie Lu and Ming Wen and Hongyu Lin and Xianpei Han and Ben He and Shing-Chi Cheung and Le Sun},
  title = {{CRUXEVAL-X: A Benchmark for Multilingual Code Reasoning, Understanding and Execution}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure