EUVIMEDEUVIMED entdecken
Crossref

Code Size or Code Shape? Re-examining the Complexity and Vulnerability Relationship in Human and AI-Generated Code

Sultan S. Alqahtani

International Journal of Advanced Computer Science and Applications · 2026 · 17 (10)

DOI: 10.14569/ijacsa.2026.01710112 ↗

Kurz gefasst

Fachartikel in der Zeitschrift International Journal of Advanced Computer Science and Applications, 2026. Verfasst von Sultan S. Alqahtani.

AbstractBibliografische AngabenZitierenVerwandte Studien

Abstract (Originalsprache)

Software security research has traditionally associated greater code complexity with higher vulnerability risk. However, existing evidence is largely based on human-written code and often conflates structural complexity with code size. This study examines whether this assumption holds for AI-generated code by separating code size from size-normalised structural shape. This study re-scores a large human-versus-AI coding corpus containing 507,045 paired tasks in Python and Java, solved by humans, ChatGPT, DeepSeek-Coder, and Qwen-Coder, yielding 1,986,288 observations. Vulnerabilities are identified using Semgrep CWE labels, with ODC-mapped Pylint (Python) and PMD (Java) defects analysed separately as a general code-quality contrast. Results show that higher branching density is consistently associated with lower vulnerability odds (0.35–0.60 per standard deviation) in all eight author-by-language cells, while larger code size increases vulnerability odds (1.32–2.79). The association survives within task: in conditional models that use only variation between four solutions to the same problem, denser code retains roughly half the odds of a finding. Structural shape adds materially to size-only models, and does so about four times more for AI-generated code than for human-written code on a prevalence-insensitive, out-of-sample measure. The pattern does not transfer intact to general code quality: raw cyclomatic complexity predicts ordinary defects strongly but vulnerabilities hardly at all, while branching density is associated with both outcomes yet two to three times more strongly with vulnerabilities. These findings indicate that code shape, rather than code volume, is a more informative indicator of vulnerability exposure, challenging the conventional view that simpler AI-generated code is necessarily safer.

Zitieren

APA

Alqahtani, S. S. (2026). Code Size or Code Shape? Re-examining the Complexity and Vulnerability Relationship in Human and AI-Generated Code. International Journal of Advanced Computer Science and Applications, 17(10). https://doi.org/10.14569/ijacsa.2026.01710112

Vancouver

Alqahtani SS. Code Size or Code Shape? Re-examining the Complexity and Vulnerability Relationship in Human and AI-Generated Code. International Journal of Advanced Computer Science and Applications. 2026;17(10). doi:10.14569/ijacsa.2026.01710112

BibTeX
@article{Alqahtani2026,
  author = {Alqahtani, Sultan S.},
  title = {Code Size or Code Shape? Re-examining the Complexity and Vulnerability Relationship in Human and AI-Generated Code},
  journal = {International Journal of Advanced Computer Science and Applications},
  year = {2026},
  volume = {17},
  number = {10},
  doi = {10.14569/ijacsa.2026.01710112}
}
Kostenlos starten →