Keywords: Commit Message Generation, Sliding Window, Change Attention, Change Alignment Loss, Human Evaluation
Abstract: Commit messages play a crucial role in understanding code change intent and tracking software evolution, and automatically generating high-quality commit messages is important for improving software maintenance efficiency.Although existing methods have made preliminary attempts to capture the semantics of diff, semantic associations across hunks and the semantic alignment between the diff and its commit message have not been further explored.In this paper, we propose a change-aware model for commit message generation called CAMCMG, which focuses on the hunk associations in code change and alignment between code change and commit message. Specifically, it adopts a local attention mechanism based on a sliding window to capture local contextual information around hunks, a CMG-oriented change attention mechanism to model semantic associations across hunks, and a change alignment loss to optimize the model to enhance the generation of change-aligned tokens during the training phase. Experimental results show that CAMCMG achieves an average improvement of 6.4% on automatic evaluation metrics and 5.2% on human evaluation metrics Ablation studies further demonstrate the effectiveness of each component, where local attention, change attention, and change alignment loss contribute average improvements of 5.1%, 9.6%, and 7.1%, respectively, on the automatic evaluation metrics.
Paper Type: Long
Research Area: Code Models
Research Area Keywords: Commit Message Generation
Languages Studied: English
Submission Number: 8618
Loading