Skip to main content
QUICK REVIEW

[论文解读] Using Large Language Models to Enhance Programming Error Messages

Juho Leinonen, Arto Hellas|arXiv (Cornell University)|Oct 20, 2022
Teaching and Learning Programming参考文献 33被引用 5
一句话总结

本文研究了使用 OpenAI 的 Codex(一种大型语言模型)来增强编程错误消息(PEMs),通过生成更清晰的解释和可操作的修复方案,以帮助新手程序员。尽管可理解性较高(88%),但正确性中等(解释正确率 57%,修复正确率 47%),大型语言模型生成的增强方案虽具潜力,但因错误率仍高,目前尚不足以用于生产环境。

ABSTRACT

A key part of learning to program is learning to understand programming error messages. They can be hard to interpret and identifying the cause of errors can be time-consuming. One factor in this challenge is that the messages are typically intended for an audience that already knows how to program, or even for programming environments that then use the information to highlight areas in code. Researchers have been working on making these errors more novice friendly since the 1960s, however progress has been slow. The present work contributes to this stream of research by using large language models to enhance programming error messages with explanations of the errors and suggestions on how to fix the error. Large language models can be used to create useful and novice-friendly enhancements to programming error messages that sometimes surpass the original programming error messages in interpretability and actionability. These results provide further evidence of the benefits of large language models for computing educators, highlighting their use in areas known to be challenging for students. We further discuss the benefits and downsides of large language models and highlight future streams of research for enhancing programming error messages.

研究动机与目标

  • 为解决长期存在的、晦涩难懂且难以理解的编程错误消息对新手学习者造成的障碍。
  • 探究大型语言模型是否能生成比标准编译器消息更易读、更具可操作性的编程错误解释和修复方案。
  • 评估大型语言模型生成的 PEM 增强方案在入门级编程教育场景中的实用性和可靠性。
  • 识别依赖大型语言模型进行错误消息增强的局限性和风险,特别是可能产生错误建议的潜在问题。

提出的方法

  • 作者收集了 25 个在先前研究中被认定为特别难以理解的 Python 错误消息。
  • 生成了触发这些特定错误消息的代码示例,以测试大型语言模型的响应。
  • 使用提示工程方法,通过 OpenAI Codex(code-davinci-002)提示模型在单个提示中提供通俗易懂的英文解释和代码修复方案。
  • 采用温度设置为 0 的方式测试模型,以确保输出的一致性,人类专家对输出的正确性和清晰度进行了评估。
  • 评估内容包括解释的可理解性、解释的正确性以及建议代码修复的准确性。
  • 提出了一种两步制系统以降低风险,即根据错误消息的复杂性和源代码结构,选择性地使用大型语言模型。

实验结果

研究问题

  • RQ1RQ1:Codex 能在多大程度上用通俗英语为新手学习者解释不同类型的编程错误消息?
  • RQ2RQ2:Codex 为错误代码生成的修复建议质量如何?
  • RQ3RQ3:Codex 的表现如何随不同的提示设计、温度设置或输入复杂度而变化?
  • RQ4RQ4:大型语言模型生成的错误消息增强方案能否在入门级编程课堂中可靠使用?

主要发现

  • Codex 对 84% 的测试用例生成了可理解的解释,其中 88% 的解释被评估者评为易于理解。
  • 仅 57% 的生成解释被认定为正确,占所有输入的 48%。
  • 在代码修复建议方面,70% 的输出包含建议修复方案,但只有 47% 的修复方案正确,对应所有输入的 33%。
  • 当使用温度为 0 时,性能显著提升,表明确定性输出能带来更可靠的结果。
  • 研究发现,大型语言模型在解释简单错误方面更有效,而在涉及多个错误或复杂代码结构时可靠性下降。
  • 作者警告,大型语言模型生成的修复方案可能误导学生,强调在课堂部署前必须建立验证机制。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。