一句话:提出 hunk divergence 与空间邻近性度量,刻画多 hunk 补丁并揭示 LLM 修复成功率随差异性与分散度上升而下降。
多 hunk 缺陷指修复跨越代码中互不相交的区域,在实践中常见,但自动修复研究多聚焦单 hunk 场景,忽视了跨代码库协调语义相关修改的额外复杂性。本文构建了 Hunk4J——一个源自 372 个真实缺陷的多 hunk 补丁数据集,并据此展开刻画研究。作者提出 hunk divergence 指标,通过词法、结构及文件层面的差异并结合 hunk 数量,量化补丁内部编辑之间的差异程度;同时定义 spatial proximity 分类,刻画各 hunk 在程序层次结构中的空间分布方式。基于六个 LLM 的实证研究表明,模型修复成功率随差异性与空间分散度的增加而下降;尤其在使用 LLM 单独修复时,没有任何模型能在最分散的 Fragment 类别中取得成功。这些发现揭示了 LLM 能力的关键缺口,并推动差异感知的修复策略。
Multi-hunk bugs, where fixes span disjoint regions of code, are common in practice, yet remain underrepresented in automated repair. Existing techniques and benchmarks predominantly 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.
DOI 原文 ·
@inproceedings{paperbot9244,
title = {Characterizing Multi-Hunk Patches: Divergence, Proximity, and LLM Repair Challenges},
author = {Noor Nashid and Daniel Ding and Keheliya Gallaba and Ahmed E. Hassan and Ali Mesbah},
booktitle = {ASE},
year = {2025},
doi = {10.1109/ase63991.2025.00137}
}