ACL 2022findings73 citations

Compilable Neural Code Generation with Compiler Feedback

Xin Wang, Yasheng Wang, Yao Wan, Fei Mi, Yitong Li, Pingyi Zhou, Jin Liu, Hao Wu

Abstract

Automatically generating compilable programs with (or without) natural language descriptions has always been a touchstone problem for computational linguistics and automated software engineering. Existing deep-learning approaches model code generation as text generation, either constrained by grammar structures in decoder, or driven by pre-trained language models on large-scale code corpus (e.g., CodeGPT, PLBART, and CodeT5). However, few of them account for compilability of the generated programs. To improve compilability of the generated programs, this paper proposes COMPCODER, a three-stage pipeline utilizing compiler feedback for compilable code generation, including language model fine-tuning, compilability reinforcement, and compilability discrimination. Comprehensive experiments on two code generation tasks demonstrate the effectiveness of our proposed approach, improving the success rate of compilation from 44.18 to 89.18 in code completion on average and from 70.3 to 96.2 in text-to-code generation, respectively, when comparing with the state-of-the-art CodeGPT.

BibTeX
@inproceedings{wang-etal-2022-compilable,
    title = "Compilable Neural Code Generation with Compiler Feedback",
    author = "Wang, Xin  and
      Wang, Yasheng  and
      Wan, Yao  and
      Mi, Fei  and
      Li, Yitong  and
      Zhou, Pingyi  and
      Liu, Jin  and
      Wu, Hao  and
      Jiang, Xin  and
      Liu, Qun",
    editor = "Muresan, Smaranda  and
      Nakov, Preslav  and
      Villavicencio, Aline",
    booktitle = "Findings of the Association for Computational Linguistics: ACL 2022",
    month = may,
    year = "2022",
    address = "Dublin, Ireland",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2022.findings-acl.2/",
    doi = "10.18653/v1/2022.findings-acl.2",
    pages = "9--19"
}
Compilable Neural Code Generation with Compiler Feedback · ACL 2022