Brevity is the Soul of Wit: Condensing Code Changes to Improve Commit Message Generation

📅 2025-09-19
📈 Citations: 0
Influential: 0
📄 PDF

career value

148K/year
🤖 AI Summary
Developers often neglect writing high-quality commit messages, hindering code comprehension and maintenance. To address limitations in existing automated approaches—particularly in change representation and organization—this paper proposes a three-part structured textual template comprising a change summary, comment prompts, and key identifiers. We introduce ChangeScribe to generate concise, semantically accurate change summaries and employ heuristic rules to compress code changes into the template. Furthermore, we fine-tune CodeLlama-7B to effectively process this structured input. Our method preserves human readability while substantially unlocking the capabilities of large language models. Evaluated on standard benchmarks, it outperforms six state-of-the-art baselines across all metrics: BLEU-Norm improves by 51.7%, METEOR by 78.7%, and ROUGE-L by 62.5%. These results empirically validate the efficacy of structured compression for commit message generation.

Technology Category

Application Category

📝 Abstract
Commit messages are valuable resources for describing why code changes are committed to repositories in version control systems (e.g., Git). They effectively help developers understand code changes and better perform software maintenance tasks. Unfortunately, developers often neglect to write high-quality commit messages in practice. Therefore, a growing body of work is proposed to generate commit messages automatically. These works all demonstrated that how to organize and represent code changes is vital in generating good commit messages, including the use of fine-grained graphs or embeddings to better represent code changes. In this study, we choose an alternative way to condense code changes before generation, i.e., proposing brief yet concise text templates consisting of the following three parts: (1) summarized code changes, (2) elicited comments, and (3) emphasized code identifiers. Specifically, we first condense code changes by using our proposed templates with the help of a heuristic-based tool named ChangeScribe, and then fine-tune CodeLlama-7B on the pairs of our proposed templates and corresponding commit messages. Our proposed templates better utilize pre-trained language models, while being naturally brief and readable to complement generated commit messages for developers. Our evaluation based on a widely used dataset showed that our approach can outperform six baselines in terms of BLEU-Norm, METEOR, and ROUGE-L, with average improvements of 51.7%, 78.7%, and 62.5%, respectively. The ablation study and human evaluation also provide further insights into the effectiveness of our approach.
Problem

Research questions and friction points this paper is trying to address.

Automating commit message generation for code changes
Condensing code changes into concise text templates
Improving readability and quality of generated commit messages
Innovation

Methods, ideas, or system contributions that make the work stand out.

Condense code changes using text templates
Fine-tune CodeLlama-7B on template-message pairs
Utilize ChangeScribe for heuristic-based code summarization
🔎 Similar Papers
No similar papers found.
H
Hongyu Kuang
State Key Lab of Novel Software Technology, Nanjing University, Nanjing, China
N
Ning Zhang
State Key Lab of Novel Software Technology, Nanjing University, Nanjing, China
H
Hui Gao
State Key Lab of Novel Software Technology, Nanjing University, Nanjing, China
X
Xin Zhou
State Key Lab of Novel Software Technology, Nanjing University, Nanjing, China
W
Wesley K. G. Assunção
CSC, North Carolina State University, Raleigh, USA
Xiaoxing Ma
Xiaoxing Ma
Professor of Computer Science and Technology, Nanjing University
software engineeringself-adaptive systemsreliability of machine learning
D
Dong Shao
State Key Lab of Novel Software Technology, Nanjing University, Nanjing, China
G
Guoping Rong
State Key Lab of Novel Software Technology, Nanjing University, Nanjing, China
H
He Zhang
State Key Lab of Novel Software Technology, Nanjing University, Nanjing, China