Skip to main content
QUICK REVIEW

[Paper Review] Using Large Language Models to Enhance Programming Error Messages

Juho Leinonen, Arto Hellas|arXiv (Cornell University)|Oct 20, 2022
Teaching and Learning ProgrammingComputer Science33 references5 citations
TL;DR

This paper investigates using OpenAI's Codex, a large language model, to enhance programming error messages (PEMs) by generating clearer explanations and actionable fixes for novice programmers. Despite high comprehensibility (88%) and moderate correctness (57% for explanations, 47% for fixes), LLM-generated enhancements show promise but are not yet reliable enough for production use due to error rates.

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.

Motivation & Objective

  • To address the longstanding challenge of cryptic and hard-to-interpret programming error messages that hinder novice learners.
  • To investigate whether large language models can generate more readable and actionable explanations and fixes for programming errors than standard compiler messages.
  • To evaluate the utility and reliability of LLM-generated PEM enhancements in introductory programming education contexts.
  • To identify limitations and risks of relying on LLMs for error message enhancement, particularly the potential for incorrect suggestions.

Proposed method

  • The authors collected 25 Python error messages identified as particularly unreadable in prior research.
  • They generated code examples that trigger these specific error messages to test the LLM’s response.
  • Using prompt engineering with OpenAI Codex (code-davinci-002), they prompted the model to provide plain-English explanations and code fixes in a single prompt.
  • The model was tested with a temperature setting of 0 for consistency, and outputs were evaluated for correctness and clarity by human experts.
  • Evaluation included assessing explanation comprehensibility, correctness of explanations, and accuracy of suggested code fixes.
  • A two-step system was proposed to reduce risk, where LLMs are used selectively based on error message complexity and source code structure.

Experimental results

Research questions

  • RQ1RQ1: How well can Codex explain different programming error messages in plain English for novice learners?
  • RQ2RQ2: What is the quality of the code fix suggestions that Codex generates for erroneous code?
  • RQ3RQ3: How does the performance of Codex vary with different prompt designs, temperature settings, or input complexity?
  • RQ4RQ4: Can LLM-generated error message enhancements be reliably used in introductory programming classrooms?

Key findings

  • Codex produced a comprehensible explanation for 84% of the test cases, with 88% of those explanations rated as understandable by evaluators.
  • Only 57% of the generated explanations were deemed correct, amounting to 48% of all inputs receiving a correct explanation.
  • For code fix suggestions, 70% of outputs included a proposed fix, but only 47% of those fixes were correct, corresponding to 33% of all inputs.
  • Performance improved significantly when using a temperature of 0, indicating that deterministic outputs yield more reliable results.
  • The study found that LLMs are more effective at explaining simpler errors and less reliable when multiple errors or complex code structures are involved.
  • The authors caution that LLM-generated fixes may mislead students, highlighting the need for validation mechanisms before classroom deployment.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.