arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2408.13001cs.AI
收藏

CRUXEval-X:一个面向多语言代码推理、理解与执行的基准

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

Chinese Information Processing Laboratory, Institute of Software, Chinese Academy of Sciences(中国科学院软件研究所信息处理实验室);University of Chinese Academy of Sciences(中国科学院大学);The Hong Kong University of Science and Technology(香港科技大学);Huazhong University of Science and Technology(华中科技大学)

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

AI总结:

针对现有代码基准语言与任务偏向明显、构建成本高的问题,提出全自动化构建的多语言代码推理基准CRUXEVAL-X,覆盖19种语言,评估揭示了LLM的语言间相关性与跨语言泛化特性。

摘要:

HumanEval等代码基准被广泛用于评估大语言模型(LLM)的编码能力。然而现有代码基准存在不可忽视的编程语言偏向——超过95%的代码生成基准以Python为主导,导致LLM在Java、C/C++等其他编程语言中的能力尚不明确。此外,编码任务偏向也十分关键:大多数基准聚焦于代码生成能力,而针对代码推理(给定输入推理输出、给定输出推理输入)这一核心编码能力的基准仍存在不足。但构建多语言基准成本高、耗时长,且Leetcode等竞赛网站的代码存在训练阶段数据污染的问题。为填补这一空白,我们提出CRUXEVAL-X,一个涵盖19种编程语言的多语言代码推理基准,每种语言至少包含600道题目,总计有1.9万道内容一致的测试题。具体而言,CRUXEVAL-X的构建流程采用全自动化、测试引导的方式,基于执行反馈迭代生成和修复代码。同时,为跨越语言壁垒(例如Python的动态类型系统与C++的静态类型系统差异),我们制定了不同语言对之间的多种转换规则以辅助翻译。我们对24个代表性LLM开展的全面评估揭示了不同语言对之间的相关性:例如TypeScript与JavaScript呈现显著正相关,而Racket与其他语言的相关性较低。更值得注意的是,即使是仅用Python训练的模型,在其他语言上的Pass@1最高也能达到34.4%,展现了LLM的跨语言泛化能力。

英文摘要:

Code benchmarks such as HumanEval are widely adopted to evaluate Large Language Models' (LLMs) coding capabilities. However, there is an unignorable programming language bias in existing code benchmarks -- over 95% code generation benchmarks are dominated by Python, leaving the LLMs' capabilities in other programming languages such as Java and C/C++ unknown. Moreover, coding task bias is also crucial. Most benchmarks focus on code generation capability, while benchmarks for code reasoning (given input, reasoning output; and given output, reasoning input), an essential coding capability, are insufficient. Yet, constructing multi-lingual benchmarks can be expensive and labor-intensive, and codes in contest websites such as Leetcode suffer from data contamination during training. To fill this gap, we propose CRUXEVAL-X, a multi-lingual code reasoning benchmark that contains 19 programming languages. It comprises at least 600 subjects for each language, along with 19K content-consistent tests in total. In particular, the construction pipeline of CRUXEVAL-X works in a fully automated and test-guided manner, which iteratively generates and repairs based on execution feedback. Also, to cross language barriers (e.g., dynamic/static type systems in Python/C++), we formulated various transition rules between language pairs to facilitate translation. Our intensive evaluation of 24 representative LLMs reveals the correlation between language pairs. For example, TypeScript and JavaScript show a significant positive correlation, while Racket has less correlation with other languages. More interestingly, even a model trained solely on Python can achieve at most 34.4% Pass@1 in other languages, revealing the cross-language generalization of LLMs.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑