Characterizing Multi-Hunk Patches: Divergence, Proximity, and LLM Repair Challenges
Noor Nashid, Daniel Ding, Keheliya Gallaba, Ahmed E. Hassan, Ali Mesbah

TL;DR
This paper analyzes multi-hunk bug fixes, introduces metrics for divergence and proximity, and reveals that current LLMs struggle with dispersed, complex patches, highlighting the need for divergence-aware repair methods.
Contribution
It introduces HUNK4J, a multi-hunk patch dataset, and proposes divergence and proximity metrics to better understand LLM repair challenges.
Findings
LLMs' success decreases with higher divergence and dispersion.
No LLM succeeds on highly dispersed multi-hunk patches.
The study highlights a gap in LLM capabilities for complex, multi-hunk repairs.
Abstract
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…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware Engineering Research · Software Testing and Debugging Techniques · Advanced Data Storage Technologies
