Objective

Feedback is one of the strongest influences on how well students learn. Beginners in programming need it badly, because they cannot yet debug their own code the way experts do. Many online coding tools only tell students whether an answer is right or wrong. They rarely explain why a program fails or what to try next.

Large language models (LLMs, the kind of AI behind ChatGPT) can write detailed, personal feedback. Earlier studies used very simple requests, such as asking what is wrong with a piece of code. Those studies found that the answers were sometimes misleading, incomplete or too vague. This paper asks a different question. Can an LLM be told to produce one specific kind of feedback, and what does that feedback look like?

The authors used an existing list of feedback types for programming. It covers, for example, a plain correct or incorrect verdict, a description of the task rules, an explanation of programming concepts, a description of mistakes, hints on how to proceed, and a progress score. The two research questions were:

  • How well can feedback of a chosen type be generated for a faulty program?
  • What are the characteristics of the generated feedback?

Methods

This was a qualitative analysis of AI output, not a classroom trial. No students used the feedback, so the study cannot show whether the feedback helped anyone learn.

Programs used

The team reused real student submissions from earlier research. They first built the instructions (the prompt) using 3 Java exercises, with one flawed submission for each. They then tested the final prompt on 11 student solutions to 6 different exercises, written in 4 programming languages: Java, Python, C++ and Kotlin. Some solutions were correct, some had a few errors and some had many. Most exercises involved math-type tasks such as classifying triangles or computing Fibonacci numbers.

Building the prompt

The prompt told the AI that the reader is a novice, described each feedback type, and gave the task description, the starter code, the student's solution and a model solution. The authors improved it over 5 rounds. After each round, 2 authors labeled the feedback from 18 messages (3 submissions across 6 feedback types) and the 3 authors discussed problems. Early versions gave answers that were far too long (about 290 words for a simple correct or incorrect verdict) or kept referring to the model solution. Instructions were added to fix this.

Generating and coding the feedback

They used GPT-4 through the ChatGPT interface in March 2024, with a fresh conversation for each request. For each of the 11 solutions they asked for each of 6 feedback types, giving 66 messages. Two experts coded every message without knowing which type had been requested, using 13 characteristics from earlier work, such as whether it explained the cause of an error, gave a fix, was personal to the student's code or contained misleading information. Disagreements were settled by discussion.

Key Findings

Overall, GPT-4 followed instructions about feedback type well, but it still made errors that could confuse a beginner.

Getting the requested type

  • The requested feedback type appeared in 63 of the 66 messages.
  • In 19 messages, other feedback types were mixed in as well. Requests for hints on how to proceed often also contained a description of the mistake. Requests about task rules were sometimes combined with mistakes or hints. The authors say this is hard to avoid, since it is difficult to give a hint without pointing at the problem.
  • The simple correct or incorrect verdict was always given alone, and in most cases it matched whether the code was truly correct. Still, the paper says even this simple verdict was sometimes wrong in both directions.

Misleading feedback

  • Misleading statements were less common than in an earlier study that used a simpler prompt and an older model, but they still happened.
  • For correct programs, the AI sometimes invented problems. It said a correct Kotlin solution read the input in the wrong format, and told a correct C++ and Java solution to print only the largest number when they already did.
  • It sometimes called style suggestions mistakes. For example, it said a correct Fibonacci solution had a mistake in the order of its checks, which did not affect whether the code worked.
  • For one correct program, the progress score was 85%, and for another correct one it was 80%, although no changes were needed. The authors also disagreed with some scores that gave too many points for small subgoals.
  • One message described inconsistent use of braces that did not exist in the student's code.

Other patterns

  • Feedback on mistakes usually pointed to real errors and was personal to the student's code. Even when told not to, it sometimes explained how to fix the error.
  • Hint feedback often gave useful steps, but some hints were vague, such as asking the student to make sure the code follows the task formula.
  • The AI struggled with unusual logic, such as a solution that compared numbers by subtracting them.
  • The language fit beginners. Few messages were motivational, and none were rude or showed uncertainty.
  • Full code examples were never given, as instructed, but short code snippets appeared often.

Implications

Teachers and course designers

The authors suggest that educators could pick a feedback type and send the matching prompt to the AI. Students could also choose a type themselves, for example only a hint or only a progress report. They recommend a simple button that sends the prepared prompt, so students do not have to write prompts. Students need guidance that AI feedback can sound convincing and still be wrong, and teachers should help them to check it.

Tool developers

The authors do not think relying only on an LLM is the best approach, because even the simple correct or incorrect verdict was not always right. They propose hybrid systems. Test cases would run first, and the results would be passed to the AI in the prompt. They expect fewer wrong verdicts and better progress scores, and they suggest rules such as giving style advice only when the program passes all tests.

Researchers

The authors call for studies of what students and experts think of the feedback, for ways to combine several feedback types in one message, for finer feedback types, and for different levels of detail from small hints to concrete suggestions.

Our reading (not the authors' recommendation): Until a human or a test suite checks the output, treat AI feedback on correct code with extra care, because that is where the invented problems showed up in this study.

Limitations

The authors name two limits. The results come from one model, GPT-4, so other models may behave differently. The exercises were also mostly math-style tasks, which are common in the first weeks of an introductory course but do not cover every kind of programming task. The authors say the results should not be generalized to other task types.

The paper does not mention, but the sample is small. There were only 66 messages, from 11 solutions to 6 exercises, so rates such as 63 of 66 are rough and could change with other programs or other wording.

The paper does not mention, but nobody tested whether students learned better from this feedback or found it helpful. The study measured what the AI wrote, not what happened to learners.

The paper does not mention, but the same AI is known to give different answers on different runs, and each request was made only once per feedback type, so one lucky or unlucky answer could change the picture.

The labeling of feedback was done by the authors themselves, with judgment calls about what counts as misleading or motivational. They reduced bias by hiding the requested type and by resolving disagreements through discussion.

Future Directions

The authors point to several next steps:

  • How do students and expert teachers rate the helpfulness of feedback of each type?
  • Can several feedback types be combined in one message, as human experts usually do, and how well does that work?
  • Can the finer subtypes in the feedback classification be generated on request?
  • What happens when the level of detail changes, from high-level hints to concrete suggestions, and when the feedback is tailored to each student's preferences?
  • Can the prompt be adapted for more complex tasks beyond short, math-style exercises?

The paper also notes that illustrative examples were hard to control. The AI used the word example in different ways, so the authors dropped that instruction. Better ways to request examples remain open, and so does how hybrid systems that add test results to the prompt compare with LLM-only feedback.

The bottom line: In this small analysis, GPT-4 usually delivered the specific kind of programming feedback it was asked for, and a carefully built prompt worked better than the simple requests used in earlier studies. But the feedback was not always reliable, and it sometimes found problems in correct code or gave scores that did not fit. The evidence comes from one model and 66 messages, with no students involved. Teachers who try AI feedback should check it, and tools that combine AI with automatic tests look like the safer design.