arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2212.10264cs.LGcs.CLcs.SE
收藏

ReCode:代码生成模型的鲁棒性评估

ReCode: Robustness Evaluation of Code Generation Models

AWS AI Labs(亚马逊云科技人工智能实验室);Cornell University(康奈尔大学);University of Chicago(芝加哥大学);AWS AI Research & Education(亚马逊云科技人工智能研究与教育部门)
Shiqi Wang, Zheng Li, Haifeng Qian, Chenghao Yang, Zijian Wang, Mingyue Shang, Varun Kumar, Samson Tan, Baishakhi Ray, Parminder Bhatia, Ramesh Nallapati, Mural… 展开作者

Shiqi Wang, Zheng Li, Haifeng Qian, Chenghao Yang, Zijian Wang, Mingyue Shang, Varun Kumar, Samson Tan, Baishakhi Ray, Parminder Bhatia, Ramesh Nallapati, Murali Krishna Ramanathan, Dan Roth, Bing Xiang

摘要:

代码生成模型已经取得了令人印象深刻的性能。然而,它们往往是脆弱的,因为对提示的轻微编辑可能导致非常不同的生成;这些健壮性属性在部署到现实应用程序中时对用户体验至关重要,但尚未得到很好的理解。大多数现有的文本或代码任务的鲁棒性的工作集中在分类,而生成任务的鲁棒性是一个未知的领域,迄今为止,没有全面的基准健壮性在代码生成。在本文中,我们提出了ReCode,一个全面的健壮性评估基准的代码生成模型。我们专门为文档字符串、函数和变量名称、代码语法和代码格式定制了30多种转换。它们经过精心设计,在现实生活中的编码实践中是自然的,保留了原始的语义含义,从而提供了对模型鲁棒性性能的多方面评估。通过人工注释,我们验证了超过90%的扰动提示不会改变原始提示的语义含义。此外,我们定义的鲁棒性度量的代码生成模型考虑到最坏情况下的行为,在每种类型的扰动,利用这样一个事实,即执行生成的代码可以作为客观的评价。我们使用HumanEval,MBPP以及从它们派生的功能完成任务在SOTA模型上演示ReCode。有意思的意见包括:CodeGen的鲁棒性优于InCoder和GPT-J;模型对语法扰动最敏感; MBPP的鲁棒性评估比HumanEval更具挑战性。

英文摘要:

Code generation models have achieved impressive performance. However, they tend to be brittle as slight edits to a prompt could lead to very different generations; these robustness properties, critical for user experience when deployed in real-life applications, are not well understood. Most existing works on robustness in text or code tasks have focused on classification, while robustness in generation tasks is an uncharted area and to date there is no comprehensive benchmark for robustness in code generation. In this paper, we propose ReCode, a comprehensive robustness evaluation benchmark for code generation models. We customize over 30 transformations specifically for code on docstrings, function and variable names, code syntax, and code format. They are carefully designed to be natural in real-life coding practice, preserve the original semantic meaning, and thus provide multifaceted assessments of a model's robustness performance. With human annotators, we verified that over 90% of the perturbed prompts do not alter the semantic meaning of the original prompt. In addition, we define robustness metrics for code generation models considering the worst-case behavior under each type of perturbation, taking advantage of the fact that executing the generated code can serve as objective evaluation. We demonstrate ReCode on SOTA models using HumanEval, MBPP, as well as function completion tasks derived from them. Interesting observations include: better robustness for CodeGen over InCoder and GPT-J; models are most sensitive to syntax perturbations; more challenging robustness evaluation on MBPP over HumanEval.

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

↑