读见

研究发现,AI 生成的代码因下游瓶颈而未能提升生产力

原题Study Finds AI-generated Code Fails to Boost Productivity Due to Downstream Bottlenecks

约 3 分钟约 568 字原文英文已翻译

读前速览

3 个要点

一项哈佛研究显示,尽管 AI 编程助手和智能体大幅增加了代码产出,却没有缩短项目完成时间或提升生产力,因为生成的代码给评审和测试阶段带来了大量瓶颈。

  1. AI 工具显著增加了代码产出,却未能提升整体生产力。

    研究发现,AI 助手和智能体大幅增加了代码行数(最多 30%)和提交次数(最多 20%)。然而,已解决的问题数量或已完成项目数量并未相应增长,说明新增代码没有得到有效利用。

  2. 主要瓶颈出现在代码评审和测试阶段。

    数据显示,评审拉取请求所需的时间大幅增加(上升 49%),需要修改的 PR 数量也翻了一倍。这表明 AI 生成的代码往往质量不佳,需要大量人工介入修正,从而抵消了编写阶段节省的时间。

  3. AI 生成代码的质量是限制其实用性的关键因素。

    生成代码的错误率较高,且缺乏上下文意识,导致开发者花在修复和评审 AI 输出上的时间,比亲自编写代码还多。这削弱了使用这些工具可能带来的生产力提升。

完整摘要

这项研究基于 718 家企业和 700,000 名员工的数据,发现 AI 工具使代码行数增加 12-30%,提交次数增加 9-20%。然而,已解决的问题数量仅增加 12%,这表明新增代码并未得到有效利用。主要原因是代码评审和测试的工作量大幅增加:评审时间上升 49%,需要修改的次数翻倍。这说明 AI 生成的代码质量较低,或更难验证。

查看原文

哈佛大学近期一项针对718家企业的研究借助 Jellyfish 分析平台发现,尽管 AI 编码助手和智能体增加了代码产出量,但已完成的工作并未相应增加,部分原因是 AI 生成的代码加重了开发后期阶段的工作负担,尤其是代码审查。A recent Harvard study of 718 firms, using the Jellyfish analytics platform, finds that although AI coding assistants and agents increase code volume, this does not translate into a corresponding increase in completed work, partly because AI-generated code increases the workload in later stages of development, particularly code review.

这项研究基于 2021 年 1 月至 2026 年 3 月期间,来自 700 多家公司、70 万名员工的约 3 亿条工作活动记录。数据来自多个来源,例如人力资源信息、代码版本控制系统、问题管理系统、Google Calendar 等日程安排工具,以及 GitHub Copilot、Cursor 和 Claude Code 等生成式 AI 工具。The study was based on approximately 300 million work events of 700,000 workers across 700+ firms from January 2021 to March 2026. The data was gathered from several sources such as HR information, code version control systems, issue management systems, scheduling tools such as Google Calendar, and generative-AI tools, including GitHub Copilot, Cursor, and Claude Code.

研究人员考虑了三项代码产出指标:新增代码行数、提交次数和拉取请求数。The researchers considered three measures of coding output: lines of code added, commits, and pull requests.

AI 助手使代码产出小幅增加:代码行数增加 12%,提交次数增加 9%,拉取请求数量增加 5%;其中只有提交次数的变化在统计上显著。AI 智能体则使这三项指标均大幅且显著增加:代码行数增加 30%,提交次数增加 20%,拉取请求数量增加 23%。

AI assistants lead to small increases in code output — 12% for lines of code, 9% for commits, and 5% for pull requests — with only the effect on commits being statistically significant. AI agents lead to large and significant increases in all three measures: 30% for lines of code, 20% for commits, and 23% for pull requests.

作者使用这些数据,根据每名员工每月解决的 Jira 问题和史诗数量来评估软件产出,其中问题被视为单项工程工作,史诗则是规模更大的项目或功能。研究发现,编码助手并未增加已解决问题的数量,而智能体则使其增加了 12%。然而,这一增幅远低于代码行数估计增加的 30%。The authors used these data to evaluate software output by the number of Jira issues and epics resolved per worker per month, with issues treated as individual units of engineering work, and epics as larger projects or features. Coding assistant were found not to increase the number of resolved issues, while agents brought a 12% increase. However, this is significantly smaller than the estimated 30% increase in lines of code.

为了解释这一巨大差距,他们考察了整个开发流程。这个流程不仅包括编码,还涵盖了多个步骤,例如功能与范围规划、代码审查、测试和部署。To explain this chasm, they examined the overall development process, which encompasses multiple steps beyond coding, including feature and scope planning, code reviews, testing, and deployment.

我们根据 Jellyfish 数据估算时间分配,并通过对 100 名 Prolific 工程师的调查验证这一估算,发现工程师有 30%–40% 的时间用于编写代码,其余时间则用于这些互补性任务。当 AI 提高代码编写效率时,这些互补环节可能会成为瓶颈。

We impute time usage from the Jellyfish data and validate this imputation using a survey of 100 Prolific engineers, finding that engineers spend 30-40% of their time writing code; the remainder goes to these complementary tasks. When AI raises productivity in code writing, complementary steps may serve as bottlenecks.

具体而言,他们发现,PR 平均审查时间增加了 49%,每个 PR 的评论数量增加了 53%,需要修改的 PR 占比则翻了一番。此外,参与代码审查的员工比例增加了 14%,而采用 AI 辅助审查并未带来任何改进。作者还指出,PR 相关工作量的增加无法用单个 PR 规模的扩大来解释。Specifically, they found that the average PR time to review increased by 49%, the number of comments per PR rose by 53%, and the share of PRs requiring changes doubled. Additionally, the share of workers performing code reviews increased by 14%, with no improvement coming from the adoption of AI to assist with the reviews. They authors also noted that the increase in PR-related effort could not be explained by an increase in the size of individual PRs.

在评论这些发现时,Reddit 用户 Prime_1 指出,“每一行代码都可能带来潜在风险”。markehammons 进一步阐述了这一观点,并强调了 AI 幻觉带来的额外风险:Commenting on the findings, Reddit user Prime_1 observed that "every line of code is a potential liability", a point further developed by markehammons, who highlighted the additional risk of AI hallucinations:

尤其是在面对不可信的行为主体时更是如此,而智能体比大多数行为主体都更不可信。它们可能在毫无恶意的情况下做出最离谱的事,只是误入歧途地试图完成交给它们的任务。

Doubly so when you're dealing with an untrustworthy actor, and agents are more untrustworthy than most actors. They can do the most messed up stuff without any hint of malice, and in a misguided attempt to pursue the task given to them.

Reddit 用户 enigmamonkey 进一步提出,平均恢复时间可能会日益成为评估 AI 对软件开发影响的重要指标:Reddit user enigmamonkey further suggested that mean time to recovery could become an increasingly important metric for assessing AI’s impact on software development:

如果你的工程师编写和理解他们交付的代码越来越少,我想,问题会变得越来越频繁,也越来越难以解决。尤其是随着代码库规模不断扩大……而它终究会扩大。

If your engineers are writing and understanding less and less of the code they ship, I imagine issues become more frequent and more complicated to resolve. Particularly as the codebase scales… and it will scale.

Jellyfish 是一家软件公司,提供用于衡量和分析软件工程绩效的平台。它将 GitHub 和 Jira 等工具中的数据连接起来,帮助企业了解开发者的生产力和软件交付情况。Jellyfish is a software company that provides a platform for measuring and analyzing software engineering performance. It connects data from tools such as GitHub and Jira to help companies understand developer productivity and software delivery.

值得记下

AI 助手带来的代码产出增幅较小:代码行数增加 12%,提交次数增加 9%,拉取请求增加 5%;其中只有提交次数的影响在统计上显著。AI 智能体则使这三项指标都大幅且显著增长:代码行数增加 30%,提交次数增加 20%,拉取请求增加 23%。
PR 平均评审时间增加了 49%,每个 PR 的评论数量上升了 53%,需要修改的 PR 占比翻了一倍。
每一行代码都可能成为隐患;当你面对一个不值得信任的参与者时,风险更是加倍,而智能体比大多数参与者都更不值得信任。