arrow
Return

Discrete Prompt Optimization Using Genetic Algorithm for Secure Python Code Generation

delete2025-10-26
delete0
delete
OA
AI
C
Catherine Tony
M
Maura Pintor
M
Max Kretschmann
R
Riccardo Scandariato
DOI:10.1016/j.jss.2025.112682delete
deleteOriginal
deleteShare
deleteSave
View PDF
Abstract

Abstract

En 中文
• A discrete prompt optimization pipeline leveraging genetic algorithm, equipped with security-focused scoring and mutation functions for secure code generation. • Introduces two new security-specific LLM-assisted prompt mutation techniques called self-guided and feedback-guided mutation to generate more security oriented variations of code generation prompts. • The security-specific mutation techniques led to prompts with richer security cues compared to the prompts mutated by just using the generic techniques such as paraphrase, back translation and cloze transformation. • Prompts optimized using a combination of security-specific and generic mutation techniques led to the most improvement in the security of the LLM-generated code. • Prompts optimized on one LLM demonstrated lack of transferability to others indicating the importance of model-specific optimizations.
Keywords:
LLMs
Secure Code Generation
Prompt Optimization
Genetic Algorithms
AI Summary

AI Summary

Key information extracted from the uploaded paper, including a brief overview, abstract, background, key highlights, visual analysis, and future outlook.

Journal

Journal of Systems and Software cover
Journal of Systems and Software
IF:
4.1
Papers:
5.4K
Citations:
8.4K

Organization

H
Hamburg University of Technology
Scholars:
2.9K
Papers: 2.6K
Citations: 4.4K