mlsanityData to 14 Oct 2026

A Deep Dive Into Large Language Model Code Generation Mistakes: What and Why?

arXiv 2411.01414 ↗First posted 3 Nov 2024cs.SE cs.AIcited by 10

Not on the map. Why?

Abstract (arXiv)

Recent advancements in Large Language Models (LLMs) have led to their widespread application in automated code generation. However, these models can still generate defective code that deviates from the specification. Previous research has mainly focused on the mistakes in LLM-generated standalone functions, overlooking real-world software development situations where the successful generation of the code requires software contexts such as external dependencies. In this paper, we considered both of these code generation situations and identified a range of textitnon-syntactic mistakes arising from LLMs' misunderstandings of coding question specifications. Seven categories of non-syntactic mistakes were identified through extensive manual analyses, four of which were missed by previous works. To better understand these mistakes, we proposed six reasons behind these mistakes from various perspectives. Moreover, we explored the effectiveness of LLMs in detecting mistakes and their reasons. Our evaluation demonstrated that GPT-4 with the ReAct prompting technique can achieve an F1 score of up to 0.65 when identifying reasons for LLM's mistakes, such as misleading function signatures. We believe that these findings offer valuable insights into enhancing the quality of LLM-generated code.

Key facts. Cited by 10 papers in the map (data through 14 Oct 2026). Builds on 47 of its 97 references that are in the map. First posted on arXiv 3 Nov 2024.

Builds on

47 of 97 references.

References · 47

  1. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
  2. 2020Language Models are Few-Shot Learnerscited by 32,419
  3. 2023GPT-4 Technical Reportcited by 18,396
  4. 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,459
  5. 2019Sentence-BERT: Sentence Embeddings using Siamese BERT-Networkscited by 9,170
  6. 2022ReAct: Synergizing Reasoning and Acting in Language Modelscited by 8,695
  7. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  8. 2022Self-Consistency Improves Chain of Thought Reasoning in Language Modelscited by 5,708
  9. 2022Large Language Models are Zero-Shot Reasonerscited by 4,374
  10. 2023Self-Refine: Iterative Refinement with Self-Feedbackcited by 3,442
  11. 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,373
  12. 2023A Survey on Evaluation of Large Language Modelscited by 1,242
35 more
  1. 2024Qwen2.5-Coder Technical Reportcited by 1,203
  2. 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,181
  3. 2023ChatGPT Outperforms Crowd-Workers for Text-Annotation Taskscited by 870
  4. 2023Language Agent Tree Search Unifies Reasoning Acting and Planning in Language Modelscited by 574
  5. 2024StarCoder 2 and The Stack v2: The Next Generationcited by 502
  6. 2023A Survey of Hallucination in Large Foundation Modelscited by 368
  7. 2022A Systematic Evaluation of Large Language Models of Codecited by 363
  8. 2024A Survey on Hallucination in Large Vision-Language Modelscited by 357
  9. 2023CodeGeeX: A Pre-Trained Model for Code Generation with Multilingual Benchmarking on HumanEval-Xcited by 300
  10. 2023Self-collaboration Code Generation via ChatGPTcited by 258
  11. 2022Multi-lingual Evaluation of Code Generation Modelscited by 159
  12. 2023Towards Making the Most of ChatGPT for Machine Translationcited by 138
  13. 2024Beyond Functional Correctness: Exploring Hallucinations in LLM-Generated Codecited by 107
  14. 2021Jigsaw: Large Language Models meet Program Synthesiscited by 103
  15. 2024LLM Hallucinations in Practical Code Generation: Phenomena, Mechanism, and Mitigationcited by 93
  16. 2023GPT-4 Doesn't Know It's Wrong: An Analysis of Iterative Prompting for Reasoning Problemscited by 89
  17. 2023Large Language Models are Few-Shot Summarizers: Multi-Intent Comment Generation via In-Context Learningcited by 72
  18. 2024Premise Order Matters in Reasoning with Large Language Modelscited by 72
  19. 2022Automated Repair of Programs from Large Language Modelscited by 71
  20. 2024Bugs in Large Language Models Generated Code: An Empirical Studycited by 60
  21. 2024CoIR: A Comprehensive Benchmark for Code Information Retrieval Modelscited by 60
  22. 2022Problems with Cosine as a Measure of Embedding Similarity for High Frequency Wordscited by 49
  23. 2023What Makes Good In-context Demonstrations for Code Intelligence Tasks with LLMs?cited by 47
  24. 2023Large Language Models and Simple, Stupid Bugscited by 45
  25. 2024Using AI-Based Coding Assistants in Practice: State of Affairs, Perceptions, and Ways Forwardcited by 45
  26. 2023Exploring the Potential of ChatGPT in Automated Code Refinement: An Empirical Studycited by 44
  27. 2023Prompting Is All You Need: Automated Android Bug Replay with Large Language Modelscited by 40
  28. 2023ClarifyGPT: Empowering LLM-based Code Generation with Intention Clarificationcited by 38
  29. 2024Insights into LLM Long-Context Failures: When Transformers Know but Don't Tellcited by 36
  30. 2024LLMs in Web Development: Evaluating LLM-Generated PHP Code Unveiling Vulnerabilities and Limitationscited by 22
  31. 2023Critique Ability of Large Language Modelscited by 20
  32. 2023Exploring Code Analysis: Zero-Shot Insights on Syntax and Semantics with LLMscited by 19
  33. 2023Do Large Language Models Pay Similar Attention Like Human Programmers When Generating Code?cited by 14
  34. 2022How Important are Good Method Names in Neural Code Generation? A Model Robustness Perspectivecited by 11
  35. 2014Identifying Duplicate and Contradictory Information in Wikipediacited by 2

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 6; 2026: 4.

10 papers.