Delving into Commit-Issue Correlation to Enhance Commit Message Generation Models

Liran Wang, Xunzhu Tang, Yichen He, Changyu Ren, Shuhua Shi, Chaoran Yan, Zhoujun LiASE 2023

Abstract

Automated Commit Message Generation (CMG) models often struggle to capture the underlying rationale behind code changes, primarily because they rely solely on code diffs. This paper introduces ExGroFi, a three-stage paradigm designed to bridge the gap between "what" changed and "why" it changed by leveraging project issue trackers. By extracting state information from issues and grounding code representations in these rationales, ExGroFi significantly improves the rationality and technical accuracy of generated commit messages.

Introduction

A well-crafted commit message is essential for software maintenance, yet developers frequently provide generic or insufficient descriptions. While existing CMG tools treat the task as a translation from code diffs to natural language, they often fail to capture the developer's intent. For instance, a code change might implement a null check, but the motivation—such as fixing a specific user-reported crash—is typically documented in an issue tracker rather than the code itself.

Researchers from Beihang University and the University of Luxembourg address this "missing link" by proposing a method to correlate commits with their corresponding issues. Their approach, ExGroFi, utilizes issue data to provide the necessary context for generating more meaningful commit messages.

The ExGroFi Paradigm

The ExGroFi framework consists of three distinct stages: Extraction, Grounding, and Fine-tuning.

1. Extraction Stage

The model first classifies the issue type (e.g., Bug Report, Feature Request, or Enhancement). It then employs a sequence-labeling technique to identify "State Information" within the issue text:

  • Actual State: The current problem or bug being reported.
  • Expected State: The desired behavior or the goal of the change.

2. Grounding Stage

This stage aligns the code change representations with the extracted state information. By training the model to map specific code patterns to their corresponding "Actual" and "Expected" states, the model learns the semantic relationship between technical changes and their functional motivations. This "grounding" ensures that the model's internal representation of a code diff is informed by the real-world problem it solves.

3. Fine-tuning Stage

The grounded model is finally fine-tuned on the standard CMG task. Because the model has already internalized the correlation between code and issue-based rationales, it can generate messages that are not only descriptive of the code but also rational in the context of the project's goals.

Dataset Construction

To facilitate this research, the authors developed a novel commit-issue parallel dataset:

  • Base Dataset: 19,262 unlabeled commit-issue pairs sourced from the top 1,000 Java repositories on GitHub.
  • Fine Dataset: 960 manually annotated examples, providing high-quality labels for issue types and highlighted spans for "Actual" and "Expected" states.

This dataset represents a significant contribution to the field, offering a specialized resource for studying the multi-modal correlation between code changes and natural language issue descriptions.

Key Results and Insights

The ExGroFi paradigm was evaluated against six state-of-the-art models, including CodeBERT and CodeT5.

Quantitative Performance

ExGroFi-enhanced models showed consistent improvements across all metrics. Notably, there was a significant jump in CIDEr scores—up to 53% for some models. Since CIDEr emphasizes rare and informative terms, this suggests that the models are capturing specific technical details rather than relying on generic templates. Average improvements of approximately 10% were also observed in ROUGE-L and METEOR.

Qualitative Human Evaluation

In blind evaluations conducted with experienced developers, ExGroFi-enhanced models were preferred 70% of the time regarding Rationality. This confirms that the grounding stage successfully incorporates the "why" behind a change into the final output.

The Value of the "Expected State"

An interesting finding was that the extraction model performed better at identifying the "Expected State" (81.08% F1) than the "Actual State" (61.68% F1). This indicates that issue reports are often clearer about the desired outcome than the technical specifics of the problem, making the "Expected State" a particularly valuable signal for CMG models.

Limitations and Future Work

Despite its success, the authors noted several challenges. The high cost of human annotation limits the size of the "Fine" dataset. Additionally, as a pipeline-based approach, errors in the initial Extraction stage can propagate through the Grounding and Fine-tuning phases. Future research will focus on incorporating other data sources, such as pull request comments, and scaling the pre-training process to even larger datasets.

Conclusion

By moving beyond a "code-only" perspective, ExGroFi demonstrates that the context provided by issue trackers is vital for generating high-quality commit messages. The framework's ability to ground code changes in the "Actual" and "Expected" states of an issue provides a promising path toward more intelligent and helpful automated documentation tools in software engineering.

Summary updated

BibTeX
@inproceedings{wang2023delving,
  author = {Liran Wang and Xunzhu Tang and Yichen He and Changyu Ren and Shuhua Shi and Chaoran Yan and Zhoujun Li},
  title = {{Delving into Commit-Issue Correlation to Enhance Commit Message Generation Models}},
  booktitle = {ASE},
  year = {2023},
}
Figure