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

关于LLM作为评判者在代码生成与代码摘要任务中有效性的研究

On the Effectiveness of LLM-as-a-judge for Code Generation and Summarization

Giuseppe Crupi, Rosalia Tufano, Alejandro Velasco, Antonio Mastropaolo, Denys Poshyvanyk, Gabriele Bavota

AI总结:

本文系统评估了LLM作为评判者在代码生成和代码摘要任务中的有效性,发现GPT-4-turbo表现最佳,但即使最优模型仍频繁误判代码正确性与摘要质量。

摘要:

大型语言模型(LLMs)近期已被用作复杂自然语言处理任务(如问答)的评判者。其基本思想是:对于满足以下条件的任务,将输出“质量”的评估委托给LLM:(i)定量指标只能反映部分情况;(ii)大规模人工评估成本过高。如果LLM作为评判者(LLMs-as-a-judge)在特定任务上被证明有效,它还能为自动化开辟新的可能性:多个LLM为给定任务实例提出解决方案,其他LLM进行评判并决定向用户展示的最佳输出。我们研究了LLM作为评判者在两个代码相关任务上的有效性,即代码生成和代码摘要。选择这两个任务的理由有两方面。首先,定量指标通常不足以评估代码摘要器/生成器。例如,已有充分证据表明,BLEU等指标对于生成摘要的质量而言是相当弱的代理指标。其次,即使是最先进的技术在处理这些任务的复杂实例时仍然存在困难,这使得它们成为受益于设想LLM之间协作的更先进解决方案的良好候选者。对于代码生成,我们检验了八个LLM是否能够判断由相同LLM生成或由人类实现的1,405个Java方法和1,281个Python函数的正确性。对于代码摘要,我们将五个LLM的判断与九位人类对约1.2k个摘要(涉及Java和Python函数)提供的判断进行了比较。我们的研究结果表明,GPT-4-turbo在两个任务的评判能力方面都是最佳LLM,而参数量为数百亿的“较小”LLM无法胜任评判任务。然而,即使表现最佳的LLM也经常误判代码的正确性和摘要质量。

英文摘要:

Large Language Models have been recently exploited as judges for complex natural language processing tasks, such as Q&A. The basic idea is to delegate to an LLM the assessment of the "quality" of the output provided by an automated technique for tasks for which: (i) quantitative metrics would only tell part of the story, and; (ii) a large-scale human-based evaluation would be too expensive. LLMs-as-a-judge, if proven effective for a specific task, can also unlock new possibilities for automation, with several LLMs proposing a solution for a given instance of the task and others judging and deciding what is the best output to show the user. We study the effectiveness of LLMs-as-a-judge for two code-related tasks, namely code generation and code summarization. The rationale for choosing these tasks is two-fold. First, quantitative metrics are usually not enough for the assessment of code summarizers/generators. For example, it is well documented that metrics such as BLEU are quite weak proxies for the quality of the generated summaries. Second, even state-of-the-art techniques still struggle with handling complex instances of these tasks, making them good candidates for benefiting from more advanced solutions envisioning collaboration among LLMs. For code generation, we check whether eight LLMs are able to judge the correctness of 1,405 Java methods and 1,281 Python functions generated by the same LLMs or implemented by humans. For code summarization, we compare the judgment of five LLMs to those provided by nine humans for ~1.2k summaries, related to both Java and Python functions. Our findings show that GPT-4-turbo is the best LLM in terms of judging capabilities for both tasks, with "smaller" LLMs featuring tens of billions parameters not being able to cope with judging tasks. However, even the best-performing LLM frequently misjudges the correctness of the code and summary quality.

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

↑