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

探索大语言模型在自动化日志生成中的有效性:一项实证研究

Exploring the Effectiveness of LLMs in Automated Logging Generation: An Empirical Study

Yichen Li, Yintong Huo, Zhihan Jiang, Renyi Zhong, Pinjia He, Yuxin Su, Lionel Briand, Michael R. Lyu

AI总结:

本文首次实证研究大语言模型在自动化日志语句生成中的有效性,构建 LogBench 数据集并评估 11 个 LLMs,发现其最高 BLEU 仅 0.249,同时揭示提示构造和上下文等因素的重要性,并为未来研究提供启示。

摘要:

自动化日志语句生成支持开发者记录关键的软件运行时行为。鉴于大语言模型(LLMs)在自然语言生成和编程语言理解方面取得的巨大成功,LLMs 可能有助于开发者生成日志语句,但这一点尚未得到研究。为填补这一空白,本文首次开展了探索 LLMs 用于日志语句生成的研究。我们首先构建了一个日志语句生成数据集 LogBench,包含两部分:(1)LogBench-O:从 GitHub 仓库收集的日志语句;(2)LogBench-T:由 LogBench-O 经代码变换得到的未见代码。然后,我们利用 LogBench 评估了十一个表现最佳的 LLMs 的有效性和泛化能力(使用 LogBench-T)。此外,我们还考察了这些 LLMs 相对于 LLMs 时代之前基于检索和基于机器学习的经典日志方法的性能。我们进一步使用由代码变换技术生成的未见数据(LogBench-T)评估了 LLM 的日志泛化能力。虽然现有 LLMs 在日志级别和日志变量上给出了不错的预测,但我们的研究表明它们仅能达到最高 0.249 的 BLEU 分数,因此仍有待改进。本文还强调了提示构造和外部因素(例如编程上下文和代码注释)对 LLMs 日志性能的重要性。基于这些发现,我们确定了五点启示,并为未来的日志研究提供了实用建议。我们的实证分析揭示了当前日志方法的局限性,同时展示了基于 LLM 的日志工具的潜力,并为构建更实用的模型提供了可操作的指导。

英文摘要:

Automated logging statement generation supports developers in documenting critical software runtime behavior. Given the great success in natural language generation and programming language comprehension, large language models (LLMs) might help developers generate logging statements, but this has not yet been investigated. To fill the gap, this paper performs the first study on exploring LLMs for logging statement generation.We first build a logging statement generation dataset, LogBench, with two parts: (1) LogBench-O: logging statements collected from GitHub repositories, and (2) LogBench-T: the transformed unseen code from LogBench-O. Then, we leverage LogBench to evaluate the effectiveness and generalization capabilities (using LogBench-T) of eleven top-performing LLMs. In addition, we examine the performance of these LLMs against classical retrieval-based and machine learning-based logging methods from the era preceding LLMs. We further evaluate LLM's logging generalization capabilities using unseen data (LogBench-T) derived from code transformation techniques. While existing LLMs deliver decent predictions on logging levels and logging variables, our study indicates that they only achieve a maximum BLEU score of 0.249, thus calling for improvements. The paper also highlights the importance of prompt constructions and external factors (e.g., programming contexts and code comments) for LLMs' logging performance. Based on these findings, we identify five implications and provide practical advice for future logging research. Our empirical analysis discloses the limitations of current logging approaches while showcasing the potential of LLM-based logging tools, and provides actionable guidance for building more practical models.

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

↑