arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2404.14824cs.SE
收藏

基于大语言模型的自动提交信息生成:一项实证研究及其超越

Automated Commit Message Generation with Large Language Models: An Empirical Study and Beyond

Pengyu Xue, Linhao Wu, Zhongxing Yu, Zhi Jin, Zhen Yang, Xinyi Li, Zhenyu Yang, Yue Tan

AI总结:

本研究首次全面评估大语言模型在自动提交信息生成任务中的表现,提出高效检索增强的上下文学习框架ERICommiter,显著提升生成质量与检索效率。

摘要:

提交信息生成(CMG)方法旨在根据给定的代码差异自动生成提交信息,这有助于开发者之间的协作,并在开源软件(OSS)中发挥着关键作用。最近,大语言模型(LLMs)已在多种代码相关任务中展现出广泛的适用性,但很少有研究系统地探讨它们在提交信息生成中的有效性。本文进行了首次全面的实验,以探究我们在应用LLM生成高质量提交信息方面已取得的进展。受初步分析的启发,我们首先按照从业者的标准清理了最广泛使用的CMG数据集。随后,我们重新评估了多种最先进的CMG方法,并与LLMs进行比较,展示了LLMs相对于最先进CMG方法的优越性能。接着,我们遵循开源软件的实践,提出了四个手动评估指标,包括准确性、完整性、适用性和可读性,并据此评估了各种LLMs。结果表明,GPT-3.5整体表现最佳,但不同的LLMs各有优势。为了进一步提升LLMs在CMG任务中的性能,我们提出了一种高效的基于检索的上下文学习(ICL)框架,即ERICommiter,该框架利用两步过滤来加速检索效率,并引入基于语义/词汇的检索算法来构建ICL示例。大量实验表明,ERICommiter在针对不同编程语言的代码差异的各种LLMs上均带来了显著的性能提升。同时,ERICommiter还大幅减少了检索时间,同时几乎保持了相同的性能。我们的研究有助于理解LLMs在CMG领域的能力,并为寻求在工作流程中利用这些工具的从业者提供了宝贵的见解。

英文摘要:

Commit Message Generation (CMG) approaches aim to automatically generate commit messages based on given code diffs, which facilitate collaboration among developers and play a critical role in Open-Source Software (OSS). Very recently, Large Language Models (LLMs) have demonstrated extensive applicability in diverse code-related task. But few studies systematically explored their effectiveness using LLMs. This paper conducts the first comprehensive experiment to investigate how far we have been in applying LLM to generate high-quality commit messages. Motivated by a pilot analysis, we first clean the most widely-used CMG dataset following practitioners' criteria. Afterward, we re-evaluate diverse state-of-the-art CMG approaches and make comparisons with LLMs, demonstrating the superior performance of LLMs against state-of-the-art CMG approaches. Then, we further propose four manual metrics following the practice of OSS, including Accuracy, Integrity, Applicability, and Readability, and assess various LLMs accordingly. Results reveal that GPT-3.5 performs best overall, but different LLMs carry different advantages. To further boost LLMs' performance in the CMG task, we propose an Efficient Retrieval-based In-Context Learning (ICL) framework, namely ERICommiter, which leverages a two-step filtering to accelerate the retrieval efficiency and introduces semantic/lexical-based retrieval algorithm to construct the ICL examples. Extensive experiments demonstrate the substantial performance improvement of ERICommiter on various LLMs for code diffs of different programming languages. Meanwhile, ERICommiter also significantly reduces the retrieval time while keeping almost the same performance. Our research contributes to the understanding of LLMs' capabilities in the CMG field and provides valuable insights for practitioners seeking to leverage these tools in their workflows.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑