arrow
Return

Bugs in large language models generated code: an empirical study

delete2025-02-13
delete0
delete
OA
AI
F
Florian Tambon
A
Arghavan Moradidakhel *
A
Amin Nikanjam
F
Foutse Khomh
M
Michel C. Desmarais
G
Giuliano Antoniol
DOI:10.1007/s10664-025-10614-4delete
deleteOriginal
deleteOriginal request for help
deleteShare
deleteSave
Abstract

Abstract

En 中文
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 samples 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 online surveys with over 50 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.
Keywords:
Large language models
Bugs
Software testing
Empirical study

Journal

Empirical Software Engineering cover
Empirical Software Engineering
IF:
3.6
Papers:
2.0K
Citations:
5.3K

Organization

U
universite de montreal
Scholars:
4.6W
Papers: 3.8W
Citations: 46
Cited Papers

Cited Papers

Serum lipid abnormalities in heart transplant recipients: predominance of HDL2-like particles in the HDL pattern
err1990-03-01
err0
PREAI
errVéronique Atger; Michèle Cambillau; Romain Guillemain; Dominique Farge; Gilles Dreyfus; Sylvie Hamon; Anik Girard; Alain Carpentier; Nicole Moatti
errShare
errSave
Plasmonic porous ceramics based on zirconia-toughened alumina functionalized with silver nanoparticles for surface-enhanced Raman scattering
err2022-03-01
err0
errOAAI
errTongwei Guo; Md Nurul Karim; Kowsik Ghosh; M. Mangir Murshed; Kurosch Rezwan; Michael Maas
errShare
errSave
Refining ChatGPT-Generated Code: Characterizing and Mitigating Code Quality Issues
err2024-06-04
err8
errOAAI
errLiu, Yue; Le-Cong, Thanh; Widyasari, Ratnadira; Tantithamthavorn, Chakkrit; Li, Li; Le, Xuan-Bach D.; Lo, David
errShare
errSave
Silent bugs in deep learning frameworks: an empirical study of Keras and TensorFlow
err2023-11-29
err7
PREAI
errTambon, Florian; Nikanjam, Amin; An, Le; Khomh, Foutse; Antoniol, Giuliano
errShare
errSave
The inflammation-based modified Glasgow Prognostic Score in patients with vulvar cancer
err2010-03-01
err0
PREAI
errKatrin Hefler-Frischmuth; Veronika Seebacher; Stephan Polterauer; Clemens Tempfer; Alexander Reinthaller; Lukas Hefler
errShare
errSave
Nonsurgical management of benign prostatic hyperplasia in men with bladder calculi
err2002-08-01
err0
PREAI
errR.Corey O’Connor; Brett A Laven; Gregory T Bales; Glenn S Gerber
errShare
errSave
errShare
errSave
Electrochemical Impedance Spectroscopy and Determination of the Internal Resistance as a Way to Estimate Lead-Acid Batteries Condition
err2018-12-12
err0
errOAAI
errWłodzimierz Majchrzycki; Ewa Jankowska; Marek Baraniak; Piotr Handzlik; Robert Samborski
errShare
errSave
researcher View more