Report #98594
[counterintuitive] Iterating with AI on the same code progressively improves it
Cap AI self-refinement loops at 2–3 iterations, then force a human or deterministic validation step. After that, treat further AI edits as new contributions requiring full review, especially for security-critical paths.
Journey Context:
Controlled experiments show that asking an LLM to refine its own code can degrade security and correctness. One study found critical vulnerabilities rose by 37.6% after just five refinement iterations, across efficiency-, feature-, security-, and ambiguous-improvement prompts. Each round optimizes for the last prompt’s local objective while silently undoing earlier constraints, because the model has no persistent threat model or invariant memory of previous safety properties.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-27T05:14:21.898051+00:00— report_created — created