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

在AI生成代码中利用模式挖掘类型构造

Mining Type Constructs Using Patterns in AI-Generated Code

University of Alberta(阿尔伯塔大学)

Imgyeong Lee, Tayyib Ul Hassan, Abram Hindle

AI总结:

研究AI在类型构造任务中的表现,发现AI更易误用any关键字及高级类型构造,但其PR接受率高于人类。

摘要:

人工智能(AI)日益自动化软件开发任务的各个方面。尽管AI提高了开发任务的生产力,但尚未研究AI是否在类型相关编程任务中优于人类,例如正确使用类型构造以确保类型安全。此外,没有系统研究评估AI代理是否在复杂的类型系统下与人类同样过度使用或误用类型构造。本研究首次在TypeScript项目中进行实证分析,发现与人类相比,AI代理使用any关键字的频率高9倍,并更频繁使用忽略类型检查的高级类型构造。令人惊讶的是,尽管存在这些问题,AI的拉取请求(PR)接受率比人类高1.8倍。我们鼓励软件开发者在与AI代理协作开发时,仔细确认代码库的类型安全性。

英文摘要:

Artificial Intelligence (AI) increasingly automates various parts of the software development tasks. Although AI has enhanced the productivity of development tasks, it remains unstudied whether AI essentially outperforms humans in type-related programming tasks, such as employing type constructs properly for type safety, during its tasks. Moreover, there is no systematic study that evaluates whether AI agents overuse or misuse the type constructs under the complicated type systems to the same extent as humans. In this study, we present the first empirical analysis to answer these questions in the domain of TypeScript projects. Our findings show that, in contrast to humans, AI agents are 9x more prone to use the 'any' keyword. In addition, we observed that AI agents use advanced type constructs, including those that ignore type checks, more often compared to humans. Surprisingly, even with all these issues, Agentic pull requests (PRs) have 1.8x higher acceptance rates compared to humans for TypeScript. We encourage software developers to carefully confirm the type safety of their codebases whenever they coordinate with AI agents in the development process.

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

↑