Test-Driven Multi-Task Learning with Functionally Equivalent Code Transformation for Neural Code Generation

Xin Wang, Xiao Liu, Pingyi Zhou et al. · IEEE/ACM International Conference on Automated Software Engineering (ASE) · 2022

Automated code generation is a longstanding challenge in both communities of software engineering and artificial intelligence. Currently, some works have started to investigate the functional correctness of code generation, where a code snippet is considered correct if it passes a set of test cases. However, most existing works still model code generation as text generation without considering program-specific information, such as functionally equivalent code snippets and test execution feedback. To address the above limitations, this paper proposes a method combining program analysis with deep learning for neural code generation, where functionally equivalent code snippets and test execution feedback will be considered at the training stage. Concretely, we firstly design several code transformation heuristics to produce different variants of the code snippet satisfying the same functionality. In addition, we employ the test execution feedback and design a test-driven discriminative task to train a novel discriminator, aiming to let the model distinguish whether the generated code is correct or not. The preliminary results on a newly published dataset demonstrate the effectiveness of our proposed framework for code generation. Particularly, in terms of the [email protected] metric, we achieve 8.81 and 11.53 gains compared with CodeGPT and CodeT5, respectively.

Cited by 7 works. doi:10.1145/3551349.3559549

Authors

References