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

生成代码难以理解的条件是什么?评估AI代理在真实世界中的Python代码能力

When is Generated Code Difficult to Comprehend? Assessing AI Agent Python Code Proficiency in the Wild

Faculty of ICT, Mahidol University(玛希隆大学信息通信技术学院);Nara Institute of Science and Technology(奈良先端科学技术大学院大学);The University of Osaka(大阪大学)

Nanthit Temkulkiat, Chaiyong Ragkhitwetsagul, Morakot Choetkiertikul, Ruksit Rojpaisarnkit, Raula Gaikovina Kula

AI总结:

本研究通过分析AI生成的Python代码,发现其主要为初级水平,但特定任务可能需要高级技能来理解和维护。

摘要:

AI编码代理的快速采用正在从根本上改变软件开发者的角色,使其从代码作者转变为代码审查员。尽管开发者花费大量时间阅读和理解代码,但这些代理生成的Python代码的语言能力和复杂性仍鲜有研究。本研究探讨了AI代理的代码能力,以确定开发者维护代码所需的技能水平。利用AIDev数据集,我们挖掘了591个包含5,027个Python文件的拉取请求,这些文件由三个不同的AI代理生成,并使用pycefr静态分析工具,将Python构造映射到六个熟练程度等级(从A1(基础)到C2(精通)),以分析代码。我们的结果表明:AI代理主要生成基础级代码,超过90%的构造处于A1和A2级别,而少于1%被归类为精通(C2);AI代理和人类的拉取请求在熟练程度轮廓上大致相似;高熟练度的代码由功能添加和错误修复任务生成。这些发现表明,尽管AI生成的代码对具备基本Python技能的开发者来说通常是可访问的,但某些任务可能需要高级技能来审查和维护复杂的、由代理生成的构造。

英文摘要:

The rapid adoption of AI coding agents is fundamentally shifting software developers' roles from code authors to code reviewers. While developers spend a significant portion of their time reading and comprehending code, the linguistic proficiency and complexity of the Python code generated by these agents remain largely unexplored. This study investigates the code proficiency of AI agents to determine the skill level required for developers to maintain their code. Leveraging the AIDev dataset, we mined 591 pull requests containing 5,027 Python files generated by three distinct AI agents and employed pycefr, a static analysis tool that maps Python constructs to six proficiency levels, ranging from A1 (Basic) to C2 (Mastery), to analyze the code. Our results reveal that: AI agents predominantly generate Basic-level code, with over 90% of constructs falling into the A1 and A2 categories, and less than 1% classified as Mastery (C2); AI agents' and humans' pull requests share a broadly similar proficiency profile; High-proficiency code by AI agents are from feature addition and bug fixing tasks. These findings suggest that while AI-generated code is generally accessible to developers with basic Python skills, specific tasks may require advanced proficiency to review and maintain complex, agent-generated constructs.

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

↑