mlsanityData to 7 Oct 2026

Understanding Defects in Generated Codes by Language Models

arXiv 2408.13372 ↗First posted 23 Aug 2024cs.SE cs.AIcited by 4

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

  1. 2017Attention Is All You Needcited by 59,932
  2. 2023GPT-4 Technical Reportcited by 18,132
  3. 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
  4. 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
  5. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  6. 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,304
  7. 2023A Survey of Large Language Modelscited by 2,537
  8. 2022Competition-Level Code Generation with AlphaCodecited by 1,427
  9. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
  10. 2023A Survey on Evaluation of Large Language Modelscited by 1,227
  11. 2022Program of Thoughts Prompting: Disentangling Computation from Reasoning for Numerical Reasoning Taskscited by 1,057
  12. 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
20 more
  1. 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 876
  2. 2021Show Your Work: Scratchpads for Intermediate Computation with Language Modelscited by 871
  3. 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 600
  4. 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 492
  5. 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 468
  6. 2023Large Language Models for Software Engineering: A Systematic Literature Reviewcited by 389
  7. 2021Unified Pre-training for Program Understanding and Generationcited by 361
  8. 2023CodeT5+: Open Code Large Language Models for Code Understanding and Generationcited by 327
  9. 2020Unsupervised Translation of Programming Languagescited by 262
  10. 2019SPoC: Search-based Pseudocode to Codecited by 176
  11. 2023Software Testing with Large Language Models: Survey, Landscape, and Visioncited by 163
  12. 2023Structured Chain-of-Thought Prompting for Code Generationcited by 136
  13. 2023Chain of Code: Reasoning with a Language Model-Augmented Code Emulatorcited by 120
  14. 2022Is GitHub's Copilot as Bad as Humans at Introducing Vulnerabilities in Code?cited by 63
  15. 2023Unifying the Perspectives of NLP and Software Engineering: A Survey on Language Models for Codecited by 62
  16. 2024Bugs in Large Language Models Generated Code: An Empirical Studycited by 59
  17. 2023A Survey of Learning-based Automated Program Repaircited by 55
  18. 2021CodeTrans: Towards Cracking the Language of Silicon's Code Through Self-Supervised Deep Learning and High Performance Computingcited by 28
  19. 2023Multilingual Code Co-Evolution Using Large Language Modelscited by 9
  20. 2022Explainable AI for Pre-Trained Code Models: What Do They Learn? When They Do Not Work?cited by 8

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2025: 1; 2026: 3.

4 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2025Holistic Evaluation of State-of-the-Art LLMs for Code Generation
  2. 2024The Impact of Prompt Programming on Function-Level Code Generation
  3. 2025Are They All Good? Evaluating the Quality of CoTs in LLM-based Code Generation
  4. 2026Failure-Aware Enhancements for Large Language Model (LLM) Code Generation: An Empirical Study on Decision Framework ↗
  5. 2025Do Prompt Patterns Affect Code Quality? A First Empirical Assessment of ChatGPT-Generated Code
  6. 2026An Empirical Evaluation of LLM-Generated Code Security Across Prompting Methods
  7. 2025Prompt engineering and framework: implementation to increase code reliability based guideline for LLMs
  8. 2025Refining Critical Thinking in LLM Code Generation: A Faulty Premise-based Evaluation Framework