Bugs in Large Language Models Generated Code: An Empirical Study
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
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
- 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
- 2021Program Synthesis with Large Language Modelscited by 3,509
- 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,332
- 2023Teaching Large Language Models to Self-Debugcited by 963
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 876
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
- 2022CodeT: Code Generation with Generated Testscited by 369
- 2023OctoPack: Instruction Tuning Code Large Language Modelscited by 178
30 more
- 2023ClassEval: A Manually-Crafted Benchmark for Evaluating LLMs on Class-level Code Generationcited by 166
- 2022GitHub Copilot AI pair programmer: Asset or Liability?cited by 150
- 2023Structured Chain-of-Thought Prompting for Code Generationcited by 136
- 2022Large Language Models Meet NL2Code: A Surveycited by 135
- 2021PanGu-α: Large-scale Autoregressive Pretrained Chinese Language Models with Auto-parallel Computationcited by 134
- 2023InferFix: End-to-End Program Repair with LLMscited by 113
- 2019Taxonomy of Real Faults in Deep Learning Systemscited by 90
- 2023Refining ChatGPT-Generated Code: Characterizing and Mitigating Code Quality Issuescited by 78
- 2022Automated Repair of Programs from Large Language Modelscited by 71
- 2023On the Robustness of Code Generation Techniques: An Empirical Study on GitHub Copilotcited by 64
- 2022Is GitHub's Copilot as Bad as Humans at Introducing Vulnerabilities in Code?cited by 63
- 2024EffiBench: Benchmarking the Efficiency of Automatically Generated Codecited by 62
- 2023How Novices Use LLM-Based Code Generators to Solve CS1 Coding Tasks in a Self-Paced Learning Environmentcited by 55
- 2023"What It Wants Me To Say": Bridging the Abstraction Gap Between End-User Programmers and Code-Generating Large Language Modelscited by 48
- 2022PanGu-Coder: Program Synthesis with Function-Level Language Modelingcited by 47
- 2023Large Language Models and Simple, Stupid Bugscited by 45
- 2022CCTEST: Testing and Repairing Code Completion Systemscited by 35
- 2023ChatGPT vs SBST: A Comparative Assessment of Unit Test Suite Generationcited by 32
- 2021Silent Bugs in Deep Learning Frameworks: An Empirical Study of Keras and TensorFlowcited by 25
- 2018Automatic Software Repair: a Bibliographycited by 24
- 2021Faults in Deep Reinforcement Learning Programs: A Taxonomy and A Detection Approachcited by 18
- 2024Do Machines and Humans Focus on Similar Code? Exploring Explainability of Large Language Models in Code Summarizationcited by 16
- 2023Benchmarking and Explaining Large Language Model-based Code Generation: A Causality-Centric Approachcited by 15
- 2023Coffee: Boost Your Code LLMs by Fixing Bugs with Feedbackcited by 15
- 2017Stack Overflow Considered Harmful? The Impact of Copy&Paste on Android Application Securitycited by 11
- 2023Bug Characterization in Machine Learning-based Systemscited by 10
- 2023Extending the Frontier of ChatGPT: Code Generation and Debuggingcited by 9
- 2023Turbulence: Systematically and Automatically Testing Instruction-Tuned Large Language Models for Codecited by 9
- 2019An Empirical Study of C++ Vulnerabilities in Crowd-Sourced Code Examplescited by 7
- 2022Exploring the Verifiability of Code Generated by GitHub Copilotcited by 4
Built on by
Citing papers per year: 2024: 14; 2025: 25; 2026: 20.
59 papers.
Sort:
By area:
- 2024Beyond Functional Correctness: Exploring Hallucinations in LLM-Generated Codecited by 106
- 2024When LLMs Meet Cybersecurity: A Systematic Literature Reviewcited by 70
- 2024What's Wrong with Your Code Generated by Large Language Models? An Extensive Studycited by 52
- 2025Type-Constrained Code Generation with Language Modelscited by 32
- 2025Correctness Assessment of Code Generated by Large Language Models Using Internal Representationscited by 17
- 2024MdEval: Massively Multilingual Code Debuggingcited by 16
- 2025CodeIF-Bench: Evaluating Instruction-Following Capabilities of Large Language Models in Interactive Code Generationcited by 14
- 2024Rethinking Software Engineering in the Foundation Model Era: From Task-Driven AI Copilots to Goal-Driven AI Pair Programmerscited by 11
- 2024RAMBO: Enhancing RAG-based Repository-Level Method Body Completioncited by 10
- 2024A Deep Dive Into Large Language Model Code Generation Mistakes: What and Why?cited by 9
- 2025Hallucination by Code Generation LLMs: Taxonomy, Benchmarks, Mitigation, and Challengescited by 9
- 2024Model Editing for LLMs4Code: How Far are We?cited by 8
38 more
- 2025Beyond Synthetic Benchmarks: Evaluating LLM Performance on Real-World Class-Level Code Generationcited by 8
- 2026How AI Coding Agents Modify Code: A Large-Scale Study of GitHub Pull Requestscited by 7
- 2025When Do LLMs Admit Their Mistakes? Understanding The Role Of Model Belief In Retractioncited by 6
- 2025CodeMirage: A Multi-Lingual Benchmark for Detecting AI-Generated and Paraphrased Source Code from Production-Level LLMscited by 6
- 2025IFEvalCode: Controlled Code Generationcited by 5
- 2026Real Faults in Model Context Protocol (MCP) Software: a Comprehensive Taxonomycited by 5
- 2024Understanding Defects in Generated Codes by Language Modelscited by 4
- 2025Assessing the Impact of Code Changes on the Fault Localizability of Large Language Modelscited by 4
- 2025Code Copycat Conundrum: Demystifying Repetition in LLM-based Code Generationcited by 4
- 2024Chain of Targeted Verification Questions to Improve the Reliability of Code Generated by LLMscited by 3
- 2024TaskEval: Assessing Difficulty of Code Generation Tasks for Large Language Modelscited by 3
- 2024One Step at a Time: Combining LLMs and Static Analysis to Generate Next-Step Hints for Programming Taskscited by 3
- 2025Deep-Bench: Deep Learning Benchmark Dataset for Code Generationcited by 3
- 2026DVAO: Dynamic Variance-adaptive Advantage Optimization for Multi-reward Reinforcement Learningcited by 3
- 2024Towards Specification-Driven LLM-Based Generation of Embedded Automotive Softwarecited by 2
- 2025A Qualitative Investigation into LLM-Generated Multilingual Code Comments and Automatic Evaluation Metricscited by 2
- 2025Multicalibration for LLM-based Code Generationcited by 2
- 2025IaC Generation with LLMs: An Error Taxonomy and A Study on Configuration Knowledge Injectioncited by 2
- 2026An Exploratory Study on LLM-Generated Code and Comments in Code Repositoriescited by 2
- 2024DeepCodeProbe: Towards Understanding What Models Trained on Code Learncited by 1
- 2025On Developers' Self-Declaration of AI-Generated Code: An Analysis of Practicescited by 1
- 2025Assessing LLM code generation quality through path planning taskscited by 1
- 2025Investigating Security Implications of Automatically Generated Code on the Software Supply Chaincited by 1
- 2026Model See, Model Do? Exposure-Aware Evaluation of Bug-vs-Fix Preference in Code LLMscited by 1
- 2026Precise Debugging Benchmark: Is Your Model Debugging or Regenerating?cited by 1
- 2026Bridging Generation and Training: A Systematic Review of Quality Issues in LLMs for Codecited by 1
- 2025Navigating Pitfalls: Evaluating LLMs in Machine Learning Programming Educationcited by 0
- 2025code_transformed: The Influence of Large Language Models on Codecited by 0
- 2025SVAgent: AI Agent for Hardware Security Verification Assertioncited by 0
- 2025ReCatcher: Towards LLMs Regression Testing for Code Generationcited by 0
- 2025When the Code Autopilot Breaks: Why LLMs Falter in Embedded Machine Learningcited by 0
- 2025Benchmarking Web API Integration Code Generationcited by 0
- 2025Automating Android Build Repair: Bridging the Reasoning-Execution Gap in LLM Agents with Domain-Specific Toolscited by 0
- 2025Learning to Guarantee Type Correctness in Code Generation through Type-Guided Program Synthesiscited by 0
- 2026Tricky2: Towards a Benchmark for Evaluating Human and LLM Error Interactionscited by 0
- 2026Co-Located Tests, Better AI Code: How Test Syntax Structure Affects Foundation Model Code Generationcited by 0
- 2026An Empirical Evaluation of Locally Deployed LLMs for Bug Detection in Python Codecited by 0
- 2026HybridCodeAuthorship: A Benchmark Dataset for Line-Level Code Authorship Detectioncited by 0
50 most cited of 59 All 59 (JSON)
- 2026Code That Works, Environments That Don't: Measuring Environment Reproducibility in AI-Generated Software30 Sep 2026
- 2026What is the Difference Between Me and You? Benchmarking the Quality Gap Between Human-Written and AI-Generated Code11 Sep 2026
- 2026Entropy-Regularized Rank-Masked Policy Optimization for Test-Time Reinforcement Learning in Code Generation8 Sep 2026
- 2026Evaluating Inference-Time Defenses Against Package Hallucination in LLM-Generated Code23 Aug 2026
- 2026How Do AI Coding Agents Contribute to Software Development? an Empirical Study of Agentic Pull Requests23 Jul 2026
- 2026Knowledge-Conditioned, Single-Pass LLM Synthesis of Executable Unity Game Scenes: A Compiler Error Census across 26 Goal Playable Concepts11 Jul 2026
- 2026Effectiveness of LLM-based Software Diversity for Reliability Improvement -- an Empirical Study3 Jul 2026
- 2026Prompt Coverage Adequacy2 Jul 2026
- 2026An Exploratory Study on LLM-Generated Code and Comments in Code Repositories2 Jul 2026
- 2026Simulating Students' Java Programming Errors with Large Language Models12 Jun 2026
- 2026HybridCodeAuthorship: A Benchmark Dataset for Line-Level Code Authorship Detection10 Jun 2026
- 2026DVAO: Dynamic Variance-adaptive Advantage Optimization for Multi-reward Reinforcement Learning25 May 2026
38 more
- 2026Bridging Generation and Training: A Systematic Review of Quality Issues in LLMs for Code6 May 2026
- 2026An Empirical Evaluation of Locally Deployed LLMs for Bug Detection in Python Code25 Apr 2026
- 2026Co-Located Tests, Better AI Code: How Test Syntax Structure Affects Foundation Model Code Generation20 Apr 2026
- 2026Precise Debugging Benchmark: Is Your Model Debugging or Regenerating?19 Apr 2026
- 2026Real Faults in Model Context Protocol (MCP) Software: a Comprehensive Taxonomy5 Mar 2026
- 2026Tricky2: Towards a Benchmark for Evaluating Human and LLM Error Interactions26 Jan 2026
- 2026How AI Coding Agents Modify Code: A Large-Scale Study of GitHub Pull Requests24 Jan 2026
- 2026Model See, Model Do? Exposure-Aware Evaluation of Bug-vs-Fix Preference in Code LLMs15 Jan 2026
- 2025IaC Generation with LLMs: An Error Taxonomy and A Study on Configuration Knowledge Injection16 Dec 2025
- 2025Multicalibration for LLM-based Code Generation9 Dec 2025
- 2025Beyond Synthetic Benchmarks: Evaluating LLM Performance on Real-World Class-Level Code Generation30 Oct 2025
- 2025Learning to Guarantee Type Correctness in Code Generation through Type-Guided Program Synthesis11 Oct 2025
- 2025Automating Android Build Repair: Bridging the Reasoning-Execution Gap in LLM Agents with Domain-Specific Tools9 Oct 2025
- 2025Investigating Security Implications of Automatically Generated Code on the Software Supply Chain24 Sep 2025
- 2025Benchmarking Web API Integration Code Generation24 Sep 2025
- 2025When the Code Autopilot Breaks: Why LLMs Falter in Embedded Machine Learning13 Sep 2025
- 2025IFEvalCode: Controlled Code Generation30 Jul 2025
- 2025ReCatcher: Towards LLMs Regression Testing for Code Generation25 Jul 2025
- 2025SVAgent: AI Agent for Hardware Security Verification Assertion22 Jul 2025
- 2025code_transformed: The Influence of Large Language Models on Code13 Jun 2025
- 2025CodeMirage: A Multi-Lingual Benchmark for Detecting AI-Generated and Paraphrased Source Code from Production-Level LLMs27 May 2025
- 2025Navigating Pitfalls: Evaluating LLMs in Machine Learning Programming Education23 May 2025
- 2025When Do LLMs Admit Their Mistakes? Understanding The Role Of Model Belief In Retraction22 May 2025
- 2025A Qualitative Investigation into LLM-Generated Multilingual Code Comments and Automatic Evaluation Metrics21 May 2025
- 2025Assessing LLM code generation quality through path planning tasks30 Apr 2025
- 2025Hallucination by Code Generation LLMs: Taxonomy, Benchmarks, Mitigation, and Challenges29 Apr 2025
- 2025On Developers' Self-Declaration of AI-Generated Code: An Analysis of Practices23 Apr 2025
- 2025Code Copycat Conundrum: Demystifying Repetition in LLM-based Code Generation17 Apr 2025
- 2025Type-Constrained Code Generation with Language Models12 Apr 2025
- 2025Assessing the Impact of Code Changes on the Fault Localizability of Large Language Models6 Apr 2025
- 2025CodeIF-Bench: Evaluating Instruction-Following Capabilities of Large Language Models in Interactive Code Generation5 Mar 2025
- 2025Deep-Bench: Deep Learning Benchmark Dataset for Code Generation26 Feb 2025
- 2025Correctness Assessment of Code Generated by Large Language Models Using Internal Representations22 Jan 2025
- 2024Towards Specification-Driven LLM-Based Generation of Embedded Automotive Software20 Nov 2024
- 2024Model Editing for LLMs4Code: How Far are We?11 Nov 2024
- 2024MdEval: Massively Multilingual Code Debugging4 Nov 2024
- 2024A Deep Dive Into Large Language Model Code Generation Mistakes: What and Why?3 Nov 2024
- 2024One Step at a Time: Combining LLMs and Static Analysis to Generate Next-Step Hints for Programming Tasks11 Oct 2024
50 newest of 59 All 59 (JSON)
- 2026How AI Coding Agents Modify Code: A Large-Scale Study of GitHub Pull Requestscited by 7
- 2026Real Faults in Model Context Protocol (MCP) Software: a Comprehensive Taxonomycited by 5
- 2025Automating Android Build Repair: Bridging the Reasoning-Execution Gap in LLM Agents with Domain-Specific Toolscited by 0
- 2026How Do AI Coding Agents Contribute to Software Development? an Empirical Study of Agentic Pull Requestscited by 0
- 2026Code That Works, Environments That Don't: Measuring Environment Reproducibility in AI-Generated Softwarecited by 0
- 2026Code That Works, Environments That Don't: Measuring Environment Reproducibility in AI-Generated Software30 Sep 2026
- 2026How Do AI Coding Agents Contribute to Software Development? an Empirical Study of Agentic Pull Requests23 Jul 2026
- 2026Real Faults in Model Context Protocol (MCP) Software: a Comprehensive Taxonomy5 Mar 2026
- 2026How AI Coding Agents Modify Code: A Large-Scale Study of GitHub Pull Requests24 Jan 2026
- 2025Automating Android Build Repair: Bridging the Reasoning-Execution Gap in LLM Agents with Domain-Specific Tools9 Oct 2025
- 2024Beyond Functional Correctness: Exploring Hallucinations in LLM-Generated Codecited by 106
- 2024When LLMs Meet Cybersecurity: A Systematic Literature Reviewcited by 70
- 2024What's Wrong with Your Code Generated by Large Language Models? An Extensive Studycited by 52
- 2025Type-Constrained Code Generation with Language Modelscited by 32
- 2025Correctness Assessment of Code Generated by Large Language Models Using Internal Representationscited by 17
- 2024MdEval: Massively Multilingual Code Debuggingcited by 16
- 2025CodeIF-Bench: Evaluating Instruction-Following Capabilities of Large Language Models in Interactive Code Generationcited by 14
- 2024Rethinking Software Engineering in the Foundation Model Era: From Task-Driven AI Copilots to Goal-Driven AI Pair Programmerscited by 11
- 2024RAMBO: Enhancing RAG-based Repository-Level Method Body Completioncited by 10
- 2024A Deep Dive Into Large Language Model Code Generation Mistakes: What and Why?cited by 9
- 2025Hallucination by Code Generation LLMs: Taxonomy, Benchmarks, Mitigation, and Challengescited by 9
- 2024Model Editing for LLMs4Code: How Far are We?cited by 8
12 most cited of 52 All 52 (JSON)
- 2026What is the Difference Between Me and You? Benchmarking the Quality Gap Between Human-Written and AI-Generated Code11 Sep 2026
- 2026Entropy-Regularized Rank-Masked Policy Optimization for Test-Time Reinforcement Learning in Code Generation8 Sep 2026
- 2026Evaluating Inference-Time Defenses Against Package Hallucination in LLM-Generated Code23 Aug 2026
- 2026Knowledge-Conditioned, Single-Pass LLM Synthesis of Executable Unity Game Scenes: A Compiler Error Census across 26 Goal Playable Concepts11 Jul 2026
- 2026Effectiveness of LLM-based Software Diversity for Reliability Improvement -- an Empirical Study3 Jul 2026
- 2026Prompt Coverage Adequacy2 Jul 2026
- 2026An Exploratory Study on LLM-Generated Code and Comments in Code Repositories2 Jul 2026
- 2026Simulating Students' Java Programming Errors with Large Language Models12 Jun 2026
- 2026HybridCodeAuthorship: A Benchmark Dataset for Line-Level Code Authorship Detection10 Jun 2026
- 2026Bridging Generation and Training: A Systematic Review of Quality Issues in LLMs for Code6 May 2026
- 2026An Empirical Evaluation of Locally Deployed LLMs for Bug Detection in Python Code25 Apr 2026
- 2026Co-Located Tests, Better AI Code: How Test Syntax Structure Affects Foundation Model Code Generation20 Apr 2026
12 newest of 52 All 52 (JSON)