paper-with-me

홈 › Papers

Functional and Secure Code Generation with Task Vectors

2026-07-08 · Felix Wang, Anudeep Das, Mei Nagappan, N. Asokan arxiv

Large language models (LLMs) are increasingly used for code generation, but they struggle to generate functional code free of security vulnerabilities. Prior work to improve the secure code generation abilities of such coding LLMs has largely focused on evaluating code functionality and security separately using different datasets, or focused on finding vulnerabilities post-generation. At the same time, the text-generation domain has seen significant work on alignment techniques, where models are tuned such that their outputs exhibit certain qualities (e.g., helpfulness, harmlessness). Of particular interest is task-vector arithmetic, where linear operations on LLM weights can be used to arbitrarily enhance alignment while incurring only minimal computational overhead. We develop a novel method, SecVecCoder, leveraging task vectors to produce trustworthy code that is simultaneously functional and secure without the need for post-generation adjustment. Across six coding LLMs from three families on the CodeGuard+ benchmark, SecVecCoder improves the rate of trustworthy code completions by 2.1-36.0 percentage points over the base model, with improvements on unseen CWE types reaching up to 39.1 percentage points. Since the effectiveness of the coding LLM relies only on changing the model weights, SecVecCoder requires no method-specific decoding and hence achieves a decoding latency within 0.6% of the base model's, on average.

📄 PDF Abstract BibTeX arXiv:2607.07881

Code (0)

등록된 구현이 없습니다.

Tasks

Code Generation

Similar Papers 제목 키워드 기반

Large Language Models for Code: Security Hardening and Adversarial Testing

2023-02-10 · Jingxuan He, Martin Vechev

Large language models (large LMs) are increasingly trained on massive codebases and used to generate code. However, LMs lack awareness of security and are found to frequently produce unsafe code. This work studies the se…

Code GenerationProgram Synthesis

Secure Code Generation via Online Reinforcement Learning with Vulnerability Reward Model

2026-02-07 · Tianyi Wu, Mingzhe Du, Yue Liu, Chengran Yang 외 arxiv

Large language models (LLMs) are increasingly used in software development, yet their tendency to generate insecure code remains a major barrier to real-world deployment. Existing secure code alignment methods often suff…

Vulnerability DetectionReinforcement LearningCode Generation

PromSec: Prompt Optimization for Secure Generation of Functional Source Code with Large Language Models (LLMs)

2024-09-19 · Mahmoud Nazzal, Issa Khalil, Abdallah Khreishah, NhatHai Phan

The capability of generating high-quality source code using large language models (LLMs) reduces software development time and costs. However, they often introduce security vulnerabilities due to training on insecure ope…

Code GenerationContrastive LearningGraph Neural Network

A Systematic Evaluation of Parameter-Efficient Fine-Tuning Methods for the Security of Code LLMs

2025-09-16 · Kiho Lee, Jungkon Kim, Doowon Kim, Hyoungshick Kim arxiv

Code-generating Large Language Models (LLMs) significantly accelerate software development. However, their frequent generation of insecure code presents serious risks. We present a comprehensive evaluation of seven param…

parameter-efficient fine-tuningCode Generation

SoK: AI Secure Code Generation: Progress, Pitfalls, and Paths Forward

2026-06-23 · Rupam Patir, Keyan Guo, Haipeng Cai, Hongxin Hu arxiv

The increasing use of AI systems for code generation raises a central security question: what can today's models and coding agents actually do to produce secure code, where do they still fail, and what would move the fie…

Reinforcement LearningCode Generation