Understanding Defects in Generated Codes by Language Models
Not on the map. Why?
Abstract (arXiv)
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.
Key facts. Cited by 4 papers in the map (data through 7 Oct 2026). Builds on 32 of its 41 references that are in the map. First posted on arXiv 23 Aug 2024.
Builds on
32 of 41 references.
References · 32
- 2017Attention Is All You Needcited by 59,932
- 2023GPT-4 Technical Reportcited by 18,132
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,304
- 2023A Survey of Large Language Modelscited by 2,537
- 2022Competition-Level Code Generation with AlphaCodecited by 1,427
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
- 2023A Survey on Evaluation of Large Language Modelscited by 1,227
- 2022Program of Thoughts Prompting: Disentangling Computation from Reasoning for Numerical Reasoning Taskscited by 1,057
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
20 more
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 876
- 2021Show Your Work: Scratchpads for Intermediate Computation with Language Modelscited by 871
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 600
- 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 492
- 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 468
- 2023Large Language Models for Software Engineering: A Systematic Literature Reviewcited by 389
- 2021Unified Pre-training for Program Understanding and Generationcited by 361
- 2023CodeT5+: Open Code Large Language Models for Code Understanding and Generationcited by 327
- 2020Unsupervised Translation of Programming Languagescited by 262
- 2019SPoC: Search-based Pseudocode to Codecited by 176
- 2023Software Testing with Large Language Models: Survey, Landscape, and Visioncited by 163
- 2023Structured Chain-of-Thought Prompting for Code Generationcited by 136
- 2023Chain of Code: Reasoning with a Language Model-Augmented Code Emulatorcited by 120
- 2022Is GitHub's Copilot as Bad as Humans at Introducing Vulnerabilities in Code?cited by 63
- 2023Unifying the Perspectives of NLP and Software Engineering: A Survey on Language Models for Codecited by 62
- 2024Bugs in Large Language Models Generated Code: An Empirical Studycited by 59
- 2023A Survey of Learning-based Automated Program Repaircited by 55
- 2021CodeTrans: Towards Cracking the Language of Silicon's Code Through Self-Supervised Deep Learning and High Performance Computingcited by 28
- 2023Multilingual Code Co-Evolution Using Large Language Modelscited by 9
- 2022Explainable AI for Pre-Trained Code Models: What Do They Learn? When They Do Not Work?cited by 8
Built on by
Citing papers per year: 2025: 1; 2026: 3.
4 papers.
- 2026ARIADNE: Agentic Reward-Informed Adaptive Decision Exploration via Blackboard-Driven MCTS for Competitive Program Generationcited by 1
- 2025Specification and Detection of LLM Code Smellscited by 0
- 2026Do Influence Tactics Matter? Investigating Prompt Framing Effects in LLM Code Generationcited by 0
- 2026Complexity-Aware Evaluation of LLM Comprehensioncited by 0
- 2026Complexity-Aware Evaluation of LLM Comprehension29 Sep 2026
- 2026Do Influence Tactics Matter? Investigating Prompt Framing Effects in LLM Code Generation11 Aug 2026
- 2026ARIADNE: Agentic Reward-Informed Adaptive Decision Exploration via Blackboard-Driven MCTS for Competitive Program Generation4 May 2026
- 2025Specification and Detection of LLM Code Smells19 Dec 2025
Similar, not cited
Close in wording, no citation either way
- 2025Holistic Evaluation of State-of-the-Art LLMs for Code Generation
- 2024The Impact of Prompt Programming on Function-Level Code Generation
- 2025Are They All Good? Evaluating the Quality of CoTs in LLM-based Code Generation
- 2026Failure-Aware Enhancements for Large Language Model (LLM) Code Generation: An Empirical Study on Decision Framework ↗
- 2025Do Prompt Patterns Affect Code Quality? A First Empirical Assessment of ChatGPT-Generated Code
- 2026An Empirical Evaluation of LLM-Generated Code Security Across Prompting Methods
- 2025Prompt engineering and framework: implementation to increase code reliability based guideline for LLMs
- 2025Refining Critical Thinking in LLM Code Generation: A Faulty Premise-based Evaluation Framework