🔶 一项新研究刚刚打破了人们对 AI 与开源的最大恐惧
英文标题:🔶 A new study just debunked the biggest fear about AI and open source
北京大学一项追踪 1888 个 GitHub 仓库的研究发现,采用 AI 编程代理(如 Cursor、Claude Code)后,新人贡献者并未被排挤,在最保守统计下参与度仅微降 1.5% 且不显著。虽然代码复杂度有所上升(圈复杂度增 3-4%,Python 认知复杂度增 11%),但贡献者数量保持稳定,表明复杂度增加并未吓退新手。这一发现暂时平息了“AI 挤走新人”的担忧,但也提醒代码审查量激增,长期维护压力可能加重。
230.4 KB
69.7 KB
1.4 MB
中文
人们普遍担心 AI 会对开源造成怎样的影响。编程代理接管了那些帮助新贡献者入门的新手友好型议题;它们生成的代码更难维护,最终导致新的维护者梯队枯竭。这是一个听起来似乎合理的场景。但根据新的研究,这似乎并未真正发生。
北京大学于 7 月 2 日提交至 arxiv.org 的一项研究追踪了 1,888 个采用了 AI 编程代理(如 Cursor 和 Claude Code)的 GitHub 仓库,以观察 AI 进入工作流后这些项目发生了怎样的变化。研究人员将“采用”定义为项目提交第一个代理配置文件(如 .cursorrules 或 CLAUDE.md)的时间点,然后将这些项目与一组从未采用 AI 的匹配项目进行对比。
他们使用了双重差分法,这基本上是将工具实际造成的效果与工具出现前项目中已存在的趋势区分开来的黄金标准。而他们的发现是……影响不大。新人参与度保持稳定或略有上升。在最保守的统计设定下,他们能找到的最差情况是 1.5% 的下滑,但这并未达到统计显著性。
复杂性上升,贡献者稳定
圈复杂度(计算一个函数中独立路径的数量)在所有语言中采用 AI 后上升了 3% 到 4%。认知复杂度(一种更棘手的指标,对深度嵌套逻辑和混乱的控制流进行惩罚)在 Python 项目中跃升了约 11%。这听起来很糟糕,但当你将其与去年发表的卡内基梅隆大学研究进行比较时,会发现该研究发现采用 Cursor 导致同一指标激增 41%。北京大学的团队基于更大、更成熟的项目集和更严格的统计控制,得出的估计值约为先前结果的四分之一。
但这项研究真正有趣的地方在于,他们并没有仅仅将复杂度和新人数量作为同一篇论文中的两个独立发现来报告,而是将分析锁定在复杂度确实增加的 128 个 Python 项目上。在这些仓库中,新人参与率没有下降,留存率保持稳定,活跃贡献者基础有所增长。两种效应都真实存在,但它们似乎没有关联。AI 生成的代码正变得稍微复杂一些,但至少在本次研究发现的程度下,这种额外的复杂性似乎并没有让新人望而却步。
AI 生成的代码正变得稍微复杂一些,但至少在本次研究发现的程度下,这种额外的复杂性似乎并没有让新人望而却步。
研究排除的内容
有几个重要的注意事项。最大的问题是,该研究聚焦于已建立的开源项目。近三分之二采用 AI 编码工具的仓库几乎是在创建之初就采用了,这让研究人员没有有意义的 AI 前基线可进行比较。这些仓库被排除在主要分析之外,分析转而聚焦于 603 个在引入 AI 前已有至少六个月历史的项目。
研究人员还检查了完整的数据集,其中新人参与度似乎有所下降。但仔细审视后发现,这些项目在采用 AI 之前就已经在流失贡献者,因此无法将下降归咎于工具本身。
衡量采纳的盲点
还有另一项局限。该研究通过寻找与 Cursor 等工具关联的配置文件来衡量 AI 采纳,而不是追踪开发者实际使用它们的频率。这意味着它可以告诉我们项目采用 AI 后发生了什么,但不能说明重度依赖 AI 的团队与仅仅尝试使用的团队是否经历了不同的结果。
GitHub 表示,整个平台上合并的拉取请求已从 2023 年初的每月约 2500 万增长到如今的每月约 9000 万。
GitHub 也开始做出回应。该公司最近对外部贡献者可以同时拥有的开放拉取请求数量设置了限制,并推出了新工具来帮助维护人员应对日益增长的审查队列。
排挤新人的担忧,目前暂时可以放下了。
留给我们的思考
排挤新人的担忧,目前暂时可以放下了。在当前采纳水平下,在成熟的开源项目中,AI 代理并没有将新人赶出门。然而,拉取请求量几乎增长到了原来的四倍。这些 PR 中的代码也稍微复杂了一些。提交代码的人可能并不完全理解自己所提议的内容。而所有这一切,都压在了维护者身上,他们的队伍却并未以同样的速度增长。
研究人员表示,未来的工作应该考察项目对 AI 编码工具的依赖程度,并找到更好的方法来研究那些从诞生起就与 AI 相伴的仓库。这些都是重要的下一步。但最紧迫的问题似乎是:不是看 AI 是否改变了谁来贡献,而是看它是否改变了长期维护一个开源项目所需付出的努力。
不是看 AI 是否改变了谁来贡献,而是看它是否改变了长期维护一个开源项目所需付出的努力。
English / 原文
There’s a common fear about what AI could do to open source. Coding agents take over the beginner-friendly issues that help new contributors get started; the code they generate is harder to maintain, and eventually, the pipeline of new maintainers dries up. It’s a plausible scenario. But according to new research, it doesn’t appear to be what’s actually happening.
A study submitted to arxiv.org on July 2 out of Peking University tracked 1,888 GitHub repositories that adopted AI coding agents, tools like Cursor and Claude Code, to see how those projects changed after AI entered the workflow. The researchers treated adoption as the point when a project committed its first agent configuration file, something like a .cursorrules or CLAUDE.md, and then compared those projects against a matched set that never adopted.
They used difference-in-differences, which is basically the gold standard for separating what a tool actually caused from whatever was already going on in a project before the tool showed up. And what they found was…not much. Newcomer participation held steady or crept slightly upward. Under the most conservative statistical specification, the worst they could find was a 1.5% dip that didn’t approach statistical significance.
Complexity up, contributors steady
Cyclomatic complexity, which counts the number of independent paths through a function, ticked up 3% to 4% across all languages after adoption. Cognitive complexity, the trickier metric that penalizes heavily nested logic and tangled control flow, jumped by about 11% in Python projects. That sounds bad until you compare it to a Carnegie Mellon study published last year, which found that Cursor adoption drove a 41% increase in the same metric. The Peking University team, working with a larger and more established set of projects and tighter statistical controls, landed at roughly a quarter of that earlier estimate.
But where the study really gets interesting is that instead of just reporting complexity and newcomer numbers as two separate findings that happen to live in the same PDF, they locked the analysis to the exact 128 Python projects where complexity actually increased.
On those same repos, newcomer entry didn’t decline, retention held steady, and the active contributor base grew. Both effects are real, but they don’t seem to be connected. AI-generated code is getting a little more complicated, yet that extra complexity doesn’t appear to be discouraging newcomers, at least at the levels this study found.
AI-generated code is getting a little more complicated, yet that extra complexity doesn’t appear to be discouraging newcomers, at least at the levels this study found.
What the study excluded
There are a few important caveats. The biggest issue is that the study focused on established open-source projects. Nearly two-thirds of the repositories that adopted AI coding tools did so almost as soon as they were created, leaving researchers with no meaningful pre-AI baseline for comparison. Those repositories were excluded from the main analysis, which instead focused on 603 projects with at least six months of history before AI was introduced.
The researchers also examined the full dataset, in which newcomer participation appeared to decline. But a closer look showed those projects were already losing contributors before they adopted AI, making it impossible to blame the decline on the tools themselves.
Measuring adoption’s blind spots
There’s another limitation, too. The study measures AI adoption by looking for configuration files associated with tools like Cursor, not by tracking how often developers actually used them. That means it can tell us what happened after projects adopted AI, but not whether teams that relied heavily on AI experienced different outcomes than teams that only experimented with it.
GitHub says merged pull requests across the platform have grown from about 25 million per month in early 2023 to roughly 90 million a month today.
GitHub has started responding, too. The company recently introduced limits on the number of open pull requests that outside contributors can have at once, along with new tools to help maintainers sort through growing review queues.
The crowding-out fear is, for now, put to rest.
Where this leaves us
The crowding-out fear is, for now, put to rest. In established open-source projects, at current adoption levels, AI agents are not pushing newcomers out the door. However, pull request volume has nearly quadrupled. The code arriving in those PRs is a bit more complicated. The people submitting it may not fully grasp what they’re proposing. And all of that lands on maintainers whose ranks are not growing at anything like the same pace.
The researchers say future work should examine how heavily projects rely on AI coding tools and find better ways to study repositories that were effectively born with AI. Those are important next steps. But the question that feels most pressing is: Not whether AI changes who shows up to contribute, but whether it changes the effort required to maintain an open-source project over time.
Not whether AI changes who shows up to contribute, but whether it changes the effort required to maintain an open-source project over time.
Group Created with Sketch.