ACL 2024findings1 citations

Fine-tuning Language Models for Joint Rewriting and Completion of Code with Potential Bugs

Dingmin Wang, Jinman Zhao, Hengzhi Pei, Samson Tan, Sheng Zha

Abstract

Handling drafty partial code remains a notable challenge in real-time code suggestion applications. Previous work has demonstrated shortcomings of large language models of code (CodeLLMs) in completing partial code with potential bugs. In this study, we view partial code as implementation hints and fine-tune CodeLLMs to jointly rewrite and complete partial code into functional full programs. We explore two strategies: one-pass generation and multi-pass iterative refinement. We construct new training and testing datasets using semantic-altering code transformations and iterative self-generations.We conduct comprehensive experiments over three representative open-sourced CodeLLMs – InCoder, CodeGen, and StarCoder.Results show that CodeLLMs fine-tuned using our approach achieve superior pass rates compared to the previous baselines across existing and newly-created benchmarks, effectively handle both potentially buggy and clean code, and largely preserve the integrity of the original partial implementations. We further present findings on the properties of the potential bugs we tested and on the design choices of our methods.

BibTeX
@inproceedings{wang-etal-2024-fine-tuning,
    title = "Fine-tuning Language Models for Joint Rewriting and Completion of Code with Potential Bugs",
    author = "Wang, Dingmin  and
      Zhao, Jinman  and
      Pei, Hengzhi  and
      Tan, Samson  and
      Zha, Sheng",
    editor = "Ku, Lun-Wei  and
      Martins, Andre  and
      Srikumar, Vivek",
    booktitle = "Findings of the Association for Computational Linguistics: ACL 2024",
    month = aug,
    year = "2024",
    address = "Bangkok, Thailand",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2024.findings-acl.938/",
    doi = "10.18653/v1/2024.findings-acl.938",
    pages = "15854--15868"
}
Fine-tuning Language Models for Joint Rewriting and Completion of Code with Potential Bugs · ACL 2024