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

Large Language Models 在代码摘要上的校准

Calibration of Large Language Models on Code Summarization

UC Davis(加州大学戴维斯分校);IBM Research(IBM研究院)

Yuvraj Virk, Premkumar Devanbu, Toufique Ahmed

AI总结:

研究将LLM代码摘要与人类摘要的相似度评估作为校准问题,仅基于代码和LLM摘要计算置信度,在多语言多设置下验证了方法能可靠预测摘要质量。

摘要:

简洁、流畅且相关的摘要在程序理解过程中很有帮助;然而,生成这样的摘要需要大量的人力。通常,软件项目中缺乏好的摘要,这使得维护更加困难。已有大量研究致力于使用 Large Language models (LLMs) 的自动化 AI 方法来生成代码摘要;也有不少工作研究如何衡量此类摘要生成方法的性能,特别关注这些 AI 生成的摘要与人类可能生成的摘要的相似程度。诸如 BERTScore 和 BLEU 等指标已被提出,并通过人类受试者研究进行了评估。\n然而,LLM 生成的摘要可能不准确、不完整等:通常与优秀开发者可能撰写的摘要差异过大。给定一个 LLM 生成的代码摘要,用户如何合理判断该摘要是否足够好且可靠?仅给定一些输入源代码和 LLM 生成的摘要,现有方法可以帮助判断摘要的简洁性、流畅性和相关性;然而,在没有“黄金”人类摘要作为对比的情况下,很难评估 LLM 生成的摘要是否充分类似于人类可能生成的摘要。我们将这一相似性问题作为校准问题进行研究:仅给定代码和 LLM 生成的摘要,我们能否计算出一个置信度度量,以可靠地指示该摘要是否充分类似于人类在此情况下可能生成的摘要?我们使用多个 LLM、针对多种语言并在多种不同设置下考察了这一问题。我们的研究表明,所提方法能够可靠地预测 LLM 生成的摘要充分类似于人类可能为相同代码撰写的摘要的可能性。

英文摘要:

A brief, fluent, and relevant summary can be helpful during program comprehension; however, such a summary does require significant human effort to produce. Often, good summaries are unavailable in software projects, which makes maintenance more difficult. There has been a considerable body of research into automated AI-based methods, using Large Language models (LLMs), to generate summaries of code; there also has been quite a bit of work on ways to measure the performance of such summarization methods, with special attention paid to how closely these AI-generated summaries resemble a summary a human might have produced. Measures such as BERTScore and BLEU have been suggested and evaluated with human-subject studies. However, LLM-generated summaries can be inaccurate, incomplete, etc.: generally, too dissimilar to one that a good developer might write. Given an LLM-generated code summary, how can a user rationally judge if a summary is sufficiently good and reliable? Given just some input source code, and an LLM-generated summary, existing approaches can help judge brevity, fluency and relevance of the summary; however, it's difficult to gauge whether an LLM-generated summary sufficiently resembles what a human might produce, without a "golden" human-produced summary to compare against. We study this resemblance question as calibration problem: given just the code & the summary from an LLM, can we compute a confidence measure, that provides a reliable indication of whether the summary sufficiently resembles what a human would have produced in this situation? We examine this question using several LLMs, for several languages, and in several different settings. Our investigation suggests approaches to provide reliable predictions of the likelihood that an LLM-generated summary would sufficiently resemble a summary a human might write for the same code.

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

↑