International Journal For Multidisciplinary Research

E-ISSN: 2582-2160     Impact Factor: 9.24

A Widely Indexed Open Access Peer Reviewed Multidisciplinary Bi-monthly Scholarly International Journal

Call for Paper Volume 8, Issue 3 (May-June 2026) Submit your research before last 3 days of June to publish your research paper in the issue of May-June.

Recursive Decay in AI-Generated Code: An Empirical Study of Security Logic Degradation Through Iterative LLM Refactoring

Author(s) Mr. Kaustuv Sharma, Yatu Rani, Naveen Yadav
Country India
Abstract Large language models (LLMs) are increasinglyintegrated into software development workflows for code gen-eration, refactoring, and optimization. Although the productivitybenefits of such tools are well-documented, their long-termimpact on code correctness and security under iterative usehas received limited empirical attention. This paper introducesthe Recursive Code Decay Experiment, an empirical frameworkthat quantifies how security-critical logic erodes when code isrepeatedly processed by generative AI models under variousrefactoring objectives.We evaluate LLM-driven refactoring across seven models—Llama 3.3 70B, Llama 3.1 8B, GPT-OSS 120B, GPT-OSS20B, Gemma 3 4B, Qwen 3 8B, and DeepSeek-R1 8B—usingaggressive, neutral, and preservation-aware prompting strate-gies. Security integrity is audited at each generation usingthe Guardrail Pattern Verification (GPV) algorithm, an AST-
based structural analyzer capable of detecting five categories ofdefensive programming patterns. Our findings reveal three dis-inct decay archetypes: monotonic, oscillatory, and paradoxical.Notably, prompt formulation outweighs model size as a predictorof decay resistance. DeepSeek-R1 uniquely exhibited completesecurity collapse even under an explicit preservation directive, highlighting a critical gap between semantic understandingandstructural preservation. These results underscore the necessityof automated structural auditing in AI-assisted developmentpipelines.
Keywords AI Code Generation, LLM Refactoring, Code Security, AST Analysis, Prompt Engineering, Guardrail Pattern Verification, Recursive Decay, Technical Debt
Field Computer > Artificial Intelligence / Simulation / Virtual Reality
Published In Volume 8, Issue 3, May-June 2026
Published On 2026-05-13

Share this