一句话:提出 COME 框架,用细粒度修改嵌入与自监督生成任务表示代码改动,并结合检索与翻译方法生成提交信息。
提交信息以自然语言简洁描述代码改动,对程序理解与维护至关重要。已有自动生成方法因代码改动表示不当、翻译式与检索式方法结合不佳而性能受限。本文提出 COME 框架:使用修改嵌入(modification embedding)以细粒度方式表示代码改动;设计自监督生成任务,学习上下文化的代码改动表示;并通过决策算法融合检索式与翻译式方法。在自动评价指标上,COME 相对当时最优方法平均提升 9.2%,在人工评价指标上平均提升 8.0%。消融分析显示,三个主要组件分别带来 8.6%、8.7% 与 5.2% 的提升,验证了各组件对整体性能的有效性。
Commit messages concisely describe code changes in natural language and are important for program comprehension and maintenance. Previous studies proposed some approaches for automatic commit message generation, but their performance is limited due to inappropriate representation of code changes and improper combination of translation-based and retrieval-based approaches. To address these problems, this paper introduces a novel framework named COME, in which modification embeddings are used to represent code changes in a fine-grained way, a self-supervised generative task is designed to learn contextualized code change representation, and retrieval-based and translation-based methods are combined through a decision algorithm. The average improvement of COME over the state-of-the-art approaches is 9.2% on automatic evaluation metrics and 8.0% on human evaluation metrics. We also analyse the effectiveness of COME's three main components and each of them results in an improvement of 8.6%, 8.7% and 5.2%.