Exploring Parameter-Efficient Fine-Tuning of Large Language Model on Automated Program Repair

Guochang Li, Chen Zhi, Jialiang Chen, Junxiao Han, Shuiguang Deng

TL;DR

This paper investigates Parameter-Efficient Fine-Tuning (PEFT) methods for Large Language Models (LLMs) applied to Automated Program Repair (APR). The authors introduce a new instruction dataset, APR-INSTRUCTION, and demonstrate that PEFT methods can significantly improve bug-fixing capabilities while drastically reducing computational resources compared to full model fine-tuning.

What Problem Does This Paper Address?

Automated Program Repair (APR) aims to automatically fix bugs in software. While Large Language Models (LLMs) have shown promise in this area, fine-tuning them for APR typically requires substantial computational resources through Full Model Fine-Tuning (FMFT). Parameter-Efficient Fine-Tuning (PEFT) methods offer a way to adapt LLMs with significantly fewer trainable parameters, thus reducing computational costs without compromising performance. However, research on PEFT for APR, especially with execution-based evaluation, has been limited. This paper aims to fill this gap by exploring various PEFT methods on LLMs for APR, evaluating their effectiveness and efficiency.

Methods

The core of this work involves:

  • APR-INSTRUCTION Dataset Creation: The authors leverage existing APR datasets and employ prompt engineering with GPT-3.5-turbo to enrich them with descriptive information (bug descriptions, problem descriptions). This results in a new dataset, APR-INSTRUCTION, containing 30,000 instructions.
  • Parameter-Efficient Fine-Tuning (PEFT): Four PEFT methods are explored: LoRA, prefix-tuning, p-tuning v2, and (IA)³. These methods are applied to fine-tune several LLMs.
  • Execution-Based Evaluation: The generated patches are evaluated using test cases from established APR benchmarks, focusing on whether the patches pass the tests (pass@k metric). This is crucial for APR, as functional correctness is paramount.
  • Comparative Analysis: The performance of PEFT methods is compared against each other, against no fine-tuning, and against state-of-the-art (SOTA) LLM-based APR techniques. The computational efficiency (peak GPU memory, trainable parameters) of PEFT is also analyzed against FMFT.
  • Hyperparameter and Dataset Size Exploration: The paper investigates the impact of PEFT hyperparameters (specifically LoRA rank) and the size of the instruction dataset on fixing capabilities.

Datasets

  • APR-INSTRUCTION: A newly constructed dataset for APR, created by augmenting existing APR datasets with descriptive information using prompt engineering. It contains 30,000 instructions.
  • Existing APR Datasets: Used as a source for creating APR-INSTRUCTION.
  • Benchmarks for Evaluation:
    • Defects4J v2.0: A widely used benchmark for APR.
  • QuixBugs: Another benchmark for APR.
  • HumanEval-Java: A benchmark that aims to reduce data leakage risks.

Key Insights and Ideas

  • PEFT is Highly Effective for APR: PEFT methods can significantly boost the bug-fixing capabilities of LLMs for APR, often outperforming no fine-tuning and even approaching or exceeding SOTA FMFT approaches.
  • (IA)³ Shines: The (IA)³ PEFT method consistently demonstrates superior fixing capabilities across various LLMs, likely due to its ability to enhance LLM creativity and generate more diverse outputs.
  • Dataset Matters: The newly created APR-INSTRUCTION dataset shows better performance than general-purpose instruction datasets like Code Alpaca and OSS-INSTRUCTION for APR tasks.
  • Model Choice is Crucial: Not all LLMs perform equally well with PEFT for APR. Code-focused LLMs like DeepSeek-Coder-Base-6.7B and CodeLlama show better results than general-purpose models like Llama-2-7B, especially when fine-tuned on code-specific data.
  • Efficiency Gains are Substantial: PEFT methods drastically reduce peak GPU memory usage (45-50% less than FMFT) and the number of trainable parameters, making LLM fine-tuning for APR more accessible.
  • Hyperparameters and Dataset Size Trade-offs: While larger datasets generally lead to better performance, the gains from extremely large datasets might diminish. Similarly, increasing PEFT hyperparameters like LoRA rank doesn't always guarantee better results, suggesting an optimal configuration exists.

Key Results

  • The best model in this work, DeepSeek-Coder-Base-6.7B fine-tuned with (IA)³, fixes 58% more bugs than the SOTA LLM-based APR technique (INCODER-6B with FMFT) on the HumanEval-Java benchmark.
  • PEFT methods (LoRA, p-tuning, prefix-tuning, (IA)³) on CODELLAMA-7B improve bug fixing by 7.2%-31.3% compared to no fine-tuning.
  • PEFT methods reduce peak GPU memory usage by 45.6%-50.0% compared to FMFT.
  • (IA)³ consistently achieved the highest fixing capability among the four PEFT methods tested.
  • DeepSeek-Coder-Base-6.7B with (IA)³ achieved the highest overall fixing capability.
  • Reducing the APR-INSTRUCTION dataset size by 50% (to 15K instructions) resulted in only a 3.67% performance degradation.

Limitations and Future Work

  • Single-Hunk Focus: The study primarily focuses on single-hunk bugs, neglecting multi-hunk APR scenarios.
  • Hyperparameter Optimality: The optimal hyperparameters for p-tuning and prefix-tuning were not exhaustively explored due to resource limitations.
  • "Plausible" vs. "Correct" Patches: Test cases used for evaluation ensure "plausible" patches, but not necessarily complete line coverage for absolute correctness.
  • Quantization Methods: Advanced PEFT techniques like QLoRA, which can further reduce resource consumption, were not explored.
  • Multi-Language Support: The research is limited to Java APR tasks. Extending to other programming languages is a promising future direction.
  • Environmental Configurations: Exploring quantization methods would require additional environmental configurations not covered in this work.

Summary updated

BibTeX
@inproceedings{li2024exploring,
  author = {Guochang Li and Chen Zhi and Jialiang Chen and Junxiao Han and Shuiguang Deng},
  title = {{Exploring Parameter-Efficient Fine-Tuning of Large Language Model on Automated Program Repair}},
  booktitle = {ASE},
  year = {2024},
  doi = {10.1145/3691620.3695066},
}
Figure