Jinrui Sun
Author directory2026
HierDiff: Enhancing Large Language Models for Commit Message Generation with Hierarchical Diff Information
Jinrui Sun | Tong Jia | Minghua He | Ying Li
Findings of the Association for Computational Linguistics: EMNLP 2026
Jinrui Sun | Tong Jia | Minghua He | Ying Li
Findings of the Association for Computational Linguistics: EMNLP 2026
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/.