用梯度优化修复代码,让程序自动学会改错。
Gradient-Based Program Repair: Fixing Bugs in Continuous Program Spaces
- 将代码编译成可微分的数值表示,通过梯度搜索修复错误。
- 在1466个测试用例上实现有效修复,修复过程路径清晰。
- 适合对程序自动修复和神经符号方法感兴趣的读者。
自动程序修复旨在从有缺陷的程序中生成正确代码,现有方法通常在离散的符号源码词元空间中搜索正确程序,但受限于无法直接推理程序行为。本文提出基于梯度的程序修复(GBPR),将程序修复重构为可微分数值程序空间中的连续优化问题。核心思想是将符号程序编译为可微分的数值表示,从而在数值空间中直接根据程序行为进行搜索。为评估GBPR,我们构建了RaspBugs基准,包含1,466个有缺陷的符号RASP程序及其对应的数值表示。实验表明,GBPR可通过数值空间中的梯度优化有效修复有缺陷的符号程序,修复轨迹令人信服。据我们所知,这是首个将程序修复表述为数值程序空间中连续优化的工作,展示了该方向在程序修复研究中的可行性,实现了连续优化与程序行为的桥梁。
原文摘要 · Abstract (English)
Automatic program repair seeks to generate correct code from buggy programs, with most approaches searching the correct program in a discrete, symbolic space of source code tokens. This symbolic search is fundamentally limited by its inability to directly reason about program behavior. We introduce Gradient-Based Program Repair (GBPR), a new approach that recasts program repair as continuous optimization in a differentiable numerical program space. Our core insight is to compile symbolic programs into differentiable numerical representations, enabling search in the numerical program space directly guided by program behavior. To evaluate GBPR, we present RaspBugs, a new benchmark of 1,466 buggy symbolic RASP programs and their respective numerical representations. Our experiments demonstrate that GBPR can effectively repair buggy symbolic programs by gradient-based optimization in the numerical program space, with convincing repair trajectories. To our knowledge, we are the first to state program repair as continuous optimization in a numerical program space. Our work demonstrates the feasibility of this direction for program repair research, bridging continuous optimization and program behavior.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。