What's Wrong with Your Code Generated by Large Language Models? An Extensive Study
Not on the map. Why?
Abstract (arXiv)
The increasing development of LLMs in code generation has drawn significant attention among researchers. To enhance LLM-based code generation ability, current efforts are predominantly directed towards collecting high-quality datasets and leveraging diverse training technologies. However, there is a notable lack of comprehensive studies examining the limitations and boundaries of existing methods. To bridge this gap, we conducted an extensive empirical study evaluating the performance of three leading closed-source LLMs and six popular open-source LLMs on three commonly used benchmarks. Our investigation, which evaluated the length, cyclomatic complexity and API number of the generated code, revealed that these LLMs face challenges in generating successful code for more complex problems, and tend to produce code that is shorter yet more complicated as compared to canonical solutions. Additionally, we developed a taxonomy of bugs for incorrect codes that includes three categories and ten sub-categories, and analyzed the root cause for common bug types. To better understand the performance of LLMs in real-world projects, we also manually created a real-world benchmark RWPB. We analyzed bugs on RWPB to highlight distinct differences in bug distributions between actual scenarios and existing benchmarks. Finally, we propose a novel training-free iterative method that introduces self-critique, enabling LLMs to critique and correct their generated code based on bug types and compiler feedback. Our comprehensive and extensive study provides insights into the current limitations of LLM-based code generation and opportunities for enhancing the accuracy and quality of the generated code.
Key facts. Cited by 52 papers in the map (data through 7 Oct 2026). Builds on 83 of its 113 references that are in the map. First posted on arXiv 8 Jul 2024.
Builds on
83 of 113 references.
References · 83
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2023GPT-4 Technical Reportcited by 18,132
- 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
- 2022Self-Consistency Improves Chain of Thought Reasoning in Language Modelscited by 5,601
- 2021Program Synthesis with Large Language Modelscited by 3,509
- 2023Qwen Technical Reportcited by 3,273
- 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,193
- 2023Mistral 7Bcited by 3,065
- 2022Self-Instruct: Aligning Language Models with Self-Generated Instructionscited by 2,674
- 2020The Pile: An 800GB Dataset of Diverse Text for Language Modelingcited by 2,346
38 more
- 2023Code Llama: Open Foundation Models for Codecited by 2,105
- 2024LiveCodeBench: Holistic and Contamination Free Evaluation of Large Language Models for Codecited by 1,906
- 2024Phi-3 Technical Report: A Highly Capable Language Model Locally on Your Phonecited by 1,883
- 2022Least-to-Most Prompting Enables Complex Reasoning in Large Language Modelscited by 1,397
- 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,332
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
- 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,154
- 2023Teaching Large Language Models to Self-Debugcited by 963
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
- 2021Measuring Coding Challenge Competence With APPScited by 879
- 2023StarCoder: may the source be with you!cited by 790
- 2023The RefinedWeb Dataset for Falcon LLM: Outperforming Curated Corpora with Web Data, and Web Data Onlycited by 755
- 2023CRITIC: Large Language Models Can Self-Correct with Tool-Interactive Critiquingcited by 751
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
- 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 728
- 2024DeepSeek LLM: Scaling Open-Source Language Models with Longtermismcited by 621
- 2024BigCodeBench: Benchmarking Code Generation with Diverse Function Calls and Complex Instructionscited by 527
- 2024StarCoder 2 and The Stack v2: The Next Generationcited by 484
- 2023Detecting Pretraining Data from Large Language Modelscited by 375
- 2022Self-critiquing models for assisting human evaluatorscited by 372
- 2021Unified Pre-training for Program Understanding and Generationcited by 361
- 2022Text and Code Embeddings by Contrastive Pre-Trainingcited by 358
- 2022The Stack: 3 TB of permissively licensed source codecited by 354
- 2023RepoBench: Benchmarking Repository-Level Code Auto-Completion Systemscited by 346
- 2022CodeRL: Mastering Code Generation through Pretrained Models and Deep Reinforcement Learningcited by 342
- 2023CodeGeeX: A Pre-Trained Model for Code Generation with Multilingual Benchmarking on HumanEval-Xcited by 294
- 2024Large Language Models for Mathematical Reasoning: Progresses and Challengescited by 283
- 2023Magicoder: Empowering Code Generation with OSS-Instructcited by 251
- 2024OpenCodeInterpreter: Integrating Code Generation with Execution and Refinementcited by 242
- 2023MathPrompter: Mathematical Reasoning using Large Language Modelscited by 236
- 2023Proving Test Set Contamination in Black Box Language Modelscited by 227
- 2023Secrets of RLHF in Large Language Models Part I: PPOcited by 226
- 2020IntelliCode Compose: Code Generation Using Transformercited by 225
- 2023Don't Make Your LLM an Evaluation Benchmark Cheatercited by 194
- 2023OctoPack: Instruction Tuning Code Large Language Modelscited by 178
- 2023Time Travel in LLMs: Tracing Data Contamination in Large Language Modelscited by 175
- 2023SantaCoder: don't reach for the stars!cited by 169
- 2018Learning to Mine Aligned Code and Natural Language Pairs from Stack Overflowcited by 165
50 most cited of 83 All 83 (JSON)
Built on by
Citing papers per year: 2024: 9; 2025: 32; 2026: 11.
52 papers.
Sort:
By area:
- 2024Enhancing Code LLMs with Reinforcement Learning in Code Generation: A Surveycited by 82
- 2024From Code to Correctness: Closing the Last Mile of Code Generation with Hierarchical Debuggingcited by 46
- 2025Type-Constrained Code Generation with Language Modelscited by 32
- 2025Large Language Models for Code Generation: A Comprehensive Survey of Challenges, Techniques, Evaluation, and Applicationscited by 26
- 2026SlopCodeBench: Benchmarking How Coding Agents Degrade Over Long-Horizon Iterative Taskscited by 24
- 2024RepoTransBench: A Real-World Multilingual Benchmark for Repository-Level Code Translationcited by 21
- 2025Improving RL Exploration for LLM Reasoning through Retrospective Replaycited by 19
- 2025A Comprehensive Survey on Benchmarks and Solutions in Software Engineering of LLM-Empowered Agentic Systemcited by 15
- 2025Migrating Code At Scale With LLMs At Googlecited by 14
- 2024Multi-Programming Language Sandbox for LLMscited 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
- 2025Towards Formal Verification of LLM-Generated Code from Natural Language Promptscited by 8
- 2025When Prompts Go Wrong: Evaluating Code Model Robustness to Ambiguous, Contradictory, and Incomplete Task Descriptionscited by 8
- 2025Large Language Model Guided Self-Debugging Code Generationcited by 7
- 2025Fine-Tune an SLM or Prompt an LLM? The Case of Generating Low-Code Workflowscited by 6
- 2026ErrorMap and ErrorAtlas: Charting the Failure Landscape of Large Language Modelscited by 6
- 2024Showing LLM-Generated Code Selectively Based on Confidence of LLMscited by 4
- 2025Knowledge Graph Based Repository-Level Code Generationcited by 4
- 2025NL-Debugging: Exploiting Natural Language as an Intermediate Representation for Code Debuggingcited by 4
- 2025Chain-of-Code Collapse: Reasoning Failures in LLMs via Adversarial Prompting in Code Generationcited by 4
- 2025Failure by Interference: Language Models Make Balanced Parentheses Errors When Faulty Mechanisms Overshadow Sound Onescited by 4
- 2024Examination of Code generated by Large Language Modelscited by 3
- 2024Renaissance of Literate Programming in the Era of LLMs: Enhancing LLM-Based Code Generation in Large-Scale Projectscited by 3
- 2024A Comprehensive Framework for Evaluating API-oriented Code Generation in Large Language Modelscited by 2
- 2025From Code to Compliance: Assessing ChatGPT's Utility in Designing an Accessible Webpage -- A Case Studycited by 2
- 2025Mechanistic Understanding of Language Models in Syntactic Code Completioncited by 2
- 2025Unlocking the Potential of Past Research: Using Generative AI to Reconstruct Healthcare Simulation Modelscited by 2
- 2025GENIE-ASI: Generative Instruction and Executable Code for Analog Subcircuit Identificationcited by 2
- 2026The Perplexity Paradox: Why Code Compresses Better Than Math in LLM Promptscited by 2
- 2025Autonomous Legacy Web Application Upgrades Using a Multi-Agent Systemcited by 1
- 2025Evaluating Intermediate Reasoning of Code-Assisted Large Language Models for Mathematicscited by 1
- 2025Program Semantic Inequivalence Game with Large Language Modelscited by 1
- 2025PRIMG : Efficient LLM-driven Test Generation Using Mutant Prioritizationcited by 1
- 2025MemoCoder: Automated Function Synthesis using LLM-Supported Agentscited by 1
- 2026Benchmarking Text-to-Python against Text-to-SQL: The Impact of Explicit Logic and Ambiguitycited by 1
- 2026Agents in the Large: Perception-Centered Architecture for Persistent Agentscited by 1
- 2025Think Like Human Developers: Harnessing Community Knowledge for Structured Code Reasoningcited by 0
- 2025code_transformed: The Influence of Large Language Models on Codecited by 0
- 2025ReCatcher: Towards LLMs Regression Testing for Code Generationcited by 0
- 2025LLM Agents for Generating Microservice-based Applications: how complex is your specification?cited by 0
- 2025Benchmarking Web API Integration Code Generationcited by 0
- 2025Learning to Guarantee Type Correctness in Code Generation through Type-Guided Program Synthesiscited by 0
- 2025Cracking CodeWhisperer: Analyzing Developers' Interactions and Patterns During Programming Taskscited by 0
- 2025Does In-IDE Calibration of Large Language Models work at Scale?cited by 0
- 2025From Proof to Program: Characterizing Tool-Induced Reasoning Hallucinations in Large Language Modelscited by 0
- 2026Co-Located Tests, Better AI Code: How Test Syntax Structure Affects Foundation Model Code Generationcited by 0
- 2026Budget-Efficient Automatic Algorithm Design via Code Graphcited by 0
- 2026Mitigating Errors in LLM-Generated Web API Invocations via Retrieval-Augmented Generation and Constrained Decodingcited by 0
- 2026Knowledge-Conditioned, Single-Pass LLM Synthesis of Executable Unity Game Scenes: A Compiler Error Census across 26 Goal Playable Conceptscited by 0
50 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
- 2026Agents in the Large: Perception-Centered Architecture for Persistent Agents31 Aug 2026
- 2026TRIM: Reducing AI-Generated CodeSlop via Agent Trajectory Minimization20 Jul 2026
- 2026Knowledge-Conditioned, Single-Pass LLM Synthesis of Executable Unity Game Scenes: A Compiler Error Census across 26 Goal Playable Concepts11 Jul 2026
- 2026Mitigating Errors in LLM-Generated Web API Invocations via Retrieval-Augmented Generation and Constrained Decoding7 Jul 2026
- 2026Budget-Efficient Automatic Algorithm Design via Code Graph11 May 2026
- 2026Co-Located Tests, Better AI Code: How Test Syntax Structure Affects Foundation Model Code Generation20 Apr 2026
- 2026SlopCodeBench: Benchmarking How Coding Agents Degrade Over Long-Horizon Iterative Tasks25 Mar 2026
- 2026ErrorMap and ErrorAtlas: Charting the Failure Landscape of Large Language Models22 Jan 2026
- 2026Benchmarking Text-to-Python against Text-to-SQL: The Impact of Explicit Logic and Ambiguity22 Jan 2026
- 2026The Perplexity Paradox: Why Code Compresses Better Than Math in LLM Prompts21 Jan 2026
- 2025From Proof to Program: Characterizing Tool-Induced Reasoning Hallucinations in Large Language Models14 Nov 2025
38 more
- 2025Does In-IDE Calibration of Large Language Models work at Scale?26 Oct 2025
- 2025Cracking CodeWhisperer: Analyzing Developers' Interactions and Patterns During Programming Tasks13 Oct 2025
- 2025Learning to Guarantee Type Correctness in Code Generation through Type-Guided Program Synthesis11 Oct 2025
- 2025A Comprehensive Survey on Benchmarks and Solutions in Software Engineering of LLM-Empowered Agentic System10 Oct 2025
- 2025Benchmarking Web API Integration Code Generation24 Sep 2025
- 2025GENIE-ASI: Generative Instruction and Executable Code for Analog Subcircuit Identification26 Aug 2025
- 2025LLM Agents for Generating Microservice-based Applications: how complex is your specification?22 Aug 2025
- 2025When Prompts Go Wrong: Evaluating Code Model Robustness to Ambiguous, Contradictory, and Incomplete Task Descriptions27 Jul 2025
- 2025ReCatcher: Towards LLMs Regression Testing for Code Generation25 Jul 2025
- 2025MemoCoder: Automated Function Synthesis using LLM-Supported Agents24 Jul 2025
- 2025Towards Formal Verification of LLM-Generated Code from Natural Language Prompts17 Jul 2025
- 2025Failure by Interference: Language Models Make Balanced Parentheses Errors When Faulty Mechanisms Overshadow Sound Ones30 Jun 2025
- 2025code_transformed: The Influence of Large Language Models on Code13 Jun 2025
- 2025Chain-of-Code Collapse: Reasoning Failures in LLMs via Adversarial Prompting in Code Generation8 Jun 2025
- 2025Fine-Tune an SLM or Prompt an LLM? The Case of Generating Low-Code Workflows30 May 2025
- 2025NL-Debugging: Exploiting Natural Language as an Intermediate Representation for Code Debugging21 May 2025
- 2025Knowledge Graph Based Repository-Level Code Generation20 May 2025
- 2025PRIMG : Efficient LLM-driven Test Generation Using Mutant Prioritization8 May 2025
- 2025Program Semantic Inequivalence Game with Large Language Models2 May 2025
- 2025Hallucination by Code Generation LLMs: Taxonomy, Benchmarks, Mitigation, and Challenges29 Apr 2025
- 2025Evaluating Intermediate Reasoning of Code-Assisted Large Language Models for Mathematics24 Apr 2025
- 2025Improving RL Exploration for LLM Reasoning through Retrospective Replay19 Apr 2025
- 2025Migrating Code At Scale With LLMs At Google13 Apr 2025
- 2025Type-Constrained Code Generation with Language Models12 Apr 2025
- 2025Unlocking the Potential of Past Research: Using Generative AI to Reconstruct Healthcare Simulation Models27 Mar 2025
- 2025Think Like Human Developers: Harnessing Community Knowledge for Structured Code Reasoning19 Mar 2025
- 2025Large Language Models for Code Generation: A Comprehensive Survey of Challenges, Techniques, Evaluation, and Applications3 Mar 2025
- 2025Mechanistic Understanding of Language Models in Syntactic Code Completion20 Feb 2025
- 2025Large Language Model Guided Self-Debugging Code Generation5 Feb 2025
- 2025Autonomous Legacy Web Application Upgrades Using a Multi-Agent System31 Jan 2025
- 2025From Code to Compliance: Assessing ChatGPT's Utility in Designing an Accessible Webpage -- A Case Study7 Jan 2025
- 2024Enhancing Code LLMs with Reinforcement Learning in Code Generation: A Survey29 Dec 2024
- 2024Renaissance of Literate Programming in the Era of LLMs: Enhancing LLM-Based Code Generation in Large-Scale Projects25 Dec 2024
- 2024RepoTransBench: A Real-World Multilingual Benchmark for Repository-Level Code Translation23 Dec 2024
- 2024Model Editing for LLMs4Code: How Far are We?11 Nov 2024
- 2024Multi-Programming Language Sandbox for LLMs30 Oct 2024
- 2024Showing LLM-Generated Code Selectively Based on Confidence of LLMs4 Oct 2024
- 2024From Code to Correctness: Closing the Last Mile of Code Generation with Hierarchical Debugging2 Oct 2024
50 newest of 52 All 52 (JSON)
- 2026SlopCodeBench: Benchmarking How Coding Agents Degrade Over Long-Horizon Iterative Taskscited by 24
- 2025A Comprehensive Survey on Benchmarks and Solutions in Software Engineering of LLM-Empowered Agentic Systemcited by 15
- 2025Autonomous Legacy Web Application Upgrades Using a Multi-Agent Systemcited by 1
- 2025MemoCoder: Automated Function Synthesis using LLM-Supported Agentscited by 1
- 2026Agents in the Large: Perception-Centered Architecture for Persistent Agentscited by 1
- 2025LLM Agents for Generating Microservice-based Applications: how complex is your specification?cited by 0
- 2026TRIM: Reducing AI-Generated CodeSlop via Agent Trajectory Minimizationcited by 0
- 2026Agents in the Large: Perception-Centered Architecture for Persistent Agents31 Aug 2026
- 2026TRIM: Reducing AI-Generated CodeSlop via Agent Trajectory Minimization20 Jul 2026
- 2026SlopCodeBench: Benchmarking How Coding Agents Degrade Over Long-Horizon Iterative Tasks25 Mar 2026
- 2025A Comprehensive Survey on Benchmarks and Solutions in Software Engineering of LLM-Empowered Agentic System10 Oct 2025
- 2025LLM Agents for Generating Microservice-based Applications: how complex is your specification?22 Aug 2025
- 2025MemoCoder: Automated Function Synthesis using LLM-Supported Agents24 Jul 2025
- 2025Autonomous Legacy Web Application Upgrades Using a Multi-Agent System31 Jan 2025
- 2025Improving RL Exploration for LLM Reasoning through Retrospective Replaycited by 19
- 2025Chain-of-Code Collapse: Reasoning Failures in LLMs via Adversarial Prompting in Code Generationcited by 4
- 2026The Perplexity Paradox: Why Code Compresses Better Than Math in LLM Promptscited by 2
- 2025Evaluating Intermediate Reasoning of Code-Assisted Large Language Models for Mathematicscited by 1
- 2025Think Like Human Developers: Harnessing Community Knowledge for Structured Code Reasoningcited by 0
- 2025From Proof to Program: Characterizing Tool-Induced Reasoning Hallucinations in Large Language Modelscited by 0
- 2026The Perplexity Paradox: Why Code Compresses Better Than Math in LLM Prompts21 Jan 2026
- 2025From Proof to Program: Characterizing Tool-Induced Reasoning Hallucinations in Large Language Models14 Nov 2025
- 2025Chain-of-Code Collapse: Reasoning Failures in LLMs via Adversarial Prompting in Code Generation8 Jun 2025
- 2025Evaluating Intermediate Reasoning of Code-Assisted Large Language Models for Mathematics24 Apr 2025
- 2025Improving RL Exploration for LLM Reasoning through Retrospective Replay19 Apr 2025
- 2025Think Like Human Developers: Harnessing Community Knowledge for Structured Code Reasoning19 Mar 2025
- 2024Enhancing Code LLMs with Reinforcement Learning in Code Generation: A Surveycited by 82
- 2024From Code to Correctness: Closing the Last Mile of Code Generation with Hierarchical Debuggingcited by 46
- 2025Type-Constrained Code Generation with Language Modelscited by 32
- 2025Large Language Models for Code Generation: A Comprehensive Survey of Challenges, Techniques, Evaluation, and Applicationscited by 26
- 2024RepoTransBench: A Real-World Multilingual Benchmark for Repository-Level Code Translationcited by 21
- 2025Migrating Code At Scale With LLMs At Googlecited by 14
- 2024Multi-Programming Language Sandbox for LLMscited 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
- 2025Towards Formal Verification of LLM-Generated Code from Natural Language Promptscited by 8
- 2025When Prompts Go Wrong: Evaluating Code Model Robustness to Ambiguous, Contradictory, and Incomplete Task Descriptionscited by 8
- 2025Large Language Model Guided Self-Debugging Code Generationcited by 7
12 most cited of 38 All 38 (JSON)
- 2026What is the Difference Between Me and You? Benchmarking the Quality Gap Between Human-Written and AI-Generated Code11 Sep 2026
- 2026Knowledge-Conditioned, Single-Pass LLM Synthesis of Executable Unity Game Scenes: A Compiler Error Census across 26 Goal Playable Concepts11 Jul 2026
- 2026Budget-Efficient Automatic Algorithm Design via Code Graph11 May 2026
- 2026Co-Located Tests, Better AI Code: How Test Syntax Structure Affects Foundation Model Code Generation20 Apr 2026
- 2026ErrorMap and ErrorAtlas: Charting the Failure Landscape of Large Language Models22 Jan 2026
- 2026Benchmarking Text-to-Python against Text-to-SQL: The Impact of Explicit Logic and Ambiguity22 Jan 2026
- 2025Does In-IDE Calibration of Large Language Models work at Scale?26 Oct 2025
- 2025Cracking CodeWhisperer: Analyzing Developers' Interactions and Patterns During Programming Tasks13 Oct 2025
- 2025Learning to Guarantee Type Correctness in Code Generation through Type-Guided Program Synthesis11 Oct 2025
- 2025Benchmarking Web API Integration Code Generation24 Sep 2025
- 2025GENIE-ASI: Generative Instruction and Executable Code for Analog Subcircuit Identification26 Aug 2025
- 2025When Prompts Go Wrong: Evaluating Code Model Robustness to Ambiguous, Contradictory, and Incomplete Task Descriptions27 Jul 2025
12 newest of 38 All 38 (JSON)