The Impact of Prompt Programming on Function-Level Code Generation
Ranim Khojah, Francisco Gomes de Oliveira Neto, Mazen Mohamad, Philipp Leitner

TL;DR
This paper evaluates how different prompt engineering techniques affect the quality and correctness of code generated by large language models, revealing that combining techniques does not always lead to better results.
Contribution
Introduces CodePromptEval, a dataset for systematically assessing prompt techniques' impact on LLM code generation, and provides insights into their interactions and effectiveness.
Findings
Certain prompt techniques significantly influence code correctness and quality.
Combining multiple prompt techniques does not necessarily improve code generation outcomes.
There is a trade-off between correctness and quality when applying prompt techniques.
Abstract
Large Language Models (LLMs) are increasingly used by software engineers for code generation. However, limitations of LLMs such as irrelevant or incorrect code have highlighted the need for prompt programming (or prompt engineering) where engineers apply specific prompt techniques (e.g., chain-of-thought or input-output examples) to improve the generated code. While some prompt techniques have been studied, the impact of different techniques -- and their interactions -- on code generation is still not fully understood. In this study, we introduce CodePromptEval, a dataset of 7072 prompts designed to evaluate five prompt techniques (few-shot, persona, chain-of-thought, function signature, list of packages) and their effect on the correctness, similarity, and quality of complete functions generated by three LLMs (GPT-4o, Llama3, and Mistral). Our findings show that while certain prompt…
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
TopicsEmbedded Systems Design Techniques · Parallel Computing and Optimization Techniques · Teaching and Learning Programming
