Abstract
Commit messages are essential for software maintenance and collaboration, yet they are frequently neglected by developers. While Automated Commit Message Generation (CMG) aims to solve this, existing benchmarks often rely on low-quality, noisy data from the wild. This paper presents a systematic study of Large Language Models (LLMs) in the context of CMG. We introduce MCMDEval+, a high-quality multi-lingual dataset, and ERICommiter, a framework that leverages efficient retrieval-based In-Context Learning (ICL) to enhance LLM performance. Our results demonstrate that LLMs significantly outperform previous state-of-the-art models, particularly when provided with high-quality reference examples.
Introduction
In modern software engineering, commit messages serve as the primary documentation for code changes. However, the manual creation of these messages is often viewed as a tedious task, leading to uninformative or missing descriptions. Automated Commit Message Generation (CMG) has emerged as a research area to address this, but the field has been hampered by two primary issues: the poor quality of training and evaluation data, and a lack of rigorous exploration into how Large Language Models (LLMs) can be optimally applied to this specific domain.
This study addresses these gaps by auditing existing datasets, establishing a new gold standard for evaluation, and proposing a retrieval-augmented framework to maximize the utility of LLMs in generating meaningful commit messages.
The Data Quality Crisis in CMG
Most existing CMG datasets, such as the Multi-lingual Commit Message Dataset (MCMD), are constructed by crawling GitHub repositories. A pilot analysis conducted in this research revealed that these "in the wild" datasets are plagued by low-quality entries. Many human-written messages lack the two essential components of good documentation: the "What" (a description of the change) and the "Why" (the rationale behind it).
When models are trained or evaluated on such noisy data, they learn to replicate these deficiencies. To rectify this, we developed MCMDEval+. This new benchmark consists of 500 high-quality samples for each of eight programming languages: Java, Python, C#, C++, JavaScript, Go, PHP, and Rust. Each sample was filtered to ensure it contains both "What" and "Why" information, providing a more rigorous test for modern CMG systems.
The ERICommiter Framework
To improve the performance of LLMs like GPT-3.5 and Gemini, we introduce ERICommiter (Efficient Retrieval-based In-context commiter). While In-Context Learning (ICL) allows LLMs to learn from examples in the prompt, retrieving relevant examples from millions of historical commits is computationally expensive.
ERICommiter employs a two-step filtering system to maintain efficiency:
- Quality Filtering: A Bi-LSTM classifier prunes the commit database based on length and quality metrics to ensure only high-quality messages are considered as potential examples.
- Dual Retrieval: The framework uses either lexical retrieval (BM25) or semantic retrieval (CodeReviewer) to find the most similar historical commits to the current code diff.
This approach reduces retrieval time to approximately 6-7% of the original overhead while significantly boosting the quality of the generated output.
Experimental Evaluation and Results
The study compared several LLMs (GPT-3.5, LLaMA-7B/13B, and Gemini) against traditional state-of-the-art (SOTA) CMG tools like RACE. Evaluation was conducted using both automated metrics (BLEU, METEOR) and a manual assessment based on four criteria: Accuracy, Integrity, Readability, and Applicability.
Key Findings
- LLM Superiority: LLMs demonstrated a massive performance leap over traditional models. On the MCMDEval+ dataset, GPT-3.5 outperformed the previous SOTA (RACE) by 78.79% in METEOR and 31.42% in BLEU scores.
- The Impact of Retrieval: The ERICommiter framework provided substantial gains. For Gemini, performance improved by up to 199% across various metrics. GPT-3.5 saw a 15% improvement in METEOR, suggesting that even highly capable models benefit from relevant context.
- Human Preference: Manual assessments confirmed the automated metrics. GPT-3.5 achieved an average Accuracy score of 2.71/3.0, compared to just 1.51/3.0 for RACE.
- The "Why" Challenge: While LLMs are excellent at identifying what changed by analyzing code diffs, they still struggle to explain why a change occurred without broader repository context. This highlights a fundamental limitation of diff-based CMG.
Conclusion and Future Work
This research establishes that LLMs, when supported by high-quality data and efficient retrieval mechanisms, represent a new frontier for automated commit message generation. The introduction of MCMDEval+ provides the community with a more reliable benchmark for future development.
Future work will focus on expanding the context window of these models to include multiple code diffs and repository-level information, which is essential for capturing the "Why" behind complex software changes. Additionally, exploring advanced prompting techniques like Chain-of-Thought (CoT) may further refine the logical flow of generated messages.
Summary updated