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

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Nashid, Noor, Ding, Daniel, Gallaba, Keheliya, Hassan, Ahmed E., Mesbah, Ali
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866912715346280448
author Nashid, Noor
Ding, Daniel
Gallaba, Keheliya
Hassan, Ahmed E.
Mesbah, Ali
author_facet Nashid, Noor
Ding, Daniel
Gallaba, Keheliya
Hassan, Ahmed E.
Mesbah, Ali
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2506_04418
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Characterizing Multi-Hunk Patches: Divergence, Proximity, and LLM Repair Challenges
Nashid, Noor
Ding, Daniel
Gallaba, Keheliya
Hassan, Ahmed E.
Mesbah, Ali
Software Engineering
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.
title Characterizing Multi-Hunk Patches: Divergence, Proximity, and LLM Repair Challenges
topic Software Engineering
url https://arxiv.org/abs/2506.04418