Agents 每天都在为我们编写越来越多的代码,而每一个 pull request 在合并前仍需要经过审查。人类审查者无法逐行阅读不断增长的代码量,因此团队开始借助 AI 来协助。
不过,AI 审查者必须跨越一道很高的门槛。如果它漏掉了真实的 bug,就没有人会相信它的沉默;如果它用大量误报淹没了那些 bug,也没有人会去阅读它的评论。
要同时做到这两点,就需要发现可操作的 bug、将误报率保持在低位,并将延迟和成本控制在合理范围内。在固定成本下,我们发现使用互补模型的多个小型独立审查者,往往比单个由更强模型驱动的审查者表现更好。我们利用这一思路重新构建了 Copilot code review 的 Lite 和 Balanced 层级,并推出了面向您最高风险 pull request 的全新 Max 层级。本文解释了这背后的原理、我们如何将多个审查者的发现整合为一份审查报告,以及我们如何运用这一思路重新构建了 Copilot code review 的各层级。
这为什么有效?一个简单的例子
考虑一个具有固定 prompt、模型和工具集的审查 agent。假设它有 60% 的概率标记出某个 pull request 中的特定 bug。它可能在一次审查中捕获该 bug,而在下一次中漏掉它。
如果我们独立且并行地运行该审查者两次,至少一次运行发现该 bug 的概率将升至 84%,而成本则翻倍。如果进行三次独立运行,概率将升至 94%,而成本则变为三倍。
更一般地,如果每个审查者发现某个特定 bug 的概率为 p,则 n 个独立审查者中至少一个发现该 bug 的概率为 1 − (1 − p)^n。在我们的例子中,p = 0.6。关键在于,只需要一个审查者发现该 bug 即可。
运行多个审查器同样存在时间成本。审查时间可能会适度增加,因为我们必须等待最慢的审查器完成。
同模型与混合模型审查
反复运行同一审查器的效果是有限的。在第三次运行之后,我们开始看到边际收益递减。
每个模型也存在由其训练所塑造的偏见。某些 bug 对于特定模型而言始终难以标记,无论它审查多少次 pull request。模型在代码审查方面各有特定的优势,也有特定的盲点。
为了说明这一点,我们使用 ReviewBench 来测量使用 GPT-6.1 Sol(高推理)、Claude Opus 5.5(高推理)以及两者组合时发现的严重 bug 百分比。您可以在我们之前的博文中了解更多关于 ReviewBench 的内容。
在下方图表中,虚线表示在各自价格点上,通过反复运行 GPT-6.1 Sol 或 Claude Opus 5.5 所能发现的严重 bug 的最高百分比。实线表示通过组合这两个模型所能发现的最高百分比。
实线始终等于或高于虚线,因为混合方案可以包含单模型选项。关键在于两者之间的差距,它展示了混合模型带来的提升空间。在每个 pull request $3 的价格点上,将这两个模型组合使用,可将 ReviewBench 上捕获的严重 bug 占比提高 4.9 个百分点,从 61.3% 提升至 66.2%。
Copilot 代码审查可以调用来自不同提供商的模型,因此不受限于单一模型家族的优势和盲点。这种灵活性让我们能够选择互补的审查器,在给定价格点上实现最佳表现。
连贯的审查
当两位独立的审查者检查同一段代码时,他们可能会发现一些相同的 bug,同时也可能各自发现对方遗漏的问题。为了减少噪音并避免多次报告同一问题,我们会将他们的发现合并为一份连贯的审查报告。这意味着需要对发现进行去重并移除误报。
Copilot code review 使用两种策略来实现这一点:投票和 agent 聚合。
投票去重所有审查者的发现,并统计每个发现被多少位审查者标记。票数低于设定阈值的发现会被抑制,其假设是票数较少意味着置信度较低。投票方式快速且经济高效,因为去重仅需单次 LLM 调用。
agent 聚合使用一个 agent 将所有审查者的发现整合为一份审查报告。该 agent 可以筛选和精炼发现,解决分歧,并逐一核实每个发现的准确性。作为代价,审查耗时更长,成本也更高。
让我们来看一个 pull request 的例子,该 pull request 修改了 src/catalog/service.py(一个 Python 文件):
from catalog import cache, repository as repo
CACHE_TTL_SECONDS = 60
def get_product(product_id):
cached = cache.get(product_id)
if cached is not None:
return cached
product = repo.find(product_id)
if product is not None:
cache.put(
product_id,
product,
ttl_ms=CACHE_TTL_SECONDS,
)
return product
def rename_product(product_id, name):
repo.rename(product_id, name)
三位独立的审查者检查这些更改,并产生了以下发现:
前两个发现是真实的问题。缓存期望过期时间以毫秒为单位,而重命名产品会更新数据库,但其缓存快照保持不变。仔细查看 src/api/products.py(一个该 pull request 未修改的文件),会发现关于第三个发现,实际情况有所不同:
from catalog.service import get_product
def product_endpoint(product_id):
product = get_product(product_id)
if product is None:
return 404, {"error": "Not found"}
return 200, {"name": product["name"]}
现有的防护逻辑已经会在产品缺失时返回 404,因此第三个发现是误报。现在考虑我们调整投票阈值时会发生什么,该阈值是指在展示某个问题之前需要标记该问题的审查者数量:
当阈值为 1 票时,我们标记了两个真实 bug 和一个误报。将阈值提高到 2 会消除误报,仅保留真实 bug,从而提高精确率。将阈值提高到 3 会遗漏其中一个真实 bug,从而降低召回率。
投票为我们提供了一种低成本、快速且简单的筛选发现的方法。挑战在于选择合适的阈值,该阈值可能因不同 pull request 而异。智能体聚合让更强大的模型检查每个发现,消除误报,并过滤掉低严重程度的小瑕疵。在本例中,检查 src/api/products.py 的聚合器可以去除误报并保留两个真实 bug,代价是更长、成本更高的审查。
投票奖励共识并控制噪声,使其在成本和延迟受限的场景中非常有用。智能体聚合成本更高,但在我们的实验中,它产生了更高质量的结果。
新的审查层级
我们使用独立的互补审查者和聚合,重新构建了现有的 Lite 和 Balanced 层级,并推出了新的 Max 层级。从宏观层面来看,每个层级使用以下智能体审查您的 pull request:
Lite:4× GPT-5.6 Luna 审查者,结合投票。
Balanced:3× GPT-6.1 Sol 审查者,结合由 GPT-6 Astra 执行的智能体聚合。
Max:4× GPT-6.1 Sol、2× Claude Opus 5.5 和 2× GPT-6 Astra 审查者,结合由 GPT-6.1 Sol 执行的智能体聚合。
为了开发和迭代所有三个层级的初始配置,我们使用了 ReviewBench,这是一个基于具有代表性的 GitHub pull request 和生产环境对齐指标构建的代码审查 agent 基准测试。随后,我们在内部和外部流量上运行了多轮在线实验。
我们的衡量方式
在线实验:在9月16日至10月7日期间,共有 1.4 million pull request(包括外部的)参与了用于设计 lite 和 balanced 层级的在线实验。我们在10月2日至7日期间使用 GitHub 和 Microsoft 内部的 30K 审查来设计和测试 Max 层级。
严重性:每个发现由一个独立的 agent 使用评分标准标记为 critical、moderate 或 low。critical 评论是一个在合并前需要修复的具体问题;moderate 评论是一个影响行为但不太可能导致严重危害的问题;low 严重性评论描述的是一项可以安全推迟的次要改进。
精确率:发现中属于真实问题的比例。
召回率:Copilot 代码审查发现的真实问题占全部真实问题的比例。我们在审查时通过查看其他 agent 或人工识别的评论和问题,并将其与 Copilot 代码审查标记的项进行对比来估算此指标。
已处理/已忽略/误报:正如我们有一个独立的 agent 标注严重性一样,我们也有一个 agent 检查评论是否已被处理或被忽略。已处理的评论是指在 pull request 合并时已被修复的评论,已忽略的评论是指用户未采取行动的评论。误报是指用户明确表示不正确或无效的评论。
以下是最终层级配置在在线实验中的表现:
覆盖面和质量之间有何差异?
首先,让我们按严重程度细分,比较各档位每次审查的平均发现问题数量:
Max 提供最大的覆盖范围,尤其是在关键问题上,这正是我们的目标。Lite 和 Balanced 每次审查产生的问题总数相近,而 Lite 会产生更多关键和低严重级别的问题。Balanced 发现的问题比 Lite 少,但其中值得修复的更多。
下图展示了各档位中,开发者处理、忽略或被归类为误报的关键和中等严重程度问题的百分比:
这些共同构成了三个明确的档位。从 Lite 到 Balanced 再到 Max,开发者会处理更多问题。因此,在迭代过程中,Lite 更适合频繁审查;越接近最终版本,则应转向 Balanced 和 Max。
各档位费用如何?
每个档位瞄准特定的价格和质量区间,目标成本从一个档位到下一个大约上涨 6×。Lite 专为迭代期间的频繁审查设计。Max 专为合并前的全面检查设计。
Balanced 介于两者之间,在快速迭代和最终审查之间提供了一个折中方案。
Max 对你的要求也更高。每次审查平均留下约两个问题,而 Lite 和 Balanced 大约为 1.1 到 1.2 个,因此需要阅读的内容更多。当遗漏的 bug 通常比审查本身代价更高时,使用它是值得的。
各档位需要多长时间?
审查时间也很重要。有时在开发过程中你需要快速反馈,有时正确性和彻底性比速度更重要。
Lite 和 Balanced 通常约四分钟完成。Max 中位数约需 12 分钟,第 90 百分位时可达 20 分钟,因此最适合作为最终检查。
仅供参考的起点
这是当前各层级的现状快照。随着新模型的上线和我们的方案不断优化,我们将更新每个层级,使其在各自的价格区间内提供尽可能出色的性能。
下一步:匹配变更规模的审查投入
每个层级都使用相同的工具和审查提示词。层级决定了 Copilot 代码审查的严格程度。您代码仓库的上下文决定了它该关注什么,包括您团队的规范、您允许的例外,以及您的审查者反复发现的那些错误。
一个 pull request 的不同部分可能也需要不同级别的关注。某些部分可能需要前沿模型,而较小的模型或许就足以处理其他部分。我们正在朝动态代码审查的方向迈进,从一组审查角色中将审查员派往 pull request 的特定部分,并根据其需求定制审查内容。
目标始终是一次有用的审查:增加发现重要问题的机会,而不将梳理审查结果的负担转回给您。
在您的下一个高风险 pull request 中试试 Max 层级。
致谢
感谢 GitHub 和 Microsoft 中帮助我们实现这些新层级的科学、工程和产品团队!
Alejandro 的工作聚焦于评估编码智能体、改进它们对代码变更和代码仓库上下文的推理能力,以及优化模型质量、覆盖率、延迟和 token 成本。
Timothée Defoin 是 GitHub 的应用研究员,自 Copilot 早期阶段起便致力于其模型和 AI 系统的工作。他的研究涵盖后训练和智能
本文由 AI图鉴自动抓取并翻译,版权归原作者所有;如需查看原文请点下方链接。
Agents are writing more of our code every day, and every pull request still needs a review before it merges. Human reviewers can’t read every line of that growing volume, so teams are using AI to help.
An AI reviewer has to clear a hard bar, though. If it misses real bugs, nobody trusts its silence. If it buries those bugs in false alarms, nobody reads its comments.
Getting both right means finding actionable bugs, keeping false positives low, and holding latency and cost in check. At a fixed price, we’ve found that several smaller, independent reviewers using complementary models often outperform a single reviewer powered by a stronger model. We used that idea to rebuild Copilot code review’s Lite and Balanced tiers and to launch a new Max tier for your highest-stakes pull requests. This post explains why that works, how we turn many reviewers’ findings into one review, and how we used the idea to rebuild Copilot code review’s tiers.
Why does this work? A simple example
Consider a review agent with a fixed prompt, model, and set of tools. Suppose it has a 60% chance of flagging a particular bug in a pull request. It might catch that bug on one pass and miss it on the next.
If we run that reviewer twice, independently and in parallel, the probability that at least one run finds the bug rises to 84%, while the cost doubles. With three independent runs, the probability rises to 94%, while the cost triples.
More generally, if each reviewer has probability p of finding a particular bug, the probability that at least one of n independent reviewers finds it is 1 − (1 − p)^n. In our example, p = 0.6. The key is that only one reviewer needs to find the bug.
Running several reviewers also has a cost in time. Review time can increase modestly because we have to wait for the slowest reviewer to finish.
Same-model and mixed-model reviews
Repeatedly running the same reviewer only takes us so far. We start to see diminishing returns after the third run.
Each model also has biases shaped by its training. Some bugs remain difficult for a given model to flag, no matter how many times it reviews a pull request. Models have particular strengths when reviewing code, and they also have specific blind spots.
To illustrate this, we used ReviewBench to measure the percentage of critical bugs found using GPT-6.1 Sol (high reasoning), Claude Opus 5.5 (high reasoning), and combinations of the two. You can read more about ReviewBench in our earlier blog post.
In the chart below, the dashed line shows the highest percentage of critical bugs found at each price point by repeatedly running either GPT-6.1 Sol or Claude Opus 5.5. The solid line shows the highest percentage found by combining the two models.
The solid line is always at or above the dashed line, because a mix can include the single-model option. What matters is the gap between them, which shows the improvement available from mixing models. At $3 per pull request, combining these two models raises the share of critical bugs caught on ReviewBench by 4.9 percentage points, from 61.3% to 66.2%.
Copilot code review can draw on models from different providers, so it isn’t limited to one model family’s strengths and blind spots. That flexibility lets us pick complementary reviewers that perform best at a given price point.
Cohesive reviews
When two independent reviewers examine the same code, they may find some of the same bugs, and each may find issues the other misses. To reduce noise and avoid reporting the same issue several times, we combine their findings into one cohesive review. That means deduplicating findings and removing false positives.
Copilot code review uses two strategies to do this: voting and agentic aggregation.
Voting deduplicates the findings from all reviewers and counts how many reviewers flagged each one. Findings with fewer votes than a set threshold are suppressed, on the assumption that fewer votes signals lower confidence. Voting is fast and cost-effective, because deduplication takes only one-shot LLM calls.
Agentic aggregation uses an agent to reconcile the findings from all reviewers into one review. The agent can curate and refine findings, resolve disagreements, and double-check that each finding is accurate. In exchange, the review takes longer and costs more.
Let’s look at an example of a pull request that changes src/catalog/service.py, a Python file:
from catalog import cache, repository as repo
CACHE_TTL_SECONDS = 60
def get_product(product_id):
cached = cache.get(product_id)
if cached is not None:
return cached
product = repo.find(product_id)
if product is not None:
cache.put(
product_id,
product,
ttl_ms=CACHE_TTL_SECONDS,
)
return product
def rename_product(product_id, name):
repo.rename(product_id, name)
Three independent reviewers examine the changes and produce these findings:
The first two findings are true positives. The cache expects expiration times in milliseconds, and renaming a product updates the database but leaves its cached snapshot unchanged. A closer look at src/api/products.py, a file this pull request didn’t change, tells a different story about the third finding:
from catalog.service import get_product
def product_endpoint(product_id):
product = get_product(product_id)
if product is None:
return 404, {"error": "Not found"}
return 200, {"name": product["name"]}
An existing guard already returns a 404 for a missing product, so the third finding is a false positive. Now consider what happens as we vary the voting threshold, which is the number of reviewers that must flag an issue before we show it:
With a threshold of one vote, we flag two real bugs and one false positive. Raising the threshold to two removes the false positive and leaves only real bugs, which raises precision. Raising it to three drops one of the real bugs, which lowers recall.
Voting gives us a cheap, fast, and simple way to curate findings. The challenge is choosing the right threshold, which can vary between pull requests. Agentic aggregation lets a more capable model check each finding, remove false positives, and filter out low-severity nits. In this example, an aggregator that checked src/api/products.py could drop the false positive and keep both real bugs, at the cost of a longer, more expensive review.
Voting rewards agreement and controls noise, which makes it useful when cost and latency are tight. Agentic aggregation costs more and, in our experiments, produced higher-quality findings.
New review tiers
We used independent, complementary reviewers and aggregation to rebuild our existing Lite and Balanced tiers and to launch a new Max tier. At a high level, each tier reviews your pull request with these agents:
Lite: 4× GPT-5.6 Luna reviewers, combined with voting.
Balanced: 3× GPT-6.1 Sol reviewers, combined with agentic aggregation by GPT-6 Astra.
Max: 4× GPT-6.1 Sol, 2× Claude Opus 5.5, and 2× GPT-6 Astra reviewers, combined with agentic aggregation by GPT-6.1 Sol.
To develop and iterate on the initial configurations for all three tiers, we used ReviewBench, a benchmark for code review agents built on representative GitHub pull requests and production-aligned metrics. We then ran several rounds of online experiments on internal and external traffic.
How we measure
Online experiments: In total, 1.4 million pull requests, including external ones, were involved in the online experiments to design the lite and balanced tiers between September 16 and October 7. We used 30K internal reviews within GitHub and Microsoft between October 2 and 7 to design and test the Max tier.
Severity: Each finding is labeled critical, moderate, or low by a separate agent using a rubric. A critical comment is a concrete problem that should be fixed before merging; a moderate one is an issue that affects behavior but is unlikely to cause serious harm, while a low severity comment is one that describes a minor improvement that can safely be deferred.
Precision: The share of findings that are real issues.
Recall: The share of real issues that Copilot code review found. We estimate this at review time by looking at the comments and issues identified by other agents or humans and comparing them to those flagged by Copilot code review.
Addressed/Ignored/False positive: Just as we have a separate agent label severity, we also have an agent check whether a comment was addressed or ignored. An addressed comment is one which is fixed when the pull request merges, while an ignored one is one on which a user does not act upon. A false positive is a comment that a user has explicitly indicated is incorrect or invalid.
Here’s how the final tier configurations performed online:
What is the difference in coverage and quality?
First, let’s compare the average number of findings per review for each tier, broken down by severity:
Max provides the greatest coverage, especially of critical issues, which was our goal. Lite and Balanced produce a similar total number of findings per review, and Lite produces more critical and low-severity findings. Balanced finds fewer issues than Lite, but more of them are worth fixing.
The chart below shows the percentage of critical and moderate findings that developers addressed, ignored, or that were classified as false positives, for each tier:
Together, these form three distinct tiers. Developers act on more findings as you move from Lite to Balanced to Max. That makes Lite better for frequent review while you’re iterating, and moving to Balanced and Max as you get closer to final.
How much do the tiers cost?
Each tier targets a specific price and quality range, with target costs rising roughly 6× from one tier to the next. Lite is designed for frequent reviews as you iterate. Max is designed for a thorough pass before you merge.
Balanced sits between them, offering a middle ground between fast iteration and a final review.
Max also asks more of you. It leaves about two findings per review, compared with about 1.1 to 1.2 for Lite and Balanced, so there’s more to read. It’s worth using it where a missed bug would typically cost more than the review.
How long does each tier take?
Review time matters too. Sometimes you need fast feedback while you build. Other times, correctness and thoroughness matter more than speed.
Lite and Balanced typically finish in about four minutes. Max takes about 12 minutes at the median and can take 20 minutes at the 90th percentile, so it fits best as a final pass.
Just a starting point
This is a snapshot of where the tiers stand today. As new models become available and our approach improves, we’ll update each tier to deliver the best performance we can within its price range.
Next: Review effort that fits the change
Every tier uses the same tools and review prompt. The tier sets how hard Copilot code review looks. Your repository’s context sets what it knows to look for, including your team’s conventions, the exceptions you allow, and the mistakes your reviewers keep catching.
Different parts of a pull request may also need different levels of attention. Some may require a frontier model, while a smaller model may be sufficient for others. We’re working toward dynamic code review, dispatching reviewers from a roster of review personas to specific parts of a pull request and tailoring the review to its needs.
The goal remains one useful review: more chances to catch important issues, without handing the work of sorting through findings back to you.
Try the Max tier on your next high-stakes pull request.
Acknowledgments
Thank you to the science, engineering, and product teams across GitHub and Microsoft who helped make these new tiers a reality!
Alejandro's work focuses on evaluating coding agents, improving how they reason over code changes and repository context, and optimizing model quality, coverage, latency, and token cost.
Timothée Defoin is an Applied Researcher at GitHub, working on Copilot's models and AI systems since its early days. His work spans both post-training and agenti
Auto-fetched and translated by AI Atlas. All rights belong to the original author.