Skip to main content
QUICK REVIEW

[论文解读] Consistent or Sensitive? Automated Code Revision Tools Against Semantics-Preserving Perturbations

Shirin Pirouzkhah, Souhaila Serbout|arXiv (Cornell University)|Feb 16, 2026
Software Engineering ResearchComputer Science被引用 0
一句话总结

本论文研究基于 transformer 的 Automated Code Revision (ACR) 工具在语义保持的代码扰动下的表现,发现一致性最高下降到 45.3%,且输入表示策略的缓解效果有限。

ABSTRACT

Automated Code Revision (ACR) tools aim to reduce manual effort by automatically generating code revisions based on reviewer feedback. While ACR tools have shown promising performance on historical data, their real-world utility depends on their ability to handle similar code variants expressing the same issue - a property we define as consistency. However, the probabilistic nature of ACR tools often compromises consistency, which may lead to divergent revisions even for semantically equivalent code variants. In this paper, we investigate the extent to which ACR tools maintain consistency when presented with semantically equivalent code variants. To do so, we first designed nine types of semantics-preserving perturbations (SPP) and applied them to 2032 Java methods from real-world GitHub projects, generating over 10K perturbed variants for evaluation. Then we used these perturbations to evaluate the consistency of five state-of-the-art transformer-based ACR tools. We found that the ACR tools' ability to generate correct revisions can drop by up to 45.3%, when presented with semantically equivalent code. The closer the perturbation is to this targeted region, the more likely an ACR tool is to fail to generate the correct revision. We explored potential mitigation strategies that modify the input representation, but found that these attention-guiding heuristics yielded only marginal improvements, thus leaving the solution to this problem as an open research question.

研究动机与目标

  • 评估语义保持扰动(SPP)如何影响 ACR 工具的一致性。
  • 识别与不一致相关的扰动特征。
  • 评估输入表示策略以缓解不一致。
  • 通过将扰动与模型失败关联,提供逐扰动的受控分析。

提出的方法

  • 构建包含评审注释与真实编辑的2032个真实世界 Java 方法修订数据集。
  • 设计九种面向控制流、数据流和标识符命名的语义保持扰动。
  • 应用扰动以创建超过 10,000 个语义等价变体。
  • 在原始输入和扰动输入上评估五种基于 transformer 的 ACR 工具。
  • 采用每个模型可解子集和一个交集子集(464 个实例)以实现公平的跨模型比较。
  • 使用 Exact Match (EXM)、CodeBLEU、Edit Match (EM) 和 Relative Edit Error (REE) 来衡量一致性。
Figure 1 . Code revision iterations and ACR tool in the process
Figure 1 . Code revision iterations and ACR tool in the process

实验结果

研究问题

  • RQ1RQ1: 语义保持扰动如何影响最先进 ACR 工具的一致性?
  • RQ2RQ2: 扰动特征是否与 ACR 工具的不一致相关?
  • RQ3RQ3: 输入表示的改变是否能在对抗 SPP 时降低不一致?

主要发现

  • 在 SPP 下,ACR 工具的一致性下降,在最坏情况下正确修订的比例下降高达 45.3%。
  • 当扰动重构控制流或改变数据流时,降幅最大,而不仅仅是添加死代码。
  • 接近评审者目标行的扰动会导致更多在生成正确修订方面的失败。
  • 对注意力的缓解措施仅带来边际改进,问题仍然大致存在。
  • 研究使用 2032 个实例的数据集,为每个模型选择可解子集,并为跨模型比较保留 464 实例的交集。
  • 扰动通过基于 AST 的自动化框架使用 JavaParser 实现,以确保语法有效性。
Figure 2 . Example of original code ( 1 ), its semantically equivalent variant ( 2 ) and their expected revisions ( 3 & 4 ).
Figure 2 . Example of original code ( 1 ), its semantically equivalent variant ( 2 ) and their expected revisions ( 3 & 4 ).

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。