A Lightweight Framework for High-Quality Code Generation

07/17/2023
by   Mohammed Latif Siddiq, et al.
0

In recent years, the use of automated source code generation utilizing transformer-based generative models has expanded, and these models can generate functional code according to the requirements of the developers. However, recent research revealed that these automatically generated source codes can contain vulnerabilities and other quality issues. Despite researchers' and practitioners' attempts to enhance code generation models, retraining and fine-tuning large language models is time-consuming and resource-intensive. Thus, we describe FRANC, a lightweight framework for recommending more secure and high-quality source code derived from transformer-based code generation models. FRANC includes a static filter to make the generated code compilable with heuristics and a quality-aware ranker to sort the code snippets based on a quality score. Moreover, the framework uses prompt engineering to fix persistent quality issues. We evaluated the framework with five Python and Java code generation models and six prompt datasets, including a newly created one in this work (SOEval). The static filter improves 9 and 10 improvement over the NDCG@10 score for the ranking system is 0.0763, and the repairing techniques repair the highest 80 average, 1.98 seconds for Java; for Python, it takes 0.08 seconds.

READ FULL TEXT
research
07/31/2020

Language Modelling for Source Code with Transformer-XL

It has been found that software, like natural language texts, exhibits "...
research
06/14/2019

Generation of Pseudo Code from the Python Source Code using Rule-Based Machine Translation

Pseudo code is one of the valuable artifacts to comprehending the comple...
research
07/24/2023

Refining ChatGPT-Generated Code: Characterizing and Mitigating Code Quality Issues

In this paper, we systematically study the quality of 4,066 ChatGPT-gene...
research
03/22/2021

Applying CodeBERT for Automated Program Repair of Java Simple Bugs

Software debugging, and program repair are among the most time-consuming...
research
04/04/2019

Neural Networks for Modeling Source Code Edits

Programming languages are emerging as a challenging and interesting doma...
research
10/07/2020

PyMT5: multi-mode translation of natural language and Python code with transformers

Simultaneously modeling source code and natural language has many exciti...
research
05/24/2023

Reinforcement Learning finetuned Vision-Code Transformer for UI-to-Code Generation

Automated HTML/CSS code generation from screenshots is an important yet ...

Please sign up or login with your details

Forgot password? Click here to reset