Teaching AI to Fix Code: A Step Towards Smarter Debugging Tools

Thursday 05 June 2025

Artificial Intelligence has always fascinated us, but what if we could teach it to fix our code? The latest research in this field has made significant progress towards making AI more effective in repairing software bugs. By incorporating execution traces into prompts, these machines can learn from their mistakes and improve their debugging skills.

The idea is simple: provide an AI with a program that contains errors and its corresponding execution trace – a record of the sequence of events as the code runs. The AI then uses this information to identify where the problem lies and generate a corrected version of the code. Sounds like a no-brainer, right? Well, it’s not quite that easy.

The researchers have been experimenting with different approaches to see what works best. They’ve tried using error-based prompts, which provide the AI with a list of failing test cases, and program-only prompts, which give it just the buggy code. Surprisingly, they found that adding execution traces to the prompts significantly improves the AI’s ability to fix bugs.

But there are some limitations. The team discovered that longer trace lengths and more variable changes can actually reduce the effectiveness of these prompts. They also found that the AI is unreliable when predicting function returns or exceptions, and tends to add unnecessary commentary or formatting mistakes.

Despite these challenges, the researchers are optimistic about the potential of their approach. By fine-tuning the prompts and training the AI on a wider range of problems, they believe it could become a powerful tool for software developers. And with the increasing complexity of modern software systems, any help we can get in debugging them is welcome.

The study also highlights some interesting quirks of artificial intelligence. For example, the team found that when predicting traces from scratch, the AI tends to add extra variable modifications within loops or miss important ones altogether. This suggests that AI may have limitations in its ability to reason deeply about code and keep track of complex state changes.

In the end, this research is a step towards creating more effective AI-powered debugging tools. It’s not perfect yet, but it’s an exciting development that could help us write better software faster and with fewer errors.

Cite this article: “Teaching AI to Fix Code: A Step Towards Smarter Debugging Tools”, The Science Archive, 2025.

Artificial Intelligence, Code Fixing, Software Bugs, Execution Traces, Debugging Skills, Programming, Ai-Powered, Debugging Tools, Software Development, Bug Repair

Reference: Mirazul Haque, Petr Babkin, Farima Farmahinifarahani, Manuela Veloso, “Towards Effectively Leveraging Execution Traces for Program Repair with Code LLMs” (2025).

Leave a Reply