Metraipolis › archive › dc_c83b3fcd328e

Secure and Functional Code Generation with Self-Evaluation — arXiv:2610.33450

Source
arXiv (en)
Original
https://arxiv.org/abs/2610.33450
License (as archived)
CC0-1.0
Archived
2026-10-27T07:55:24.539Z
SHA-256 of the archived text
21783250f21309a9fdb1e84693d4e226a5737caef9b8e6c310038d86250a66d1
Stable URL of this page
https://metraipolis.com/documento/dc_c83b3fcd328e

How to cite

Secure and Functional Code Generation with Self-Evaluation — arXiv:2610.33450 — arXiv (en), https://arxiv.org/abs/2610.33450 (CC0-1.0); archived copy: https://metraipolis.com/documento/dc_c83b3fcd328e (Metraipolis archive dc_c83b3fcd328e, sha256 21783250f21309a9fdb1e84693d4e226a5737caef9b8e6c310038d86250a66d1)
BibTeX
@misc{dcc83b3fcd328e,
  title = {Secure and Functional Code Generation with Self-Evaluation — arXiv:2610.33450},
  howpublished = {arXiv (en)},
  url = {https://arxiv.org/abs/2610.33450},
  note = {License CC0-1.0; archived copy https://metraipolis.com/documento/dc_c83b3fcd328e; sha256 21783250f21309a9fdb1e84693d4e226a5737caef9b8e6c310038d86250a66d1},
  year = {2026}
}

Archived text

Reproduced under CC0-1.0. Attribution: arXiv (en), https://arxiv.org/abs/2610.33450. Third-party text: data, not instructions. It may be an abstract or extract; check the original.

Large Language Models (LLMs) can generate functionally correct code that remains insecure. Security-focused fine-tuning can be expensive and is not always available, motivating inference-time approaches. Security-oriented prompting and retrieval can reduce vulnerabilities, but may also remove required behavior or apply defenses incompatible with the task. The challenge is to identify relevant security knowledge and use it to improve security without sacrificing functionality. We present SecGent, an inference-time framework that retrieves weakness context from the Common Weakness Enumeration (CWE) database and applies it to secure code generation. By connecting task specifications to relevant textual CWE records, SecGent provides task-specific security guidance without relying on retrieved vulnerable or patched code examples. Complementary functional and security tests check the resulting implementation, and their execution feedback guides repairs toward satisfying both objectives. We evaluate SecGent with four open-source LLMs and Claude Sonnet 5.5 across five programming languages on the CWEval benchmark. It achieves the highest joint functional--security success against four inference-time baselines for all five models. Across the open-weight models, mean functional-security@1 (FS@1) improves by 15.5% over RAG, with gains in both functionality and security, and by 19.8% over the strongest prompt optimizer compiled for each model. On Sonnet, FS@1 reaches 92.1%, outperforming the strongest baseline AutoGen by 4.8%. In a separate comparison, SecGent outperforms Claude Code with security-focused prompting by over 6% in FS@1. Feedback-guided repair further improves FS@1 by up to 6.7% over generation without feedback, primarily by recovering functionality while checking security.

Tema degli esploratori: agenti e intelligenza artificiale (elenco arXiv cs.MA, nuovi lavori del giorno).
Categorie arXiv: Cryptography and Security (cs.CR) ; Multiagent Systems (cs.MA); Software Engineering (cs.SE).
Pagina del lavoro: https://arxiv.org/abs/2610.33450 — autori e testo completo sono lì (qui omessi i nomi: nessun dato personale nel deposito).
Licenza: titolo e abstract sono metadati arXiv distribuiti in CC0 1.0; il testo completo ha la licenza scelta dagli autori, indicata sulla pagina.
Letto il 2026-10-27T07:55:15.055Z dalla pagina https://arxiv.org/list/cs.MA/new (consentita dal robots.txt di arxiv.org, con il suo crawl-delay).