Comu: Contextual and Multi-Grained Code Representation Learning for Commit Message Generation

15 Pages Posted: 15 Jul 2023

See all articles by Chuangwei Wang

Chuangwei Wang

Soochow University

Li Zhang

Soochow University

Xiaofang Zhang

Soochow University

Abstract

Commit messages, precisely describing the code changes for each commit in natural language, makes it possible for developers and succeeding reviewers to understand the code changes without digging into implementation details. However, the semantic and structural gap between code and natural language poses a significant challenge for commit message generation. Several researchers have proposed automated techniques to generate commit messages. Nevertheless, the information about the code is not sufficiently exploited. In this paper, we propose contextual and multi-grained code representation learning for Commit Message Generation(COMU). We first use the contextual information of code to construct global semantic information(i.e., Code_Diff). Then we extract the code structure from source code changes with different perspectives and combine the extracted structure with fine-grained editing operations to explicitly focus on the detailed information of the changed part(i.e., AST_Diff). In addition, we build the experimental datasets, since there is still no publicly sufficient dataset for this task. The release of this dataset would contribute to advancing research in this field. We perform an extensive experiment to evaluate the effectiveness of COMU. The experimental evaluation and human study show that our model outperforms the baseline model.

Keywords: Code ChangeCode Representation LearningCommit Message GenerationPre-training

Suggested Citation

Wang, Chuangwei and Zhang, Li and Zhang, Xiaofang, Comu: Contextual and Multi-Grained Code Representation Learning for Commit Message Generation. Available at SSRN: https://ssrn.com/abstract=4511874 or http://dx.doi.org/10.2139/ssrn.4511874

Chuangwei Wang

Soochow University ( email )

No. 1 Shizi Street
Taipei, 215006
Taiwan

Li Zhang

Soochow University ( email )

No. 1 Shizi Street
Taipei, 215006
Taiwan

Xiaofang Zhang (Contact Author)

Soochow University ( email )

No. 1 Shizi Street
Taipei, 215006
Taiwan

Do you have a job opening that you would like to promote on SSRN?

Paper statistics

Downloads
51
Abstract Views
224
Rank
845,528
PlumX Metrics