引用本文:徐圣斌,贾林杰,许汤智,朱晓瑞,余萍,徐锋,马晓星.基于大语言模型的提交日志生成.软件学报,,():1-19
【打印本页】   【下载PDF全文】   查看/发表评论  【EndNote】   【RefMan】   【BibTex】
←前一篇|后一篇→ 过刊浏览    高级检索
本文已被:浏览 275次   下载 132 本文二维码信息
码上扫一扫!
分享到: 微信 更多
基于大语言模型的提交日志生成
徐圣斌1, 贾林杰1, 许汤智1, 朱晓瑞2, 余萍1, 徐锋1, 马晓星1
1.计算机软件新技术国家重点实验室(南京大学), 江苏 南京 210023;2.南京晓庄学院 信息工程学院, 江苏 南京 211171
摘要:
提交日志是一类描述代码变更的自然语言文本, 对理解代码及代码演化过程十分重要. 受限于软件开发成本等因素, 开发人员往往不会精心撰写提交日志, 导致现有软件项目的提交日志质量堪忧. 鉴于此, 提交日志自动生成任务受到了广泛关注. 现有工作主要从开源软件项目中收集提交日志数据, 并基于此训练深度学习模型完成任务. 然而, 受限于开源项目数据质量, 现有工作难以取得令人满意的效果. 大语言模型通过在大规模代码和文本数据上的预训练, 学习了丰富的语言规律和世界知识, 能够生成高质量、自然且符合上下文的文本, 为提交日志生成提供了新的思路. 提出基于大语言模型的提交日志生成方法, 通过上下文学习、模型微调等手段将大语言模型用于提交日志生成, 使用两种示例检索方法增强上下文学习方法, 并从自然性和相关性角度分析生成文本, 研究大语言模型方法的优势与不足以及如何应对不足. 实验证实了大语言模型表现超过基线方法, 且思维链及更大规模模型能应对对代码变更理解不足的情况.
关键词:  提交日志生成  大语言模型  上下文学习  模型微调
DOI:10.13328/j.cnki.jos.007640
分类号:TP311
基金项目:国家自然科学基金(62025202, 62072225); 江苏省前沿技术研发计划(BF2024059)
Commit Message Generation Based on Large Language Models
XU Sheng-Bin1, JIA Lin-Jie1, XU Tang-Zhi1, ZHU Xiao-Rui2, YU Ping1, XU Feng1, MA Xiao-Xing1
1.State Key Laboratory for Novel Software Technology (Nanjing University), Nanjing 210023, China;2.College of Information Engineering, Nanjing Xiaozhuang University, Nanjing 211171, China
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.
Key words:  commit message generation  large language model (LLM)  in-context learning  model fine-tuning