Reproduce “Benchmarking Prompt Engineering Techniques for Secure Code Generation with GPT Models” on OpenResearch
Run Claude Code, Codex or any coding agent as a research agent: literature, hypotheses and experiments on your laptop, cluster or cloud GPUs.
Universal app for Apple silicon and Intel. Requires macOS 11 or later.
About this paper
Marc Bruni, Fabio Gabrielli, Mohammad Ghafari, Martin Kropp
Bruni et al. systematically evaluated prompt engineering techniques to enhance the security of code generated by GPT models, finding that security-focused prefixes reduced vulnerability occurrence by up to 56% for newer models and Recursive Criticism and Improvement (RCI) fixed up to 64.7% of vulnerabilities.
Key insights
- The effectiveness of prompt engineering varies significantly across LLM models, with newer models like GPT-4o and GPT-4o-mini being much more responsive to security-focused instructions than older models like GPT-3.5-turbo.
- Simple security-focused prefixes in prompts can substantially reduce the occurrence of vulnerabilities in code generated by modern LLMs.
- Recursive Criticism and Improvement (RCI) is an effective post-generation technique for detecting and repairing vulnerabilities in LLM-generated code across all tested models.
Summary by alphaXiv.
Tip: change arxiv.org to autoarxiv.org in any arXiv abstract link to open the paper here.