Keep the Conversation Going: Fixing 162 out of 337 bugs for 0.42 each using ChatGPT

04/01/2023
by   Chunqiu Steven Xia, et al.
0

Automated Program Repair (APR) aims to automatically generate patches for buggy programs. Recent APR work has been focused on leveraging modern Large Language Models (LLMs) to directly generate patches for APR. Such LLM-based APR tools work by first constructing an input prompt built using the original buggy code and then queries the LLM to generate patches. While the LLM-based APR tools are able to achieve state-of-the-art results, it still follows the classic Generate and Validate repair paradigm of first generating lots of patches and then validating each one afterwards. This not only leads to many repeated patches that are incorrect but also miss the crucial information in test failures as well as in plausible patches. To address these limitations, we propose ChatRepair, the first fully automated conversation-driven APR approach that interleaves patch generation with instant feedback to perform APR in a conversational style. ChatRepair first feeds the LLM with relevant test failure information to start with, and then learns from both failures and successes of earlier patching attempts of the same bug for more powerful APR. For earlier patches that failed to pass all tests, we combine the incorrect patches with their corresponding relevant test failure information to construct a new prompt for the LLM to generate the next patch. In this way, we can avoid making the same mistakes. For earlier patches that passed all the tests, we further ask the LLM to generate alternative variations of the original plausible patches. In this way, we can further build on and learn from earlier successes to generate more plausible patches to increase the chance of having correct patches. While our approach is general, we implement ChatRepair using state-of-the-art dialogue-based LLM – ChatGPT. By calculating the cost of accessing ChatGPT, we can fix 162 out of 337 bugs for $0.42 each!

READ FULL TEXT
research
01/30/2023

Conversational Automated Program Repair

Automated Program Repair (APR) can help developers automatically generat...
research
10/25/2022

Practical Program Repair in the Era of Large Pre-trained Language Models

Automated Program Repair (APR) aims to help developers automatically pat...
research
12/11/2020

A Comprehensive Study of Code-removal Patches in Automated Program Repair

Automatic Program Repair (APR) techniques can promisingly help reducing ...
research
12/08/2018

Production-Driven Patch Generation

We present an original concept for patch generation: we propose to do it...
research
03/18/2023

Revisiting the Plastic Surgery Hypothesis via Large Language Models

Automated Program Repair (APR) aspires to automatically generate patches...
research
08/16/2023

LeakPair: Proactive Repairing of Memory Leaks in Single Page Web Applications

Modern web applications often resort to application development framewor...
research
03/31/2021

Exploring Plausible Patches Using Source Code Embeddings in JavaScript

Despite the immense popularity of the Automated Program Repair (APR) fie...

Please sign up or login with your details

Forgot password? Click here to reset