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.5K
Citations:
8.4K

Organization

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

Cited Papers

Towards Unified Prompt Tuning for Few-shot Text Classification
err2022-01-01
err0
errOAAI
errJianing Wang; Chengyu Wang; Fuli Luo; Chuanqi Tan; Minghui Qiu; Fei Yang; Qiuhui Shi; Songfang Huang; Ming Gao
errShare
errSave
errShare
errSave
err2019-01-01
err0
PREAI
errMohammad Taher Pilehvar; Jose Camacho-Collados
errShare
errSave
RLPrompt: Optimizing Discrete Text Prompts with Reinforcement Learning
err2022-01-01
err0
errOAAI
errMingkai Deng; Jianyu Wang; Cheng-Ping Hsieh; Yihan Wang; Han Guo; Tianmin Shu; Meng Song; Eric Xing; Zhiting Hu
errShare
errSave
AI Writes, We Analyze: The ChatGPT Python Code Saga
err2024-07-02
err0
PREAI
errMd Fazle Rabbi; Arifa Islam Champa; Minhaz F. Zibran; Md Rakibul Islam
errShare
errSave
Asleep at the Keyboard? Assessing the Security of GitHub Copilot’s Code Contributions
err2022-05-01
err0
errOAAI
errHammond Pearce; Baleegh Ahmad; Benjamin Tan; Brendan Dolan-Gavitt; Ramesh Karri
errShare
errSave
researcher View more