The utilization of programming language (PL) models, pretrained on large-scale code corpora, as a means of automating software engineering processes has demonstrated considerable potential in streamlining various code generation tasks such as code completion, code translation, and program synthesis. However, current approaches mainly rely on supervised fine-tuning objectives borrowed from text generation, neglecting specific sequence-level features of code, including but not limited to compilability as well as syntactic and functional correctness. To address this limitation, we propose PPOCoder, a new framework for code generation that combines pretrained PL models with Proximal Policy Optimization (PPO) deep reinforcement learning and employs execution feedback as the external source of knowledge into the model optimization. PPOCoder is transferable across different code generation tasks and PLs. Extensive experiments on three code generation tasks demonstrate the effectiveness of our proposed approach compared to SOTA methods, improving the success rate of compilation and functional correctness over different PLs. Our code can be found at https://github.com/reddy-lab-code-research/PPOCoder .
翻译:利用在大规模代码语料库上预训练的编程语言模型来自动化软件工程流程,在简化代码补全、代码翻译和程序合成等代码生成任务方面展现了巨大潜力。然而,当前方法主要依赖从文本生成中引入的监督微调目标,忽略了代码特有的序列级特征,包括但不限于可编译性以及语法和功能正确性。为解决这一局限,我们提出了PPOCoder——一种结合预训练编程语言模型与近端策略优化深度强化学习的新框架,并将执行反馈作为外部知识源融入模型优化。PPOCoder可迁移至不同代码生成任务和编程语言。在三个代码生成任务上的大量实验表明,与最先进方法相比,我们提出的方法能有效提升不同编程语言上的编译成功率和功能正确性。我们的代码可访问https://github.com/reddy-lab-code-research/PPOCoder。