CoChat

Security and Quality in LLM-Generated Code: A Multi-Language, Multi-Model Analysis

Open access
Kharma, Mohammed F., Choi, Soohyeon, Alkhanafseh, Mohammad, Mohaisen, David · 2026 · IEEE Transactions on Dependable and Secure Computing

The DOI matches its Crossref record; 6 of the 6 references it cites were found in a registry or an index.

Abstract

Artificial Intelligence (AI) driven code generation tools are increasingly used throughout the software development lifecycle to accelerate coding tasks. However, the security of AI-generated code using large language models (LLMs) remains underexplored, and recent studies have revealed various risks and weaknesses. This paper presents a measurement study of LLM-generated code across four programming languages (Python, Java, C++, and C) and five widely used LLM families. We construct a manually curated dataset of 200 programming tasks, grouped into seven functional and security-relevant categories, each with language-neutral specifications. For every combination of task, language, and model, we generate code and evaluate it along three axes: syntactic validity and compilation success, semantic correctness using 4,000 per program unit test files, and software quality and security using SonarQube and CodeQL, complemented by manual review of key static analysis findings. Our results show clear language effects: Python and Java achieve higher compilation and semantic correctness rates and produce fewer security findings than C and C++, where we observe more memory safety issues, hard-coded secrets, and cryptographic misuses. We also find that many models fail to make use of modern security features available in recent compiler and toolkit updates (i.e., in Java 17), and that outdated methods remain common, particularly in C++. These findings highlight the need to advance LLMs so that they better align with emerging secure coding practices and language-specific best practices. All code and data are available at GitHub.

Overview

The claims and statistics of this paper haven’t been checked yet.

Free: it reads the open-access text and checks the first 5 claims that cite a source we can check. Create a free account to check every claim.

A few free checks a day · papers already verified open instantly · results are public

Integrity signals

Registry

Crossref · 10.1109/tdsc.2026.3672745

Cites

0 citation errors · 0 not checkable

Statistics

Verification

Claims the paper makes

The claims and statistics of this paper haven’t been checked yet.

Free: it reads the open-access text and checks the first 5 claims that cite a source we can check. Create a free account to check every claim.

A few free checks a day · papers already verified open instantly · results are public

Self-check

Percentages, sums and reported differences re-computed from the paper’s own numbers.

The self-check needs the paper’s full text.

Citations

Cites

The publisher hasn’t deposited this paper’s reference list.

Research works printed but not linked: 23

  1. A user-centered security evaluation of copilot. O Asare, M Nagappan, N Asokan, Proceedings of the International Conference on Software Engineering (ICSE). the International Conference on Software Engineering (ICSE)2024
  2. Ocassionally secure: A comparative analysis of code generation assistants. R Elgedawy, J Sadik, S Dutta, A Gautam, K Georgiou, F Gholamrezae, F Ji, K Lim, Q Liu, S Ruoti, 10.48550/arXiv.2402.00689abs/2402.00689CoRR. 2024 · arXiv · doi:10.48550/arxiv.2402.00689abs/2402.00689corr
  3. Explainable deep learning: A field guide for the uninitiated. G Ras, N Xie, M Van Gerven, D Doran, 10.1613/jair.1.13200J. Artif. Intell. Res. 732022 · doi:10.1613/jair.1.13200j
  4. Lost at c: A user study on the security implications of large language model code assistants. G Sandoval, H Pearce, T Nys, R Karri, S Garg, B Dolan-Gavitt, Proceedings of the 32nd USENIX Security Symposium. the 32nd USENIX Security Symposium2023
  5. A C/C++ code vulnerability dataset with code changes and CVE summaries. J Fan, Y Li, S Wang, T N Nguyen, 10.1145/3379597.3387501MSR. ACM2020 · doi:10.1145/3379597.3387501msr
  6. You autocomplete me: Poisoning vulnerabilities in neural code completion. R Schuster, C Song, E Tromer, V Shmatikov, 30th USENIX Security Symposium. 2021
  7. Llms cannot reliably identify and reason about security vulnerabilities (yet?): A comprehensive evaluation, framework, and benchmarks. S Ullah, M Han, S Pujar, H Pearce, A Coskun, G Stringhini, IEEE Symposium on Security and Privacy. 2024
  8. Securityeval dataset: Mining vulnerability examples to evaluate machine learning-based code generation techniques. M L Siddiq, J C S Santos, ACM MSR4P&S2022
  9. Llmseceval: A dataset of natural language prompts for security evaluations. C Tony, M Mutas, N E D Ferreyra, R Scandariato, 10.1109/MSR59073.2023.0008420th IEEE/ACM International Conference on Mining Software Repositories, MSR 2023. Melbourne, AustraliaMay 15-16, 2023. IEEE, 2023 · doi:10.1109/msr59073.2023.0008420th
  10. A critical comparison on six static analysis tools: Detection, agreement, and precision. V Lenarduzzi, F Pecorelli, N Saarimaki, S Lujan, F Palomba, 10.1016/j.jss.2022.111575Journal of Systems and Software. 1981115752023 · doi:10.1016/j.jss.2022.111575journal
  11. Generative software engineering. Y Huang, Y Chen, X Chen, J Chen, R Peng, Z Tang, J Huang, F Xu, Z Zheng, 10.48550/arXiv.2403.02583abs/2403.02583CoRR. 2024 · arXiv · doi:10.48550/arxiv.2403.02583abs/2403.02583corr
  12. Asleep at the keyboard? assessing the security of github copilot's code contributions. H Pearce, B Ahmad, B Tan, B Dolan-Gavitt, R Karri, IEEE Symp. on Security & Privacy. 2022
  13. A critique of software defect prediction models. N E Fenton, M Neil, 10.1109/32.815326IEEE Trans. Software Eng. 2551999 · doi:10.1109/32.815326ieee
  14. An empirical validation of cognitive complexity as a measure of source code understandability. M M Bar Ón, M Wyrich, S Wagner, 10.1145/3382494.3410636ESEM. ACM20205 · doi:10.1145/3382494.3410636esem
  15. Performance review on LLM for solving leetcode problems. L Wang, C Shi, S Du, Y Tao, Y Shen, H Zheng, Y Shen, X Qiu, 10.48550/arXiv.2502.15770CoRR. 2502.15770, 2025 · arXiv · doi:10.48550/arxiv.2502.15770corr
  16. A case study on the transformative potential of AI in software engineering on leetcode and chatgpt. M Merkel, J Örpinghaus, 10.48550/arXiv.2501.03639abs/2501.03639CoRR. 2025 · arXiv · doi:10.48550/arxiv.2501.03639abs/2501.03639corr
  17. Leetcodedataset: A temporal dataset for robust evaluation and efficient training of code llms. Y Xia, W Shen, Y Wang, J K Liu, H Sun, S Wu, J Hu, X Xu, 10.48550/arXiv.2504.14655CoRR. 2504.14655, 2025 · arXiv · doi:10.48550/arxiv.2504.14655corr
  18. On the performance of large language models on introductory programming assignments. N Raihan, D Goswami, S S C Puspo, M L Siddiq, C Newman, T Ranasinghe, J C S Santos, M Zampieri, 10.1007/s10844-025-00968-yJournal of Intelligent Information Systems. 2025 · doi:10.1007/s10844-025-00968-yjournal
  19. Language models are few-shot learners. T B Brown, B Mann, N Ryder, M Subbiah, J Kaplan, P Dhariwal, A Neelakantan, P Shyam, G Sastry, A Askell, NeurIPS. 159252020
  20. M Chen, J Tworek, H Jun, Q Yuan, H De Oliveira, J Pinto, H Kaplan, Y Edwards, N Burda, G Joseph, Brockman, arXiv:2107.03374Evaluating large language models trained on code. 2021arXiv preprint
  21. Codet5: Identifier-aware unified pre-trained encoder-decoder models for code understanding and generation. Y Wang, W Wang, S Joty, S.-K Ng, EMNLP. 2021
  22. From large to mammoth: A comparative evaluation of large language models in vulnerability detection. J Lin, D Mohaisen, 32nd Annual Network and Distributed System Security Symposium, NDSS 2025. The Internet Society. San Diego, California, USAFebruary 24-28, 2025. 2025
  23. Attention is all you need. A Vaswani, N Shazeer, N Parmar, J Uszkoreit, L Jones, A N Gomez, Ł Kaiser, I Polosukhin, Advances in Neural Information Processing Systems. 2017

Cited by

See all 20

Metadata

Authors
Kharma, M. F., Choi, S., Alkhanafseh, M., & Mohaisen, D.
Affiliations
  • Birzeit University (PS)
  • University of Central Florida (US)
Venue
IEEE Transactions on Dependable and Secure Computing
Published
2026-05
Volume
23
Issue
3
Pages
7300-7314
ISSN
  • 1545-5971 (ISSN-L)
  • 1941-0018
  • 2160-9209
OpenAlex
W7134943833
Cited by
9
References
0
Citations by year
2026: 7
FWCI
59.54
Type
journal article
Language
en
Open access
Locations
  • IEEE Transactions on Dependable and Secure Computing (publishedVersion)
  • arXiv (Cornell University) (submittedVersion, cc-by-nc-nd)
  • arXiv (Cornell University)
Topics
  • Physical Sciences › Computer Science › Information Systems › Software Engineering Research
  • Physical Sciences › Computer Science › Software › Software Testing and Debugging Techniques
  • Physical Sciences › Computer Science › Information Systems › Web Application Security Vulnerabilities
Keywords
LLM-generated code, large language models, AI-assisted software development, code security, software quality, memory safety, static analysis, SonarQube, CodeQL, unit testing, secure coding, Python, Java, C++

About these checks

Registry, retraction, Cites and statistics results are computed, not judged, with one exception: a printed reference that no index lists is read once by a model before it counts as a citation error. Claims are extracted by a model and kept only when their quote appears verbatim in the text; each cited source is then checked, with a model’s help, for whether it says what the claim relies on. Those verdicts can be wrong — read the claim’s quote and the cited source before relying on one.

Statistics and arithmetic are recomputed, not judged.

Confidence bands are shown only for fields calibrated on our annotated test set. None is calibrated yet, so no band is shown.

What counts as a claim ›How we measure confidence ›How we check this ›

Are you an author, or do you see a problem with this page? Request a review

Data sources

Bibliographic data: Semantic Scholar, OpenAlex, Crossref.

Contains information from the Semantic Scholar Academic Graph Datasets, made available under the ODC Attribution License (ODC-BY 1.0).

Semantic Scholar’s data is described in: Kinney, R., et al. (2023). The Semantic Scholar Open Data Platform. arXiv:2301.10140.