← Lab /AI/ML

Coding agents often reintroduce fixed vulnerabilities, but PRECEPT raises secure code to 97.1%

Agents fail to retain security fixes across sessions, but PRECEPT improves secure code rate to 97.1%

AI/ML arXiv 24 Nov 2026 Method Prototype evidence Threat model

Published as “PRECEPT: Security Self-Improvement of Coding Agents via Evolving Principles”

Why it matters

The approach offers a practical way to harden AI-generated code in existing development pipelines without costly model retraining.

Summary

PRECEPT evolves a library of secure-coding principles from an agent’s own security failures, raising the share of functional code that is also secure on the SeCodePLT benchmark to 97.1-98.5% (up from 81.9% for the strongest agent alone). It also cuts vulnerability recurrence from 26.7% to 11.5% in new sessions. The evidence comes from experiments with three coding agents (Codex, Claude Code, Qwen Code) on two public benchmarks, showing statistically significant gains without reducing functional correctness.

What they found 2

  1. PRECEPT raises the proportion of functional code that is secure to 97.1-98.5% on SeCodePLT.

    “With PRECEPT, 97.1-98.5% of the agents’ functional code on SeCodePLT is secure, compared with 81.9% for the strongest agent on its own and 87.7% for the strongest baseline.”

  2. PRECEPT reduces vulnerability recurrence from 26.7% to 11.5% in new sessions.

    “recurrence falls from 26.7% after the fix alone to 11.5% with PRECEPT, compared with 15.0% when the agents carry forward their own notes.”

Caveats 1

  • In a new session, the agents introduced the same CWE at the later tasks in 26.7% of executions, averaged over both later tasks and all three distances from the fix, against 27.5% with no earlier fix (Table 1), a retention gain whose interval includes zero.

What’s new here 4

  • Evolves secure-coding principles via a closed set of traceable mutation primitives rather than retraining the model.
  • Attributes each security failure to a specific cause in the principle library (missing, unread, misapplied, too strict) to guide targeted revisions.
  • Keeps the learned lessons in persistent instruction files, allowing them to persist across sessions and transfer across different agents.
  • Demonstrates that class-specific restatements of principles, not the raw published set, materially reduce recurrence.

Threat model stated by the source

Adversaryattacker who exploits vulnerable code once it is deployed
Capabilitycan trigger any vulnerability that passes functional tests but fails the security tests defined for the CWE
Assumestasks, functional and security tests, and the learning infrastructure are trusted; no adversary controls or modifies the test suite or the learning process; changing the tests is not an admissible way to improve scores