TL;DR
PromSec is a novel algorithm that enhances the security and functionality of code generated by large language models by combining vulnerability fixing with prompt optimization, significantly reducing vulnerabilities and operational costs.
Contribution
It introduces a dual-objective optimization framework using gGAN and prompt refinement to produce secure, functional code efficiently across multiple programming languages.
Findings
PromSec reduces code vulnerabilities more effectively than state-of-the-art methods.
It achieves over an order of magnitude reduction in LLM queries and analysis costs.
Prompts optimized with PromSec are transferable across different LLMs and programming languages.
Abstract
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 open-source data. This highlights the need for ensuring secure and functional code generation. This paper introduces PromSec, an algorithm for prom optimization for secure and functioning code generation using LLMs. In PromSec, we combine 1) code vulnerability clearing using a generative adversarial graph neural network, dubbed as gGAN, to fix and reduce security vulnerabilities in generated codes and 2) code generation using an LLM into an interactive loop, such that the outcome of the gGAN drives the LLM with enhanced prompts to generate secure codes while preserving their functionality. Introducing a new contrastive learning approach in gGAN, we formulate code-clearing…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
MethodsContrastive Learning
