Refining ChatGPT-Generated Code: Characterizing and Mitigating Code Quality Issues
Not on the map. Why?
Abstract (arXiv)
We systematically study the quality of 4,066 ChatGPT-generated code implemented in two popular programming languages, i.e., Java and Python, for 2,033 programming tasks. The goal of this work is three folds. First, we analyze the correctness of ChatGPT on code generation tasks and uncover the factors that influence its effectiveness, including task difficulty, programming language, time that tasks are introduced, and program size. Second, we identify and characterize potential issues with the quality of ChatGPT-generated code. Last, we provide insights into how these issues can be mitigated. Experiments highlight that out of 4,066 programs generated by ChatGPT, 2,756 programs are deemed correct, 1,082 programs provide wrong outputs, and 177 programs contain compilation or runtime errors. Additionally, we further analyze other characteristics of the generated code through static analysis tools, such as code style and maintainability, and find that 1,930 ChatGPT-generated code snippets suffer from maintainability issues. Subsequently, we investigate ChatGPT's self-repairing ability and its interaction with static analysis tools to fix the errors uncovered in the previous step. Experiments suggest that ChatGPT can partially address these challenges, improving code quality by more than 20%, but there are still limitations and opportunities for improvement. Overall, our study provides valuable insights into the current limitations of ChatGPT and offers a roadmap for future research and development efforts to enhance the code generation capabilities of AI models like ChatGPT.
Key facts. Cited by 78 papers in the map (data through 7 Oct 2026). First posted on arXiv 24 Jul 2023.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2023: 5; 2024: 20; 2025: 33; 2026: 20.
78 papers.
Sort:
By area:
- 2023Qwen Technical Reportcited by 3,273
- 2024A Survey on Large Language Models for Code Generationcited by 646
- 2023Large Language Models for Software Engineering: A Systematic Literature Reviewcited by 389
- 2024Beyond Functional Correctness: Exploring Hallucinations in LLM-Generated Codecited by 106
- 2024Bugs in Large Language Models Generated Code: An Empirical Studycited by 59
- 2024CodeUltraFeedback: An LLM-as-a-Judge Dataset for Aligning Large Language Models to Coding Preferencescited by 56
- 2024Human-In-the-Loop Software Development Agentscited by 42
- 2024Automatic Programming: Large Language Models and Beyondcited by 35
- 2025LessLeak-Bench: A First Investigation of Data Leakage in LLMs Across 83 Software Engineering Benchmarkscited by 34
- 2025Large Language Models for Code Generation: A Comprehensive Survey of Challenges, Techniques, Evaluation, and Applicationscited by 26
- 2024HumanEvalComm: Benchmarking the Communication Competence of Code Generation for LLMs and LLM Agentcited by 24
- 2023Trustworthy and Synergistic Artificial Intelligence for Software Engineering: Vision and Roadmapscited by 19
38 more
- 2024UniCoder: Scaling Code Large Language Model via Universal Codecited by 18
- 2024Evaluating Software Development Agents: Patch Patterns, Code Quality, and Issue Complexity in Real-World GitHub Scenarioscited by 16
- 2025Can LLMs Reason About Program Semantics? A Comprehensive Evaluation of LLMs on Formal Specification Inferencecited by 14
- 2025Beyond Final Code: A Process-Oriented Error Analysis of Software Development Agents in Real-World GitHub Scenarioscited by 14
- 2025Afterburner: Reinforcement Learning Facilitates Self-Improving Code Efficiency Optimizationcited by 14
- 2025SandboxEval: Towards Securing Test Environment for Untrusted Codecited by 10
- 2025Security Degradation in Iterative AI Code Generation -- A Systematic Analysis of the Paradoxcited by 10
- 2023Pitfalls in Language Models for Code Intelligence: A Taxonomy and Surveycited by 9
- 2025Hallucination by Code Generation LLMs: Taxonomy, Benchmarks, Mitigation, and Challengescited by 9
- 2025Investigating The Smells of LLM Generated Codecited by 9
- 2025Risk Assessment Framework for Code LLMs via Leveraging Internal Statescited by 8
- 2024A Controlled Experiment on the Energy Efficiency of the Source Code Generated by Code Llamacited by 7
- 2024Can We Trust AI Agents? A Case Study of an LLM-Based Multi-Agent System for Ethical AIcited by 6
- 2025Exploring Large Language Models for Semantic Analysis and Categorization of Android Malwarecited by 6
- 2025Multi-Agent Collaboration for Multilingual Code Instruction Tuningcited by 6
- 2024Towards Reliable Evaluation of Neural Program Repair with Natural Robustness Testingcited by 5
- 2024Evaluating AI-generated code for C++, Fortran, Go, Java, Julia, Matlab, Python, R, and Rustcited by 5
- 2024Programming with AI: Evaluating ChatGPT, Gemini, AlphaCode, and GitHub Copilot for Programmerscited by 5
- 2024AIGCodeSet: A New Annotated Dataset for AI Generated Code Detectioncited by 5
- 2025How Safe Are AI-Generated Patches? A Large-scale Study on Security Risks in LLM and Agentic Automated Program Repair on SWE-benchcited by 5
- 2025Turning the Tide: Repository-based Code Reflectioncited by 5
- 2023LUNA: A Model-Based Universal Analysis Framework for Large Language Modelscited by 4
- 2025Code Readability in the Age of Large Language Models: An Industrial Case Study from Atlassiancited by 4
- 2025A Benchmark for Localizing Code and Non-Code Issues in Software Projectscited by 4
- 2024Chain of Targeted Verification Questions to Improve the Reliability of Code Generated by LLMscited by 3
- 2025Is Your Prompt Poisoning Code? Defect Induction Rates and Security Mitigation Strategiescited by 3
- 2026Are We All Using Agents the Same Way? An Empirical Study of Core and Peripheral Developers Use of Coding Agentscited by 3
- 2025MultiAIGCD: A Comprehensive dataset for AI Generated Code Detection Covering Multiple Languages, Models,Prompts, and Scenarioscited by 2
- 2025Hallucination in LLM-Based Code Generation: An Automotive Case Studycited 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
- 2024Morescient GAI for Software Engineering (Extended Version)cited by 1
- 2024The Rise and Fall(?) of Software Engineeringcited by 1
- 2024Protect Your Secrets: Understanding and Measuring Data Exposure in VSCode Extensionscited by 1
- 2025Autonomous Legacy Web Application Upgrades Using a Multi-Agent Systemcited by 1
- 2025Enhancing the Non-Functional Quality Compliance of LLM-Generated Code through Quality-Aware Preference Learningcited by 1
- 2025On Developers' Self-Declaration of AI-Generated Code: An Analysis of Practicescited by 1
- 2025From Empirical Evaluation to Context-Aware Enhancement: Repairing Regression Errors with LLMscited by 1
50 most cited of 78 All 78 (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
- 2026Revisiting the Performance of Generative Artificial Intelligence on Introductory Object-Oriented Programming Assessments: Insights from 202617 Aug 2026
- 2026Developing LLM-based Multi-Agent Systems in Software Engineering: A Mixed-Method Experience Report12 Aug 2026
- 2026Characterizing the Quality Profile of AI-Generated C++ in Production6 Aug 2026
- 2026Large Language Models for Code Generation from Multilingual Prompts: A Curated Benchmark and a Study on Code Quality16 Jul 2026
- 2026Quantize with Confidence? An Empirical Study of Quantization for Code Generation15 Jul 2026
- 2026An Exploratory Study on LLM-Generated Code and Comments in Code Repositories2 Jul 2026
- 2026Accuracy and Satisfaction in Multi-Turn LLM Dialogues for NFR Assessment23 Jun 2026
- 2026An Exploratory Case Study of LLM-Assisted Refactoring and Gameplay Feature Generation in an Endless Runner Game19 Jun 2026
- 2026FASE: Fast Adaptive Semantic Entropy for Code Quality8 Jun 2026
- 2026The New Pro Se: Generative AI and the Surge in Federal Civil Self-Representation28 May 2026
38 more
- 2026Task Abstention for Large Language Models in Code Generation16 May 2026
- 2026BUILD-AND-FIND: An Effort-Aware Protocol for Evaluating Agent-Managed Codebases7 May 2026
- 2026Bridging Generation and Training: A Systematic Review of Quality Issues in LLMs for Code6 May 2026
- 2026An Empirical Analysis of Static Analysis Methods for Detection and Mitigation of Code Library Hallucinations9 Apr 2026
- 2026Autoregressive, Yet Revisable: In Decoding Revision for Secure Code Generation1 Feb 2026
- 2026Toward Non-Expert Customized Congestion Control: Large Language Model-Assisted CCA Code Generation with eBPF Deployment30 Jan 2026
- 2026Are We All Using Agents the Same Way? An Empirical Study of Core and Peripheral Developers Use of Coding Agents27 Jan 2026
- 2026Perish or Flourish? A Holistic Evaluation of Large Language Models for Code Generation in Functional Programming5 Jan 2026
- 2025M2G-Eval: Enhancing and Evaluating Multi-granularity Multilingual Code Generation27 Dec 2025
- 2025IaC Generation with LLMs: An Error Taxonomy and A Study on Configuration Knowledge Injection16 Dec 2025
- 2025Large Language Models for Education and Research: An Empirical and User Survey-based Analysis8 Dec 2025
- 2025Is Your Prompt Poisoning Code? Defect Induction Rates and Security Mitigation Strategies27 Oct 2025
- 2025Signature in Code Backdoor Detection, how far are we?15 Oct 2025
- 2025MulVuln: Enhancing Pre-trained LMs with Shared and Language-Specific Knowledge for Multilingual Vulnerability Detection5 Oct 2025
- 2025Investigating The Smells of LLM Generated Code3 Oct 2025
- 2025HFuzzer: Testing Large Language Models for Package Hallucinations via Phrase-based Fuzzing28 Sep 2025
- 2025A Benchmark for Localizing Code and Non-Code Issues in Software Projects26 Sep 2025
- 2025Investigating Security Implications of Automatically Generated Code on the Software Supply Chain24 Sep 2025
- 2025Hallucination in LLM-Based Code Generation: An Automotive Case Study15 Aug 2025
- 2025StackPilot: Autonomous Function Agents for Scalable and Environment-Free Code Execution6 Aug 2025
- 2025Experimental Analysis of Productive Interaction Strategy with ChatGPT: User Study on Function and Project-level Code Generation Tasks6 Aug 2025
- 2025MultiAIGCD: A Comprehensive dataset for AI Generated Code Detection Covering Multiple Languages, Models,Prompts, and Scenarios29 Jul 2025
- 2025Turning the Tide: Repository-based Code Reflection14 Jul 2025
- 2025How Safe Are AI-Generated Patches? A Large-scale Study on Security Risks in LLM and Agentic Automated Program Repair on SWE-bench30 Jun 2025
- 2025From Empirical Evaluation to Context-Aware Enhancement: Repairing Regression Errors with LLMs16 Jun 2025
- 2025Afterburner: Reinforcement Learning Facilitates Self-Improving Code Efficiency Optimization29 May 2025
- 2025Security Degradation in Iterative AI Code Generation -- A Systematic Analysis of the Paradox19 May 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
- 2025Risk Assessment Framework for Code LLMs via Leveraging Internal States20 Apr 2025
- 2025SandboxEval: Towards Securing Test Environment for Untrusted Code27 Mar 2025
- 2025Beyond Final Code: A Process-Oriented Error Analysis of Software Development Agents in Real-World GitHub Scenarios16 Mar 2025
- 2025Enhancing the Non-Functional Quality Compliance of LLM-Generated Code through Quality-Aware Preference Learning12 Mar 2025
- 2025Large Language Models for Code Generation: A Comprehensive Survey of Challenges, Techniques, Evaluation, and Applications3 Mar 2025
- 2025Can LLMs Reason About Program Semantics? A Comprehensive Evaluation of LLMs on Formal Specification Inference22 Feb 2025
- 2025Multi-Agent Collaboration for Multilingual Code Instruction Tuning11 Feb 2025
- 2025LessLeak-Bench: A First Investigation of Data Leakage in LLMs Across 83 Software Engineering Benchmarks10 Feb 2025
- 2025Autonomous Legacy Web Application Upgrades Using a Multi-Agent System31 Jan 2025
50 newest of 78 All 78 (JSON)
- 2024Human-In-the-Loop Software Development Agentscited by 42
- 2024HumanEvalComm: Benchmarking the Communication Competence of Code Generation for LLMs and LLM Agentcited by 24
- 2024Evaluating Software Development Agents: Patch Patterns, Code Quality, and Issue Complexity in Real-World GitHub Scenarioscited by 16
- 2025Beyond Final Code: A Process-Oriented Error Analysis of Software Development Agents in Real-World GitHub Scenarioscited by 14
- 2024Can We Trust AI Agents? A Case Study of an LLM-Based Multi-Agent System for Ethical AIcited by 6
- 2025Multi-Agent Collaboration for Multilingual Code Instruction Tuningcited by 6
- 2025How Safe Are AI-Generated Patches? A Large-scale Study on Security Risks in LLM and Agentic Automated Program Repair on SWE-benchcited by 5
- 2026Are We All Using Agents the Same Way? An Empirical Study of Core and Peripheral Developers Use of Coding Agentscited by 3
- 2025Autonomous Legacy Web Application Upgrades Using a Multi-Agent Systemcited by 1
- 2026Developing LLM-based Multi-Agent Systems in Software Engineering: A Mixed-Method Experience Reportcited by 1
- 2025StackPilot: Autonomous Function Agents for Scalable and Environment-Free Code Executioncited 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
- 2026Developing LLM-based Multi-Agent Systems in Software Engineering: A Mixed-Method Experience Report12 Aug 2026
- 2026Are We All Using Agents the Same Way? An Empirical Study of Core and Peripheral Developers Use of Coding Agents27 Jan 2026
- 2025StackPilot: Autonomous Function Agents for Scalable and Environment-Free Code Execution6 Aug 2025
- 2025How Safe Are AI-Generated Patches? A Large-scale Study on Security Risks in LLM and Agentic Automated Program Repair on SWE-bench30 Jun 2025
- 2025Beyond Final Code: A Process-Oriented Error Analysis of Software Development Agents in Real-World GitHub Scenarios16 Mar 2025
- 2025Multi-Agent Collaboration for Multilingual Code Instruction Tuning11 Feb 2025
- 2025Autonomous Legacy Web Application Upgrades Using a Multi-Agent System31 Jan 2025
- 2024Human-In-the-Loop Software Development Agents19 Nov 2024
- 2024Can We Trust AI Agents? A Case Study of an LLM-Based Multi-Agent System for Ethical AI25 Oct 2024
- 2024Evaluating Software Development Agents: Patch Patterns, Code Quality, and Issue Complexity in Real-World GitHub Scenarios16 Oct 2024
- 2024HumanEvalComm: Benchmarking the Communication Competence of Code Generation for LLMs and LLM Agent31 May 2024
- 2025Signature in Code Backdoor Detection, how far are we?cited by 0
- 2025Signature in Code Backdoor Detection, how far are we?15 Oct 2025
- 2023Qwen Technical Reportcited by 3,273
- 2024A Survey on Large Language Models for Code Generationcited by 646
- 2023Large Language Models for Software Engineering: A Systematic Literature Reviewcited by 389
- 2024Beyond Functional Correctness: Exploring Hallucinations in LLM-Generated Codecited by 106
- 2024Bugs in Large Language Models Generated Code: An Empirical Studycited by 59
- 2024Automatic Programming: Large Language Models and Beyondcited by 35
- 2025LessLeak-Bench: A First Investigation of Data Leakage in LLMs Across 83 Software Engineering Benchmarkscited by 34
- 2025Large Language Models for Code Generation: A Comprehensive Survey of Challenges, Techniques, Evaluation, and Applicationscited by 26
- 2023Trustworthy and Synergistic Artificial Intelligence for Software Engineering: Vision and Roadmapscited by 19
- 2024UniCoder: Scaling Code Large Language Model via Universal Codecited by 18
- 2025SandboxEval: Towards Securing Test Environment for Untrusted Codecited by 10
- 2025Security Degradation in Iterative AI Code Generation -- A Systematic Analysis of the Paradoxcited by 10
12 most cited of 60 All 60 (JSON)
- 2026What is the Difference Between Me and You? Benchmarking the Quality Gap Between Human-Written and AI-Generated Code11 Sep 2026
- 2026Revisiting the Performance of Generative Artificial Intelligence on Introductory Object-Oriented Programming Assessments: Insights from 202617 Aug 2026
- 2026Characterizing the Quality Profile of AI-Generated C++ in Production6 Aug 2026
- 2026Large Language Models for Code Generation from Multilingual Prompts: A Curated Benchmark and a Study on Code Quality16 Jul 2026
- 2026Quantize with Confidence? An Empirical Study of Quantization for Code Generation15 Jul 2026
- 2026An Exploratory Study on LLM-Generated Code and Comments in Code Repositories2 Jul 2026
- 2026Accuracy and Satisfaction in Multi-Turn LLM Dialogues for NFR Assessment23 Jun 2026
- 2026An Exploratory Case Study of LLM-Assisted Refactoring and Gameplay Feature Generation in an Endless Runner Game19 Jun 2026
- 2026FASE: Fast Adaptive Semantic Entropy for Code Quality8 Jun 2026
- 2026The New Pro Se: Generative AI and the Surge in Federal Civil Self-Representation28 May 2026
- 2026Task Abstention for Large Language Models in Code Generation16 May 2026
- 2026BUILD-AND-FIND: An Effort-Aware Protocol for Evaluating Agent-Managed Codebases7 May 2026
12 newest of 60 All 60 (JSON)