mlsanityData to 7 Oct 2026

Bugs in Large Language Models Generated Code: An Empirical Study

arXiv 2403.08937 ↗First posted 13 Mar 2024cs.SE cs.AIcited by 59

Not on the map. Why?

Abstract (arXiv)

Large Language Models (LLMs) for code have gained significant attention recently. They can generate code in different programming languages based on provided prompts, fulfilling a long-lasting dream in Software Engineering (SE), i.e., automatic code generation. Similar to human-written code, LLM-generated code is prone to bugs, and these bugs have not yet been thoroughly examined by the community. Given the increasing adoption of LLM-based code generation tools (e.g., GitHub Copilot) in SE activities, it is critical to understand the characteristics of bugs contained in code generated by LLMs. This paper examines a sample of 333 bugs collected from code generated using three leading LLMs (i.e., CodeGen, PanGu-Coder, and Codex) and identifies the following 10 distinctive bug patterns: Misinterpretations, Syntax Error, Silly Mistake, Prompt-biased code, Missing Corner Case, Wrong Input Type, Hallucinated Object, Wrong Attribute, Incomplete Generation, and Non-Prompted Consideration. The bug patterns are presented in the form of a taxonomy. The identified bug patterns are validated using an online survey with 34 LLM practitioners and researchers. The surveyed participants generally asserted the significance and prevalence of the bug patterns. Researchers and practitioners can leverage these findings to develop effective quality assurance techniques for LLM-generated code. This study sheds light on the distinctive characteristics of LLM-generated code.

Key facts. Cited by 59 papers in the map (data through 7 Oct 2026). Builds on 42 of its 87 references that are in the map. First posted on arXiv 13 Mar 2024.

Builds on

42 of 87 references.

References · 42

  1. 2020Language Models are Few-Shot Learnerscited by 32,199
  2. 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
  3. 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
  4. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  5. 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,304
  6. 2021Program Synthesis with Large Language Modelscited by 3,509
  7. 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,332
  8. 2023Teaching Large Language Models to Self-Debugcited by 963
  9. 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 876
  10. 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
  11. 2022CodeT: Code Generation with Generated Testscited by 369
  12. 2023OctoPack: Instruction Tuning Code Large Language Modelscited by 178
30 more
  1. 2023ClassEval: A Manually-Crafted Benchmark for Evaluating LLMs on Class-level Code Generationcited by 166
  2. 2022GitHub Copilot AI pair programmer: Asset or Liability?cited by 150
  3. 2023Structured Chain-of-Thought Prompting for Code Generationcited by 136
  4. 2022Large Language Models Meet NL2Code: A Surveycited by 135
  5. 2021PanGu-α: Large-scale Autoregressive Pretrained Chinese Language Models with Auto-parallel Computationcited by 134
  6. 2023InferFix: End-to-End Program Repair with LLMscited by 113
  7. 2019Taxonomy of Real Faults in Deep Learning Systemscited by 90
  8. 2023Refining ChatGPT-Generated Code: Characterizing and Mitigating Code Quality Issuescited by 78
  9. 2022Automated Repair of Programs from Large Language Modelscited by 71
  10. 2023On the Robustness of Code Generation Techniques: An Empirical Study on GitHub Copilotcited by 64
  11. 2022Is GitHub's Copilot as Bad as Humans at Introducing Vulnerabilities in Code?cited by 63
  12. 2024EffiBench: Benchmarking the Efficiency of Automatically Generated Codecited by 62
  13. 2023How Novices Use LLM-Based Code Generators to Solve CS1 Coding Tasks in a Self-Paced Learning Environmentcited by 55
  14. 2023"What It Wants Me To Say": Bridging the Abstraction Gap Between End-User Programmers and Code-Generating Large Language Modelscited by 48
  15. 2022PanGu-Coder: Program Synthesis with Function-Level Language Modelingcited by 47
  16. 2023Large Language Models and Simple, Stupid Bugscited by 45
  17. 2022CCTEST: Testing and Repairing Code Completion Systemscited by 35
  18. 2023ChatGPT vs SBST: A Comparative Assessment of Unit Test Suite Generationcited by 32
  19. 2021Silent Bugs in Deep Learning Frameworks: An Empirical Study of Keras and TensorFlowcited by 25
  20. 2018Automatic Software Repair: a Bibliographycited by 24
  21. 2021Faults in Deep Reinforcement Learning Programs: A Taxonomy and A Detection Approachcited by 18
  22. 2024Do Machines and Humans Focus on Similar Code? Exploring Explainability of Large Language Models in Code Summarizationcited by 16
  23. 2023Benchmarking and Explaining Large Language Model-based Code Generation: A Causality-Centric Approachcited by 15
  24. 2023Coffee: Boost Your Code LLMs by Fixing Bugs with Feedbackcited by 15
  25. 2017Stack Overflow Considered Harmful? The Impact of Copy&Paste on Android Application Securitycited by 11
  26. 2023Bug Characterization in Machine Learning-based Systemscited by 10
  27. 2023Extending the Frontier of ChatGPT: Code Generation and Debuggingcited by 9
  28. 2023Turbulence: Systematically and Automatically Testing Instruction-Tuned Large Language Models for Codecited by 9
  29. 2019An Empirical Study of C++ Vulnerabilities in Crowd-Sourced Code Examplescited by 7
  30. 2022Exploring the Verifiability of Code Generated by GitHub Copilotcited by 4

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2024: 14; 2025: 25; 2026: 20.

59 papers.

Sort:

By area:

  1. 2024Beyond Functional Correctness: Exploring Hallucinations in LLM-Generated Codecited by 106
  2. 2024When LLMs Meet Cybersecurity: A Systematic Literature Reviewcited by 70
  3. 2024What's Wrong with Your Code Generated by Large Language Models? An Extensive Studycited by 52
  4. 2025Type-Constrained Code Generation with Language Modelscited by 32
  5. 2025Correctness Assessment of Code Generated by Large Language Models Using Internal Representationscited by 17
  6. 2024MdEval: Massively Multilingual Code Debuggingcited by 16
  7. 2025CodeIF-Bench: Evaluating Instruction-Following Capabilities of Large Language Models in Interactive Code Generationcited by 14
  8. 2024Rethinking Software Engineering in the Foundation Model Era: From Task-Driven AI Copilots to Goal-Driven AI Pair Programmerscited by 11
  9. 2024RAMBO: Enhancing RAG-based Repository-Level Method Body Completioncited by 10
  10. 2024A Deep Dive Into Large Language Model Code Generation Mistakes: What and Why?cited by 9
  11. 2025Hallucination by Code Generation LLMs: Taxonomy, Benchmarks, Mitigation, and Challengescited by 9
  12. 2024Model Editing for LLMs4Code: How Far are We?cited by 8
38 more
  1. 2025Beyond Synthetic Benchmarks: Evaluating LLM Performance on Real-World Class-Level Code Generationcited by 8
  2. 2026How AI Coding Agents Modify Code: A Large-Scale Study of GitHub Pull Requestscited by 7
  3. 2025When Do LLMs Admit Their Mistakes? Understanding The Role Of Model Belief In Retractioncited by 6
  4. 2025CodeMirage: A Multi-Lingual Benchmark for Detecting AI-Generated and Paraphrased Source Code from Production-Level LLMscited by 6
  5. 2025IFEvalCode: Controlled Code Generationcited by 5
  6. 2026Real Faults in Model Context Protocol (MCP) Software: a Comprehensive Taxonomycited by 5
  7. 2024Understanding Defects in Generated Codes by Language Modelscited by 4
  8. 2025Assessing the Impact of Code Changes on the Fault Localizability of Large Language Modelscited by 4
  9. 2025Code Copycat Conundrum: Demystifying Repetition in LLM-based Code Generationcited by 4
  10. 2024Chain of Targeted Verification Questions to Improve the Reliability of Code Generated by LLMscited by 3
  11. 2024TaskEval: Assessing Difficulty of Code Generation Tasks for Large Language Modelscited by 3
  12. 2024One Step at a Time: Combining LLMs and Static Analysis to Generate Next-Step Hints for Programming Taskscited by 3
  13. 2025Deep-Bench: Deep Learning Benchmark Dataset for Code Generationcited by 3
  14. 2026DVAO: Dynamic Variance-adaptive Advantage Optimization for Multi-reward Reinforcement Learningcited by 3
  15. 2024Towards Specification-Driven LLM-Based Generation of Embedded Automotive Softwarecited by 2
  16. 2025A Qualitative Investigation into LLM-Generated Multilingual Code Comments and Automatic Evaluation Metricscited by 2
  17. 2025Multicalibration for LLM-based Code Generationcited by 2
  18. 2025IaC Generation with LLMs: An Error Taxonomy and A Study on Configuration Knowledge Injectioncited by 2
  19. 2026An Exploratory Study on LLM-Generated Code and Comments in Code Repositoriescited by 2
  20. 2024DeepCodeProbe: Towards Understanding What Models Trained on Code Learncited by 1
  21. 2025On Developers' Self-Declaration of AI-Generated Code: An Analysis of Practicescited by 1
  22. 2025Assessing LLM code generation quality through path planning taskscited by 1
  23. 2025Investigating Security Implications of Automatically Generated Code on the Software Supply Chaincited by 1
  24. 2026Model See, Model Do? Exposure-Aware Evaluation of Bug-vs-Fix Preference in Code LLMscited by 1
  25. 2026Precise Debugging Benchmark: Is Your Model Debugging or Regenerating?cited by 1
  26. 2026Bridging Generation and Training: A Systematic Review of Quality Issues in LLMs for Codecited by 1
  27. 2025Navigating Pitfalls: Evaluating LLMs in Machine Learning Programming Educationcited by 0
  28. 2025code_transformed: The Influence of Large Language Models on Codecited by 0
  29. 2025SVAgent: AI Agent for Hardware Security Verification Assertioncited by 0
  30. 2025ReCatcher: Towards LLMs Regression Testing for Code Generationcited by 0
  31. 2025When the Code Autopilot Breaks: Why LLMs Falter in Embedded Machine Learningcited by 0
  32. 2025Benchmarking Web API Integration Code Generationcited by 0
  33. 2025Automating Android Build Repair: Bridging the Reasoning-Execution Gap in LLM Agents with Domain-Specific Toolscited by 0
  34. 2025Learning to Guarantee Type Correctness in Code Generation through Type-Guided Program Synthesiscited by 0
  35. 2026Tricky2: Towards a Benchmark for Evaluating Human and LLM Error Interactionscited by 0
  36. 2026Co-Located Tests, Better AI Code: How Test Syntax Structure Affects Foundation Model Code Generationcited by 0
  37. 2026An Empirical Evaluation of Locally Deployed LLMs for Bug Detection in Python Codecited by 0
  38. 2026HybridCodeAuthorship: A Benchmark Dataset for Line-Level Code Authorship Detectioncited by 0

50 most cited of 59 All 59 (JSON)