Understanding Defects in Generated Codes by Language Models
This study investigates the reliability of code generation by Large Language Models (LLMs), focusing on identifying and analyzing defects in the generated code. Despite the advanced capabilities of LLMs in automating code generation, ensuring the accuracy and functionality of the output remains a significant challenge. By using a structured defect classification method to understand their nature and origins this study categorizes and analyzes 367 identified defects from code snippets generated by LLMs, with a significant proportion being functionality and algorithm errors. These error categories indicate key areas where LLMs frequently fail, underscoring the need for targeted improvements. To enhance the accuracy of code generation, this paper implemented five prompt engineering techniques, including Scratchpad Prompting, Program of Thoughts Prompting, Chain-of-Thought Prompting, Chain of Code Prompting, and Structured Chain-of-Thought Prompting. These techniques were applied to refine the input prompts, aiming to reduce ambiguities and improve the models' accuracy rate. The research findings suggest that precise and structured prompting significantly mitigates common defects, thereby increasing the reliability of LLM-generated code.
Code (0)
등록된 구현이 없습니다.
Tasks
Code GenerationPrompt EngineeringSimilar Papers 제목 키워드 기반
Identifying and understanding the positive impact of defects and traps for perovskites optoelectronic devices
Abstract: Defects are generally regarded to have negative impact on carrier recombination, charge-transport and ion migration in perovskite materials, which thus lower the efficiency and stability of perovskite optoelect…
Defects in Perovskites Have Positive Impact on Optoelectronic Devices
Defects are generally regarded to have negative impact on carrier recombination, charge-transport and ion migration in perovskite materials, which thus lower the efficiency and stability of perovskite optoelectronic devi…
Charge trapping in lead halide perovskites enhanced the performance of optoelectronic devices
[Deng Y H. Can defects be positive in perovskite optoelectronic devices?[J]. arXiv preprint arXiv:2012.04346, 2020. https://arxiv.org/abs/2012.04346] Abstract: Defects are generally regarded to have negative impact on…
A Survey of Bugs in AI-Generated Code
Developers are widely using AI code-generation models, aiming to increase productivity and efficiency. However, there are also quality concerns regarding the AI-generated code. The generated code is produced by models tr…
A Hierarchical Deep Neural Network for Detecting Lines of Codes with Vulnerabilities
Software vulnerabilities, caused by unintentional flaws in source codes, are the main root cause of cyberattacks. Source code static analysis has been used extensively to detect the unintentional defects, i.e. vulnerabil…