arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2407.11470cs.SEcs.AIcs.CL
收藏

超越正确性:面向大语言模型的多维度代码生成基准测试

Beyond Correctness: Benchmarking Multi-dimensional Code Generation for Large Language Models

University of Chinese Academy of Sciences(中国科学院大学);Institute of Software, Chinese Academy of Sciences(中国科学院软件研究所);Chinese Information Processing Laboratory(中文信息处理实验室);State Key Laboratory of Computer Science(计算机科学国家重点实验室);Key Laboratory of System Software, Chinese Academy of Sciences(中国科学院系统软件重点实验室)

Jiasheng Zheng, Boxi Cao, Zhengzhao Ma, Ruotong Pan, Hongyu Lin, Yaojie Lu, Xianpei Han, Le Sun

AI总结:

针对现有代码生成基准仅侧重正确性、易受数据污染影响的问题,本文提出涵盖可读性、可维护性、正确性、效率四维度的RACE基准,测试28款大语言模型后发现多维度评估的必要性,为后续代码生成优化指明方向。

摘要:

近年来,研究人员提出了大量基准以评估大语言模型(LLM)令人瞩目的代码生成能力。然而,当前基准主要评估LLM生成代码的准确性,却忽略了在实际开发中同样会显著影响代码质量的其他关键维度。此外,仅以正确性作为核心衡量指标会使LLM容易受到数据污染的影响。因此,本文提出RACE基准,该基准从4个维度全面评估LLM生成代码的质量:可读性(Readability)、可维护性(mAintainability)、正确性(Correctness)和效率(Efficiency)。具体而言,考虑到正确性之外的维度具有需求依赖性的特点,我们为每个维度设计了多种类型的用户需求,以评估模型生成既正确又能满足用户需求的代码的能力。我们基于RACE对28个具有代表性的LLM进行了分析,发现:1)当前以正确性为核心的基准无法捕捉真实场景中代码的多方面需求,而RACE提供的综合评估能够揭示LLM在多个维度上的缺陷;2)RACE基准是抵御数据污染风险的有效工具;3)即便是最先进的代码LLM,在涉及复杂指令的定制化需求中仍面临显著挑战;4)大多数LLM对特定编码风格存在固有偏好。这些发现凸显了对代码LLM开展多维度评估的必要性,强调了实际应用中需关注正确性之外的指标。未来的工作应致力于开发新型学习算法,以提升多样约束下的代码生成效果,并增强对不同用户需求的覆盖度和适用性。

英文摘要:

In recent years, researchers have proposed numerous benchmarks to evaluate the impressive coding capabilities of large language models (LLMs). However, current benchmarks primarily assess the accuracy of LLM-generated code, while neglecting other critical dimensions that also significantly impact code quality in real-world development. Moreover, relying exclusively on correctness as the guiding metric renders LLMs susceptible to data contamination. Therefore, this paper proposes the RACE benchmark, which comprehensively evaluates the quality of code generated by LLMs across 4 dimensions: Readability, mAintainability, Correctness, and Efficiency. Specifically, considering the demand-dependent nature of dimensions beyond correctness, we design various types of user requirements for each dimension to assess the model's ability to generate correct code that also meets user demands. We analyze 28 representative LLMs based on RACE and find that: 1) current correctness-centric benchmarks fail to capture the multifaceted requirements of code in real-world scenarios, while RACE provides a comprehensive evaluation that reveals the defects of LLMs across multiple dimensions; 2) the RACE benchmark serves as an effective tool for resisting the risk of data contamination; 3) even the most advanced code LLMs still encounter significant challenges in customized requirements involving complex instructions; 4) most LLMs exhibit an inherent preference for specific coding style. These findings highlight the need for a multidimensional evaluation of code LLMs, emphasizing metrics beyond correctness for real-world applications. Future efforts should aim to develop novel learning algorithms to enhance code generation under varied constraints and improve coverage and usability for diverse user needs.

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

↑