paperbot · PL 论文追踪

全部论文 待读 收藏

P2 A Differential Fuzzing-Based Evaluation of Functional Equivalence in LLM-Generated Code Refactorings

基于差分模糊测试的 LLM 生成代码重构功能等价性评估
FSE Proceedings of the 34th ACM International Conference on the Foundations of Software Engineering2026匹配度 3/10 · 论文使用差分模糊测试评估 LLM 生成代码重构的功能等价性,属于 LLM 代码生成质量评估与动态测试,而非用户关注的静态分析/形式化验证与 LLM 的交叉、浮点或贝叶斯程序分析。虽然问题驱动且使用较强模型,但研究目标本身是评估 LLM 输出,与画像核心方向匹配度低。引用 2 inbox
Simantika Bhattacharjee Dristi, Matthew B. Dwyer
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:用差分模糊测试检验 LLM 代码重构的功能等价性,发现 19–35% 的重构会改变程序语义。

随着大语言模型(LLM)被广泛用于自动化代码重构,如何确保 LLM 生成的重构与原始实现功能等价变得至关重要。现有工作通常依赖预定义测试用例来评估正确性,本文则采用差分模糊测试来检查 LLM 生成重构的功能等价性:该方法无需预定义测试用例,而是自动生成并执行成千上万个测试输入,比较原程序与重构程序的行为,从而探索更大的输入空间。作者对六种 LLM(CodeLlama、Codestral、Star-Chat2、Qwen-2.5、Olmo-3 和 GPT-4o)在三个数据集、两类重构任务上进行了大规模评估。结果表明,LLM 存在不可忽视的改动程序语义倾向,产生了 19–35% 功能不等价的重构;其中约 21% 的不等价重构未被所评估的三个数据集既有测试套件检测到。这些发现说明,依赖既有测试可能高估 LLM 生成代码重构的功能等价性,此类重构仍容易出现语义偏差。

问题
评估 LLM 生成的代码重构是否与原实现功能等价时,先前工作多依赖预定义测试用例,可能无法充分覆盖输入空间并低估语义偏差。
方法
使用差分模糊测试作为等价性检查器,不依赖预定义测试用例,通过自动生成并执行数千个测试输入,比较原程序与 LLM 重构程序的行为差异。
评估
在三个数据集和两类重构任务上对六种 LLM 进行大规模评估,发现 19–35% 的重构功能不等价,且约 21% 的不等价重构未被现有测试套件检测到。
原文摘要(Abstract)

With the rapid adoption of large language models (LLMs) in automated code refactoring, assessing and ensuring functional equivalence between LLM-generated refactoring and the original implementation becomes critical. While prior work typically relies on predefined test cases to evaluate correctness, in this work, we leverage differential fuzzing to check functional equivalence in LLM-generated code refactorings. Unlike test-based evaluation, a differential fuzzing-based equivalence checker needs no predefined test cases and can explore a much larger input space by executing and comparing thousands of automatically generated test inputs. In a large-scale evaluation of six LLMs (CodeLlama, Codestral, Star-Chat2, Qwen-2.5, Olmo-3, and GPT-4o) across three datasets and two refactoring types, we find that LLMs show a non-trivial tendency to alter program semantics, producing 19–35% functionally non-equivalent refactorings. Our experiments further demonstrate that about 21% of these non-equivalent refactorings remain undetected by the existing test suites of the three evaluated datasets. Collectively, the findings of this study imply that reliance on existing tests might overestimate functional equivalence in LLM-generated code refactorings, which remain prone to semantic divergence.

链接与引用

DOI 原文 · arXiv · PDF(开放获取) · DBLP

BibTeX
@inproceedings{abs-2602-15761,
  title = {A Differential Fuzzing-Based Evaluation of Functional Equivalence in LLM-Generated Code Refactorings},
  author = {Simantika Bhattacharjee Dristi and Matthew B. Dwyer},
  booktitle = {FSE},
  year = {2026},
  doi = {10.1145/3803437.3806717}
}