arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2506.04418cs.SE
收藏

多代码块补丁的特征刻画:差异性、邻近性与大语言模型修复挑战

Characterizing Multi-Hunk Patches: Divergence, Proximity, and LLM Repair Challenges

University of British Columbia(不列颠哥伦比亚大学)

Noor Nashid, Daniel Ding, Keheliya Gallaba, Ahmed E. Hassan, Ali Mesbah

AI总结:

针对现有自动化修复研究多聚焦单代码块场景的不足,本研究构建多代码块补丁数据集HUNK4J,提出代码块差异性指标与空间邻近性分类,通过实证实验揭示大语言模型在高分散多代码块缺陷修复上的能力缺口。

摘要:

修复点分布在代码不相交区域的多代码块(multi-hunk)缺陷在实际场景中十分常见,但在自动化修复领域的相关研究仍十分不足。现有技术与基准大多针对单代码块场景,忽略了在整个代码库中协调语义关联变更所带来的额外复杂度。本研究对HUNK4J进行特征刻画,这是一个源自372个真实缺陷的多代码块补丁数据集。我们提出了代码块差异性(hunk divergence)指标,通过捕捉词汇、结构与文件层面的差异,同时纳入涉及的代码块数量,量化补丁中各编辑操作间的差异程度。我们进一步定义了空间邻近性分类,建模代码块在程序层级中的空间分布模式。我们覆盖6款大语言模型的实证研究表明,模型成功率随差异性与空间分散程度提升而下降。值得注意的是,仅使用大语言模型时,没有模型能在分散程度最高的Fragment类别上修复成功。这些发现凸显了大语言模型能力的关键缺口,为感知差异性的修复策略研发提供了依据。

英文摘要:

Multi-hunk bugs, where fixes span disjoint regions of code, are common in practice, yet remain underrepresented in automated repair. Existing techniques and benchmarks pre-dominantly target single-hunk scenarios, overlooking the added complexity of coordinating semantically related changes across the codebase. In this work, we characterize HUNK4J, a dataset of multi-hunk patches derived from 372 real-world defects. We propose hunk divergence, a metric that quantifies the variation among edits in a patch by capturing lexical, structural, and file-level differences, while incorporating the number of hunks involved. We further define spatial proximity, a classification that models how hunks are spatially distributed across the program hierarchy. Our empirical study spanning six LLMs reveals that model success rates decline with increased divergence and spatial dispersion. Notably, when using the LLM alone, no model succeeds in the most dispersed Fragment class. These findings highlight a critical gap in LLM capabilities and motivate divergence-aware repair strategies.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑