arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2305.12865cs.SEcs.AI
收藏

通过ChatGPT进行自动代码摘要:我们还有多远?

Automatic Code Summarization via ChatGPT: How Far Are We?

Nanjing University(南京大学);Nanyang Technological University(南洋理工大学);University of New South Wales(新南威尔士大学)

Weisong Sun, Chunrong Fang, Yudu You, Yun Miao, Yi Liu, Yuekang Li, Gelei Deng, Shenghan Huang, Yuchen Chen, Quanjun Zhang, Hanwei Qian, Yang Liu, Zhenyu Chen

AI总结:

本文评估了ChatGPT在CSN-Python数据集上的自动代码摘要表现,发现其在BLEU和ROUGE-L指标上显著劣于NCS、CodeBERT和CodeT5等SOTA模型,并探讨了其优缺点及未来挑战。

摘要:

为了支持软件开发者理解和维护程序,已经提出了各种自动代码摘要技术,用于为给定的代码片段生成简洁的自然语言注释。最近,大型语言模型(LLMs)的出现极大地提升了自然语言处理任务的性能。其中,ChatGPT是最受欢迎的模型,引起了软件工程社区的广泛关注。然而,ChatGPT在(自动)代码摘要中的表现如何仍不清楚。因此,在本文中,我们专注于在一个广泛使用的名为CSN-Python的Python数据集上评估ChatGPT,并将其与几个最先进的(SOTA)代码摘要模型进行比较。具体来说,我们首先探索了一种合适的提示来引导ChatGPT生成分布内注释。然后,我们使用这样的提示要求ChatGPT为CSN-Python测试集中的所有代码片段生成注释。我们采用三个广泛使用的指标(包括BLEU、METEOR和ROUGE-L)来衡量ChatGPT和SOTA模型(包括NCS、CodeBERT和CodeT5)生成的注释质量。实验结果表明,在BLEU和ROUGE-L方面,ChatGPT的代码摘要性能明显劣于所有三个SOTA模型。我们还展示了一些案例,并讨论了ChatGPT在代码摘要中的优缺点。基于这些发现,我们概述了基于ChatGPT的代码摘要中几个开放的挑战和机遇。

英文摘要:

To support software developers in understanding and maintaining programs, various automatic code summarization techniques have been proposed to generate a concise natural language comment for a given code snippet. Recently, the emergence of large language models (LLMs) has led to a great boost in the performance of natural language processing tasks. Among them, ChatGPT is the most popular one which has attracted wide attention from the software engineering community. However, it still remains unclear how ChatGPT performs in (automatic) code summarization. Therefore, in this paper, we focus on evaluating ChatGPT on a widely-used Python dataset called CSN-Python and comparing it with several state-of-the-art (SOTA) code summarization models. Specifically, we first explore an appropriate prompt to guide ChatGPT to generate in-distribution comments. Then, we use such a prompt to ask ChatGPT to generate comments for all code snippets in the CSN-Python test set. We adopt three widely-used metrics (including BLEU, METEOR, and ROUGE-L) to measure the quality of the comments generated by ChatGPT and SOTA models (including NCS, CodeBERT, and CodeT5). The experimental results show that in terms of BLEU and ROUGE-L, ChatGPT's code summarization performance is significantly worse than all three SOTA models. We also present some cases and discuss the advantages and disadvantages of ChatGPT in code summarization. Based on the findings, we outline several open challenges and opportunities in ChatGPT-based code summarization.

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

↑