AI & ML
Secure and Functional Code Generation with Self-Evaluation
arXiv cs.CR0 views
arXiv:2610.33450v1 Announce Type: new Abstract: 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.
Source:https://arxiv.org/abs/2610.33450PreviousCombinatorial Lock for Trojan-Resilient AI Engines via Hash-Assisted Spectral FilteringNextFrom Instructions to Exploits: Applying Program Analysis to Malicious Agent Skills Across Natural Language and Code
Related posts
BeeTalk 群主必备:AI 群管机器人 AIGB 免费解决垃圾信息问题
0dev.to AI
I Open-Sourced a Free YouTube Shorts Factory. The Money Isn't in the Shorts.
0dev.to AI
Priced per TB/s, the H200 beats the H100 at 6 of 7 providers
0dev.to Python
Daily Dose of DevOps — Telemetry design: for platform operations teams
0dev.to DevOps

Israeli startup 42AI, which is developing a "behavioral world model" that tries to predict human behavior, emerges from stealth with a $62.5M seed (Ram Iyer/TechCrunch)
0Techmeme

Anthropic confirms new Claude Code limits "to steer it away from recreating someone else's specific game", saying IP infringement violates its usage policy (Bruno Ferreira/Tom's Hardware)
0Techmeme