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

Unseen Horizons:揭示大语言模型在熟悉场景之外的代码生成真实能力

Unseen Horizons: Unveiling the Real Capability of LLM Code Generation Beyond the Familiar

College of Computer Science and Technology(计算机科学与技术学院);National University of Defense Technology(国防科技大学)

Yuanliang Zhang, Yifan Xie, Shanshan Li, Ke Liu, Chong Wang, Zhouyang Jia, Xiangbing Huang, Jie Song, Chaopeng Luo, Zhizheng Zheng, Rulin Xu, Yitong Liu, Si Zheng, Xiangke Liao

AI总结:

针对现有代码生成评估因训练数据暴露、时效性不足导致的能力高估问题,本文提出基于代码混淆的基准OBFUSEVAL,通过三级混淆策略构造未见过的测试用例,评估发现LLM代码生成测试通过率最高下降62.5%,揭示了其真实能力边界。

摘要:

近年来,大语言模型(LLM)在代码生成任务中展现出强劲潜力,但距离其完全应用于实际软件开发流程仍存在差距。准确评估大语言模型的代码生成能力,已成为评估和改进模型的重要基础。现有部分研究构建了数据集以评估这类模型的能力,但当前评估流程可能会陷入“熟悉领域专家”的错觉,这主要源于三类差距:目标代码暴露、案例时效性以及依赖可用性。造成这些差距的根本原因是,当前数据集中的代码可能在训练阶段就已被大量接触和演练,且随着LLM的持续训练与发展,这些数据集的时效性已严重受损。解决该问题的关键在于,尽可能使用LLM从未接触过的代码来评估它们。因此,本文的核心思路是借鉴代码混淆的概念,在保证功能和输出不变的前提下,从不同层级对代码进行改动。为此,我们构建了一个基于代码混淆的基准OBFUSEVAL。我们首先从5个真实项目中收集了1354个原始案例,包含函数描述与代码。随后我们采用三级策略(符号级、结构级和语义级)对描述、代码和上下文依赖进行混淆。我们在OBFUSEVAL上评估了4种LLM,并对比了不同混淆策略的效果。我们使用这些项目的官方测试套件来评估生成的代码。结果显示,经过混淆后,测试通过率的平均下降幅度最高可达62.5%。

英文摘要:

Recently, large language models (LLMs) have shown strong potential in code generation tasks. However, there are still gaps before they can be fully applied in actual software development processes. Accurately assessing the code generation capabilities of large language models has become an important basis for evaluating and improving the models. Some existing works have constructed datasets to evaluate the capabilities of these models. However, the current evaluation process may encounter the illusion of "Specialist in Familiarity", primarily due to three gaps: the exposure of target code, case timeliness, and dependency availability. The fundamental reason for these gaps is that the code in current datasets may have been extensively exposed and exercised during the training phase, and due to the continuous training and development of LLM, their timeliness has been severely compromised. The key to solve the problem is to, as much as possible, evaluate the LLMs using code that they have not encountered before. Thus, the fundamental idea in this paper is to draw on the concept of code obfuscation, changing code at different levels while ensuring the functionality and output. To this end, we build a code-obfuscation based benchmark OBFUSEVAL. We first collect 1,354 raw cases from five real-world projects, including function description and code. Then we use three-level strategy (symbol, structure and semantic) to obfuscate descriptions, code and context dependencies. We evaluate four LLMs on OBFU- SEVAL and compared the effectiveness of different obfuscation strategy. We use official test suites of these projects to evaluate the generated code. The results show that after obfuscation, the average decrease ratio of test pass rate can up to 62.5%.

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

↑