arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2409.14368cs.SEcs.AIcs.HC
收藏

评估大型语言模型为新手程序员生成的代码注释质量

Evaluating the Quality of Code Comments Generated by Large Language Models for Novice Programmers

University of Illinois at Urbana-Champaign(伊利诺伊大学厄巴纳-香槟分校);University of Pittsburgh(匹兹堡大学);Carnegie Mellon University(卡内基梅隆大学)

Aysa Xuemo Fan, Arun Balajiee Lekshmi Narayanan, Mohammad Hassany, Jiaze Ke

AI总结:

本研究评估了GPT-4、GPT-3.5-Turbo和Llama2为新手程序员生成代码注释的教学质量,发现GPT-4在清晰度、概念阐释等方面与专家注释相当,且在复杂度讨论和对新手支持度上显著优于其他模型,突出了LLMs为新手生成定制化代码注释的潜力。

摘要:

大型语言模型(LLMs)在为新手程序员生成代码注释方面展现出潜力,但其教育效果仍有待充分评估。本研究评估了由GPT-4、GPT-3.5-Turbo和Llama2生成的代码注释的教学质量,并与专家开发的注释进行比较,重点关注其对新手是否适用。通过分析来自LeetCode的“easy”级别Java解决方案数据集,我们发现GPT-4在清晰度、新手友好度、概念阐释和逐步指导等对初学者至关重要的方面,展现出与专家注释相当的质量。GPT-4在讨论复杂度方面优于Llama2(卡方值=11.40,p=0.001),并且被认为对初学者的支持度显著高于GPT-3.5和Llama2(Mann-Whitney U统计量分别为300.5和322.5,p值分别为0.0017和0.0003)。本研究突出了LLMs为新手程序员生成定制化代码注释的潜力。

英文摘要:

Large Language Models (LLMs) show promise in generating code comments for novice programmers, but their educational effectiveness remains under-evaluated. This study assesses the instructional quality of code comments produced by GPT-4, GPT-3.5-Turbo, and Llama2, compared to expert-developed comments, focusing on their suitability for novices. Analyzing a dataset of ``easy'' level Java solutions from LeetCode, we find that GPT-4 exhibits comparable quality to expert comments in aspects critical for beginners, such as clarity, beginner-friendliness, concept elucidation, and step-by-step guidance. GPT-4 outperforms Llama2 in discussing complexity (chi-square = 11.40, p = 0.001) and is perceived as significantly more supportive for beginners than GPT-3.5 and Llama2 with Mann-Whitney U-statistics = 300.5 and 322.5, p = 0.0017 and 0.0003). This study highlights the potential of LLMs for generating code comments tailored to novice programmers.

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

↑