Research Article

CODE GENERATION USING TRANSFORMER BASED LANGUAGE MODEL

Number: 049 June 30, 2022
EN

CODE GENERATION USING TRANSFORMER BASED LANGUAGE MODEL

Abstract

Machine Learning has attracted researchers in the last decades and has been applied to different problems in many fields. Deep Learning methods which is a subfield of Machine Learning have started to be utilized to solve complex and hard problems with the improvement of computer technologies. Natural language processing is one of the challenging tasks that still needs to be improved for different applications such as code generation. Recently, general-purpose transformer based autoregressive language models achieved promising results on natural language generation tasks. Code generation from natural utterance using deep learning methods could be a promising development in terms of decreasing mental effort and time spent. In this study, a layered approach to generate Cascading Styles Sheets rules is proposed. The abstract data is obtained using a large-scale language model from natural utterances. Then the information is encoded into Abstract Syntax Tree. Finally, Abstract Syntax Tree structure is decoded in order to generate the Cascading Styles Sheets rules. In order to measure the performance of the proposed method an experimental procedure is constructed. Using pre-trained transformers and generated training data for Cascading Styles Sheets rules, different tests are applied to different datasets and the accuracies are obtained. Promising results for Cascading Styles Sheets code generation tasks using structural and natural prompt design are achieved. 46.98% and 66.07% overall accuracies are obtained for structural and natural prompt designs, respectively.

Keywords

Supporting Institution

Eskisehir Technical University

Project Number

21GAP084

Thanks

This work is supported by Eskisehir Technical University scientific research projects with the project number of 21GAP084. We acknowledge the support provided by Greg Brockman from OpenAI, for allowing academic access to the GPT-3 beta program.

References

  1. [1] Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, Ł., and Polosukhin, I., (2017), Attention is all you need. Advances in Neural Information Processing Systems, 30.
  2. [2] Yin, P., and Neubig, G., (2019), Reranking for neural semantic parsing. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics.
  3. [3] Zhang, J., Wang, X., Zhang, H., Sun, H., Wang, K., and Liu, X., (2019), A novel neural source code representation based on abstract syntax tree. In 2019 IEEE/ACM 41st International Conference on Software Engineering (ICSE), 783-794, IEEE.
  4. [4] Uma, M., Sneha, V., Sneha, G., Bhuvana, J., and Bharathi, B., (2019), Formation of SQL from natural language query using NLP. In 2019 International Conference on Computational Intelligence in Data Science (ICCIDS), 1-5, IEEE.
  5. [5] Galassi, A., Lippi, M., and Torroni, P., (2020), Attention in natural language processing. IEEE Transactions on Neural Networks and Learning Systems, 32, 4291-4308.
  6. [6] Sun, Z., Zhu, Q., Mou, L., Xiong, Y., Li, G., and Zhang, L., (2019), A grammar-based structural cnn decoder for code generation. In Proceedings of the AAAI Conference on Artificial Intelligence, 7055-7062. [7] Shiv, V., and Quirk, C., (2019), Novel positional encodings to enable tree-based transformers. Advances in Neural Information Processing Systems, 32.
  7. [8] Sun, Z., Zhu, Q., Xiong, Y., Sun, Y., Mou, L., and Zhang, L., (2020), Treegen: A tree-based transformer architecture for code generation. In Proceedings of the AAAI Conference on Artificial Intelligence, 8984-8991.
  8. [9] Quirk, C., Mooney, R., and Galley, M., (2015), Language to code: Learning semantic parsers for if-this-then-that recipes. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), 878-888.

Details

Primary Language

English

Subjects

Engineering

Journal Section

Research Article

Publication Date

June 30, 2022

Submission Date

March 9, 2022

Acceptance Date

May 12, 2022

Published in Issue

Year 2022 Number: 049

APA
Alaçam, U. C., Gökgöz, Ç., & Perkgöz, C. (2022). CODE GENERATION USING TRANSFORMER BASED LANGUAGE MODEL. Journal of Scientific Reports-A, 049, 49-61. https://izlik.org/JA46AY99XC
AMA
1.Alaçam UC, Gökgöz Ç, Perkgöz C. CODE GENERATION USING TRANSFORMER BASED LANGUAGE MODEL. JSR-A. 2022;(049):49-61. https://izlik.org/JA46AY99XC
Chicago
Alaçam, Umut Can, Çağla Gökgöz, and Cahit Perkgöz. 2022. “CODE GENERATION USING TRANSFORMER BASED LANGUAGE MODEL”. Journal of Scientific Reports-A, nos. 049: 49-61. https://izlik.org/JA46AY99XC.
EndNote
Alaçam UC, Gökgöz Ç, Perkgöz C (June 1, 2022) CODE GENERATION USING TRANSFORMER BASED LANGUAGE MODEL. Journal of Scientific Reports-A 049 49–61.
IEEE
[1]U. C. Alaçam, Ç. Gökgöz, and C. Perkgöz, “CODE GENERATION USING TRANSFORMER BASED LANGUAGE MODEL”, JSR-A, no. 049, pp. 49–61, June 2022, [Online]. Available: https://izlik.org/JA46AY99XC
ISNAD
Alaçam, Umut Can - Gökgöz, Çağla - Perkgöz, Cahit. “CODE GENERATION USING TRANSFORMER BASED LANGUAGE MODEL”. Journal of Scientific Reports-A. 049 (June 1, 2022): 49-61. https://izlik.org/JA46AY99XC.
JAMA
1.Alaçam UC, Gökgöz Ç, Perkgöz C. CODE GENERATION USING TRANSFORMER BASED LANGUAGE MODEL. JSR-A. 2022;:49–61.
MLA
Alaçam, Umut Can, et al. “CODE GENERATION USING TRANSFORMER BASED LANGUAGE MODEL”. Journal of Scientific Reports-A, no. 049, June 2022, pp. 49-61, https://izlik.org/JA46AY99XC.
Vancouver
1.Umut Can Alaçam, Çağla Gökgöz, Cahit Perkgöz. CODE GENERATION USING TRANSFORMER BASED LANGUAGE MODEL. JSR-A [Internet]. 2022 Jun. 1;(049):49-61. Available from: https://izlik.org/JA46AY99XC