基于大语言模型的提交日志生成
CSTR:
作者:
作者单位:

作者简介:

通讯作者:

中图分类号:

TP311

基金项目:

国家自然科学基金(62025202, 62072225); 江苏省前沿技术研发计划(BF2024059)


Commit Message Generation Based on Large Language Models
Author:
Affiliation:

Fund Project:

  • 摘要
  • |
  • 图/表
  • |
  • 访问统计
  • |
  • 参考文献
  • |
  • 相似文献
  • |
  • 引证文献
  • |
  • 资源附件
  • |
  • 文章评论
    摘要:

    提交日志是一类描述代码变更的自然语言文本, 对理解代码及代码演化过程十分重要. 受限于软件开发成本等因素, 开发人员往往不会精心撰写提交日志, 导致现有软件项目的提交日志质量堪忧. 鉴于此, 提交日志自动生成任务受到了广泛关注. 现有工作主要从开源软件项目中收集提交日志数据, 并基于此训练深度学习模型完成任务. 然而, 受限于开源项目数据质量, 现有工作难以取得令人满意的效果. 大语言模型通过在大规模代码和文本数据上的预训练, 学习了丰富的语言规律和世界知识, 能够生成高质量、自然且符合上下文的文本, 为提交日志生成提供了新的思路. 提出基于大语言模型的提交日志生成方法, 通过上下文学习、模型微调等手段将大语言模型用于提交日志生成, 使用两种示例检索方法增强上下文学习方法, 并从自然性和相关性角度分析生成文本, 研究大语言模型方法的优势与不足以及如何应对不足. 实验证实了大语言模型表现超过基线方法, 且思维链及更大规模模型能应对对代码变更理解不足的情况.

    Abstract:

    Commit messages are natural language text that describe code changes and are crucial for understanding code and its evolution. Constrained by software development costs and related factors, developers often fail to carefully craft commit messages, resulting in unsatisfactory quality in existing software projects. As a result, commit message generation has gained widespread attention. Current work mainly involves collecting commit message data from open-source software projects and training deep learning models on this data to accomplish the task. However, due to the quality issues of open-source project data, existing methods struggle to achieve satisfactory performance. Large language models, by pre-training on vast amounts of code and text data, learn rich linguistic patterns and world knowledge, enabling the generation of high-quality, natural, and contextually appropriate text, thus providing new directions for commit message generation. This study proposes a commit message generation method based on large language models, in which large language models are applied to commit message generation through techniques such as in-context learning and model fine-tuning. Two example retrieval methods are employed to enhance the in-context learning approach. The generated text is then analyzed in terms of naturalness and relevance, and the strengths and limitations of the large language model-based methods, as well as ways to address these limitations, are examined. Experiments demonstrate that large language models outperform baseline methods. In addition, chain-of-thought reasoning and larger-scale models can address the issue of insufficient understanding of code changes.

    参考文献
    相似文献
    引证文献
引用本文

徐圣斌,贾林杰,许汤智,朱晓瑞,余萍,徐锋,马晓星.基于大语言模型的提交日志生成.软件学报,,():1-19

复制
相关视频

分享
文章指标
  • 点击次数:
  • 下载次数:
  • HTML阅读次数:
  • 引用次数:
历史
  • 收稿日期:2024-09-04
  • 最后修改日期:2025-03-17
  • 录用日期:
  • 在线发布日期: 2026-05-27
  • 出版日期:
文章二维码
您是第位访问者
版权所有:中国科学院软件研究所 京ICP备05046678号-3
地址:北京市海淀区中关村南四街4号,邮政编码:100190
电话:010-62562563 传真:010-62562533 Email:jos@iscas.ac.cn
技术支持:北京勤云科技发展有限公司

京公网安备 11040202500063号