[Paper Review] ATOM: Commit Message Generation Based on Abstract Syntax Tree and Hybrid Ranking
This paper proposes ATOM, a commit message generation model that leverages abstract syntax trees (ASTs) to capture code semantics and integrates retrieved and generated messages via a hybrid ranking module. ATOM improves state-of-the-art performance by 30.72% in BLEU-4 on a dataset from 56 popular Java repositories.
Commit messages record code changes (e.g., feature modifications and bug repairs) in natural language, and are useful for program comprehension. Due to the frequent updates of software and time cost, developers are generally unmotivated to write commit messages for code changes. Therefore, automating the message writing process is necessitated. Previous studies on commit message generation have been benefited from generation models or retrieval models, but the code structure of changed code, i.e., AST, which can be important for capturing code semantics, has not been explicitly involved. Moreover, although generation models have the advantages of synthesizing commit messages for new code changes, they are not easy to bridge the semantic gap between code and natural languages which could be mitigated by retrieval models. In this paper, we propose a novel commit message generation model, named ATOM, which explicitly incorporates the abstract syntax tree for representing code changes and integrates both retrieved and generated messages through hybrid ranking. Specifically, the hybrid ranking module can prioritize the most accurate message from both retrieved and generated messages regarding one code change. We evaluate the proposed model ATOM on our dataset crawled from 56 popular Java repositories. Experimental results demonstrate that ATOM increases the state-of-the-art models by 30.72% in terms of BLEU-4 (an accuracy measure that is widely used to evaluate text generation systems). Qualitative analysis also demonstrates the effectiveness of ATOM in generating accurate code commit messages.
Motivation & Objective
- To address the challenge of low-quality or missing commit messages due to developer time constraints and lack of standardization.
- To improve commit message generation by explicitly modeling code structure through abstract syntax trees (ASTs).
- To bridge the semantic gap between code changes and natural language by combining retrieval-based and generation-based approaches.
- To develop a hybrid ranking mechanism that selects the most accurate message from both retrieved and generated candidates.
Proposed method
- ATOM encodes code changes as AST paths to capture syntactic and semantic structure, improving code representation beyond flat token sequences.
- It employs a neural machine translation (NMT) model to generate commit messages from AST-encoded code changes.
- It uses an information retrieval approach to retrieve similar commit messages from a large dataset based on diff vector similarity.
- A hybrid ranking module combines scores from both retrieval and generation models, prioritizing the most accurate message for each code change.
- The model is trained and evaluated on a custom dataset of 56 popular Java repositories, focusing on real-world commit changes.
- BLEU-4 is used as the primary evaluation metric to compare performance against state-of-the-art models.
Experimental results
Research questions
- RQ1Can AST-based code representation improve the accuracy of commit message generation compared to flat token sequences?
- RQ2How effective is the integration of retrieval-based and generation-based methods in reducing the semantic gap between code and natural language?
- RQ3Can a hybrid ranking mechanism outperform standalone retrieval or generation models in commit message selection?
- RQ4To what extent does incorporating AST structure enhance model generalization on unseen code changes?
Key findings
- ATOM achieves a 30.72% improvement in BLEU-4 over the state-of-the-art models, demonstrating significant performance gains.
- The use of AST paths for code representation leads to better capture of syntactic and semantic information in code changes.
- The hybrid ranking module effectively combines retrieved and generated messages, selecting more accurate outputs than either method alone.
- Qualitative analysis confirms that ATOM generates more precise and contextually relevant commit messages compared to baseline models.
- The model outperforms both retrieval-based (NNGen) and generation-based (NMT) models, indicating the effectiveness of the hybrid approach.
- The approach is robust on real-world code changes from production-grade Java repositories, validating its practical applicability.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.