HierDiff: Enhancing Large Language Models for Commit Message Generation with Hierarchical Diff Information

Jinrui Sun, Tong Jia, Minghua He, Ying Li


Abstract
Commit messages are vital artifacts that summarize changes to facilitate software maintenance, debugging, and evolution tracking. However, existing Commit Message Generation (CMG) methods rely solely on code diffs and overlook higher-level architectural dependency diff information. To address this limitation, we propose HierDiff, a framework using architectural diffs to complement code diffs for improved commit generation. Through this framework, we further construct HierCMD, a new dataset that incorporates architectural diffs alongside much longer code diffs. Building on this resource, we develop HierDiff-6.7B, a lightweight CMG model trained via multi-stage hierarchical diff learning. To enable more rigorous evaluation, we additionally extend the existing MCMD-New-Test benchmark by incorporating architectural diff information, resulting in MCMD-New-TestX. Experimental results on MCMD-New-TestX and HierCMD demonstrate that HierDiff-6.7B achieves state-of-the-art performance in CMG, even surpassing the renowned closed-source model GPT-4o by 2.1% to 29.8% across four evaluation metrics. We release the data and code at: https://anonymous.4open.science/r/HierDiff/.
Anthology ID:
2026.findings-emnlp.451
Volume:
Findings of the Association for Computational Linguistics: EMNLP 2026
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Hung-Yi Lee, Sunipa Dev, Jessy Li, Desmond Elliott
Venue:
Findings
SIG:
SIGDAT
Publisher:
Association for Computational Linguistics
Note:
Pages:
9466–9480
Language:
URL:
https://aclanthology.org/2026.findings-emnlp.451/
DOI:
Bibkey:
Cite (ACL):
Jinrui Sun, Tong Jia, Minghua He, and Ying Li. 2026. HierDiff: Enhancing Large Language Models for Commit Message Generation with Hierarchical Diff Information. In Findings of the Association for Computational Linguistics: EMNLP 2026, pages 9466–9480, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
HierDiff: Enhancing Large Language Models for Commit Message Generation with Hierarchical Diff Information (Sun et al., Findings 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.findings-emnlp.451.pdf