Skip to content
/ RePair Public

This is offical implement of Automated Program Repair with Process-based Feedback.

Notifications You must be signed in to change notification settings

TnTWoW/RePair

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RePair: Automated Program Repair with Process-based Feedback

This is the official code for ACL'24 paper, RePair: Automated Program Repair with Process-based Feedback

Contents:

Overview

  • Humans make multiple revisions when writing programs, while LLMs cannot receive feedback from compiler and test cases to optimize its repair policies automatically. We are exploring how to ensure small-scale LLM still outperform through process supervision and feedback.

  • During training, we develop a reward model that serves as a critic, providing feedback for the fine-tuned LM’s action, progressively optimizing its policy.

  • During inference, we require the LM to generate solutions iteratively until the repair effect no longer improves or hits the maximum step limit.

Installation

The code requires some dependencies as specified in requirements.txt. Please follow the relevant libraries to install or run:

pip install -r requirements.txt

Datasets

We establish a multi-step program repair dataset based on CodeNet, which we call CodeNet4Repair. It include comprehensive test cases, problem descriptions, and detailed repair steps.

The dataset are available here:

https://huggingface.co/datasets/TnT/Multi_CodeNet4Repair

Usage

python inference.py --model_id TnT/process-based-repair --dataset_name TnT/Multi_CodeNet4Repair

Prompt

GPT-3.5 Prompt

You will play the role of a programming expert.

Given a problem and incorrect code, please fix the errors in the code and provide the correct code.

Note that you need to use markdown format for the code section.

Please ensure that the code is executable.

Our model's Prompt

Below is a description and wrong answer for the programming problem. Write the correct solution to fix it.

### Problem: <problem string>

### Instruction: <buggy program>

### Response:

Cases

Case1

image

Case2

image

Case3

image

Case4

image

Case5

image

Case6

image

Citation

If this work helps you, please cite us:

@inproceedings{zhao2024repair,
      title={RePair Automated Program Repair with Process-based Feedback}, 
      author={Yuze Zhao and Zhenya Huang and Yixiao Ma and Rui Li and Kai Zhang and Hao Jiang and Qi Liu and Linbo Zhu and Yu Su},
      year={2024},
      booktitle = {Findings of the Association for Computational Linguistics ACL 2024},
      month = aug,
      year = 2024,
      publisher = {Association for Computational Linguistics},
      pages = {16415--16429},
}

About

This is offical implement of Automated Program Repair with Process-based Feedback.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages