解码逻辑错误:学生与大型语言模型在错误检测上的比较研究
Decoding Logic Errors: A Comparative Study on Bug Detection by Students and Large Language Models
AI总结:
本研究比较了GPT-3和GPT-4与964名入门计算学生在检测和解释代码逻辑错误上的表现,发现LLMs显著优于学生,并探讨了其在编程教育中的应用潜力。
摘要:
识别和解决逻辑错误对于初学者程序员来说可能是一个最令人沮丧的挑战。与编译器或解释器能发出消息的语法错误不同,逻辑错误可能非常微妙。在某些条件下,有错误的代码甚至可能表现出正确的行为——在其他情况下,问题可能在于如何解释问题陈述。阅读代码时这类错误可能难以发现,有时也可能被自动化测试漏掉。自动检测逻辑错误具有巨大的教育潜力,特别是当与适合初学者的反馈结合时。大型语言模型(LLMs)最近在一系列计算任务中展示了令人惊讶的性能,包括生成和解释代码。这些能力与代码语法密切相关,这与LLMs的下一个标记预测行为一致。另一方面,逻辑错误与代码的运行时性能相关,因此可能不太适合LLMs分析。为了探索这一点,我们调查了两个流行的LLMs,GPT-3和GPT-4,在检测并提供适合初学者的逻辑错误解释方面的性能。我们将LLMs的性能与一大群入门计算学生(n=964)解决相同错误检测任务的表现进行了比较。通过对学生和模型回答的混合方法分析,我们观察到上一代和当前一代LLMs在逻辑错误识别方面有显著改进,并发现两代LLMs都显著优于学生。我们概述了如何将此类模型集成到计算教育工具中,并讨论了它们在学习编程时支持学生的潜力。
英文摘要:
Identifying and resolving logic errors can be one of the most frustrating challenges for novices programmers. Unlike syntax errors, for which a compiler or interpreter can issue a message, logic errors can be subtle. In certain conditions, buggy code may even exhibit correct behavior -- in other cases, the issue might be about how a problem statement has been interpreted. Such errors can be hard to spot when reading the code, and they can also at times be missed by automated tests. There is great educational potential in automatically detecting logic errors, especially when paired with suitable feedback for novices. Large language models (LLMs) have recently demonstrated surprising performance for a range of computing tasks, including generating and explaining code. These capabilities are closely linked to code syntax, which aligns with the next token prediction behavior of LLMs. On the other hand, logic errors relate to the runtime performance of code and thus may not be as well suited to analysis by LLMs. To explore this, we investigate the performance of two popular LLMs, GPT-3 and GPT-4, for detecting and providing a novice-friendly explanation of logic errors. We compare LLM performance with a large cohort of introductory computing students $(n=964)$ solving the same error detection task. Through a mixed-methods analysis of student and model responses, we observe significant improvement in logic error identification between the previous and current generation of LLMs, and find that both LLM generations significantly outperform students. We outline how such models could be integrated into computing education tools, and discuss their potential for supporting students when learning programming.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。