Skip to Content
You are currently on the new version of our website. Access the old version .
ElectronicsElectronics
  • Article
  • Open Access

5 November 2021

14 Pages

Improving Text-to-Code Generation with Features of Code Graph on GPT-2

and
1
School of Computer Science and Engineering, The University of Aizu, Fukushima 965-8580, Japan
2
Department of Computer Science and Information Engineering, ChaoYang University of Technology, Taichung 413310, Taiwan
*
Author to whom correspondence should be addressed.

Abstract

Code generation, as a very hot application area of deep learning models for text, consists of two different fields: code-to-code and text-to-code. A recent approach, GraphCodeBERT uses code graph, which is called data flow, and showed good performance improvement. The base model architecture of it is bidirectional encoder representations from transformers (BERT), which uses the encoder part of a transformer. On the other hand, generative pre-trained transformer (GPT)—another multiple transformer architecture—uses the decoder part and shows great performance in the multilayer perceptron model. In this study, we investigate the improvement of code graphs with several variances on GPT-2 to refer to the abstract semantic tree used to collect the features of variables in the code. Here, we mainly focus on GPT-2 with additional features of code graphs that allow the model to learn the effect of the data stream. The experimental phase is divided into two parts: fine-tuning of the existing GPT-2 model, and pre-training from scratch using code data. When we pre-train a new model from scratch, the model produces an outperformed result compared with using the code graph with enough data.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.