← Latest papers
🤖 AI

On the Impact of Code Comments for Automated Bug-Fixing: An Empirical Study

This empirical study demonstrates that retaining code comments during both training and inference significantly enhances Large Language Models' automated bug-fixing accuracy, challenging the common practice of removing comments and highlighting the value of implementation details in aiding model performance.

Original authors: Antonio Vitale, Emanuela Guglielmi, Simone Scalabrino, Rocco Oliveto

Published 2026-02-02
📖 4 min read☕ Coffee break read

Original authors: Antonio Vitale, Emanuela Guglielmi, Simone Scalabrino, Rocco Oliveto

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are trying to teach a very smart, but slightly literal-minded robot how to fix broken toys. This robot is a Large Language Model (LLM), and the "toys" are computer programs with bugs.

For a long time, researchers believed that to teach this robot, you should strip away all the "notes" or "stickers" (code comments) attached to the broken toys. They thought the robot should only look at the raw plastic and gears (the code itself) to figure out how to fix it.

The Big Idea of This Paper
The authors of this paper, Antonio Vitale and his team, asked a simple question: What if those notes are actually the most important part of the puzzle? They hypothesized that the notes written by the original human developers explain why the toy was built a certain way, which might be the key to fixing it.

To test this, they didn't just look at the raw code. They created a massive new training set where they used an AI to write high-quality "stickers" (comments) for every single broken toy. These stickers explained:

  • What the toy does.
  • Why it was built that way.
  • How the gears work inside.
  • How to use it properly.
  • What rules it must follow (like "don't drop this").

They then ran a series of experiments with two different types of robot teachers (CodeT5+ and DeepSeek-Coder) to see how well they could fix the bugs under four different scenarios:

  1. No Notes: Training without notes, testing without notes.
  2. Training Notes Only: Training with notes, testing without notes.
  3. Testing Notes Only: Training without notes, testing with notes.
  4. Notes Everywhere: Training with notes, testing with notes.

The Results: The Power of the "Stickers"

Here is what they found, using some simple analogies:

  • The "Notes Everywhere" Effect: When the robot was trained with the notes and then tested with the notes, it became a superhero. Its ability to fix bugs jumped by up to three times compared to when it had no notes at all. It was like giving the robot a manual and letting it read the manual while working.
  • The "Notes at the End" Effect: Even if the robot was trained on raw, note-less code, giving it the notes just when it was trying to fix a bug (at "inference time") still helped it significantly. It was like handing the robot the manual right when it got stuck.
  • The "No Harm" Rule: Interestingly, training the robot with notes didn't hurt its performance when the notes were missing later. It didn't get confused; it just performed slightly worse than its peak, but still better than robots that never saw notes at all.

Which Notes Matter Most?

The researchers also peeked inside the robot's "brain" to see which parts of the notes it was paying attention to. They found:

  • The "How" Notes are King: The notes that explained how the code actually worked (the implementation details) were the most critical. If the robot knew the specific steps the code was supposed to take, it could spot exactly where the robot went wrong.
  • The "What" Notes are Less Critical: Notes that just said "This sorts a list" were less helpful. The robot could often guess the "what" just by looking at the code or the function name.
  • The Danger of Bad Notes: The paper also tested what happens if you write notes based on the broken code. This was a disaster. The robot learned the wrong rules and got even more confused. It's like writing a manual for a broken car that tells you how to drive it into a wall.

The Bottom Line

The study concludes that we shouldn't throw away the "notes" (comments) when training AI to fix code. In fact, we should probably write better notes.

Think of it this way: If you want a mechanic (the AI) to fix your car, you don't just hand them the engine block; you give them the owner's manual too. The more clear and detailed that manual is, the better the mechanic can do their job. The authors suggest that developers should write clear comments not just for other humans, but to help these AI assistants do their best work.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →