一句话:提出基于搜索的补丁生成框架 PSearch,通过迭代评估与精化提升 LLM 自动程序修复效果并降低成本。
现有基于 LLM 的自动程序修复(APR)多依赖试错式补丁采样,探索缺乏结构,难以评估搜索方向前景并有效分配预算。作者提出 PSearch:以迭代补丁评估与精化为中心的搜索式补丁生成框架。它维护中间补丁的结构化搜索状态,持续评估已探索路径的潜力,优先精化最有希望的路径,从而尽早放弃弱方向,并通过长时程搜索逼近正确修复;该框架可集成不同搜索算法,当前采用蒙特卡洛树搜索。在五个缺陷与漏洞基准上,PSearch 在 Defects4J 修复 201/835 个缺陷,优于 12 个先进基线;在 VUL4J 修复 27/79 个漏洞;在 SWE-Bench-Lite 解决 164/300 个问题;补丁规模为 16 时成本约为强基线的 50%,且修复效果更优。
Large Language Models (LLMs) have substantially advanced Automated Program Repair (APR), yet most existing LLM-based APR methods still rely on trial-and-error to generate patches. Such a strategy explores candidate patches in a weakly structured manner, making it difficult to assess the future potential of search directions and allocate search budget effectively. To address this limitation, we propose Psearch, a search-based patch generation framework for LLM-based APR centered on iterative patch evaluation and refinement. Instead of treating patch generation as repeated independent sampling, Psearch maintains a structured search state over intermediate patches, continuously evaluates the promise of explored search paths, and prioritizes the most promising ones for further refinement. This design enables Psearch to abandon weak directions early and progressively approach correct fixes through long-horizon search. Importantly, Psearch can be integrated with different search algorithms, while our current implementation adopts Monte Carlo Tree Search as one effective instantiation. We evaluate Psearch on five widely used bug and vulnerability benchmarks. Experimental results show that Psearch correctly repairs 201 out of 835 bugs in Defects4J, outperforming all 12 state-of-the-art baselines. Psearch also fixes 27 of 79 vulnerabilities in VUL4J and resolves 164 of 300 issues in SWE-Bench-Lite. Moreover, with a patch size of 16, Psearch reduces monetary cost to roughly 50% of strong baselines while maintaining superior repair effectiveness. These results highlight the effectiveness of Psearch for improving LLM-based APR.