article

Automated Prompt Engineering for Cost-Effective Code Generation Using Evolutionary Algorithms

  • ACM Transactions on Software Engineering and Methodology
  • Association for Computing Machinery
Research footprint

At a glance

Citations
1
References
14
Comments
0
Paper overview

Abstract

Large Language Models (LLMs) have seen increasing use in various software development tasks, especially in code generation. The most advanced recent methods attempt to incorporate feedback from code execution into prompts to help guide LLMs in generating correct code in an iterative process. While effective, these methods could be costly due to numerous interactions with the LLM and extensive token usage. To address this issue, we propose an alternative approach named E volutionary P rompt Eng i neering for C ode ( EPiC ), which leverages a lightweight evolutionary algorithm to refine the original prompts into improved versions that generate high-quality code, with minimal interactions with the LLM. Our evaluation against state-of-the-art (SOTA) LLM-based code generation agents shows that EPiC not only achieves up to 5% improvement in pass@k but is also 1.2–10 times more cost-effective than the baselines.

Record transparency

Publication details

DOI
10.1145/3805704
OpenAlex
W7142404632
Document type
article
Language
EN
Source
ACM Transactions on Software Engineering and Methodology
Last metadata update
Community

Comments

Log in to join the discussion.

  1. No comments yet. Start the discussion.