mlsanityData to 14 Oct 2026

Security Degradation in Iterative AI Code Generation -- A Systematic Analysis of the Paradox

arXiv 2506.11022 ↗First posted 19 May 2025cs.SE cs.AI cs.CLcited by 10

Not on the map. Why?

Abstract (arXiv)

The rapid adoption of Large Language Models(LLMs) for code generation has transformed software development, yet little attention has been given to how security vulnerabilities evolve through iterative LLM feedback. This paper analyzes security degradation in AI-generated code through a controlled experiment with 400 code samples across 40 rounds of "improvements" using four distinct prompting strategies. Our findings show a 37.6% increase in critical vulnerabilities after just five iterations, with distinct vulnerability patterns emerging across different prompting approaches. This evidence challenges the assumption that iterative LLM refinement improves code security and highlights the essential role of human expertise in the loop. We propose practical guidelines for developers to mitigate these risks, emphasizing the need for robust human validation between LLM iterations to prevent the paradoxical introduction of new security issues during supposedly beneficial code "improvements".

Key facts. Cited by 10 papers in the map (data through 14 Oct 2026). Builds on 7 of its 21 references that are in the map. First posted on arXiv 19 May 2025.

Builds on

7 of 21 references.

References · 7

  1. 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 431
  2. 2022Do Users Write More Insecure Code with AI Assistants?cited by 192
  3. 2024LLM Critics Help Catch LLM Bugscited by 147
  4. 2022Programming Is Hard -- Or at Least It Used to Be: Educational Opportunities And Challenges of AI Code Generationcited by 99
  5. 2023Refining ChatGPT-Generated Code: Characterizing and Mitigating Code Quality Issuescited by 79
  6. 2024Artificial-Intelligence Generated Code Considered Harmful: A Road Map for Secure and High-Quality Code Generationcited by 12
  7. 2025LLM4CVE: Enabling Iterative Automated Vulnerability Repair with Large Language Modelscited by 9

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 3; 2026: 7.

10 papers.