[Paper Review] EvoPrompt: Connecting LLMs with Evolutionary Algorithms Yields Powerful Prompt Optimizers
EvoPrompt uses evolutionary algorithms to automatically generate discrete prompts for LLMs by having LLMs imitate EA operators, improving prompt quality without gradients or parameter access.
Large Language Models (LLMs) excel in various tasks, but they rely on carefully crafted prompts that often demand substantial human effort. To automate this process, in this paper, we propose a novel framework for discrete prompt optimization, called EvoPrompt, which borrows the idea of evolutionary algorithms (EAs) as they exhibit good performance and fast convergence. To enable EAs to work on discrete prompts, which are natural language expressions that need to be coherent and human-readable, we connect LLMs with EAs. This approach allows us to simultaneously leverage the powerful language processing capabilities of LLMs and the efficient optimization performance of EAs. Specifically, abstaining from any gradients or parameters, EvoPrompt starts from a population of prompts and iteratively generates new prompts with LLMs based on the evolutionary operators, improving the population based on the development set. We optimize prompts for both closed- and open-source LLMs including GPT-3.5 and Alpaca, on 31 datasets covering language understanding, generation tasks, as well as BIG-Bench Hard (BBH) tasks. EvoPrompt significantly outperforms human-engineered prompts and existing methods for automatic prompt generation (e.g., up to 25% on BBH). Furthermore, EvoPrompt demonstrates that connecting LLMs with EAs creates synergies, which could inspire further research on the combination of LLMs and conventional algorithms.
Motivation & Objective
- Motivate the need for automatic, discrete prompt design to reduce human effort and improve cross-model effectiveness.
- Propose a framework that marries evolutionary algorithms with LLMs to generate coherent, human-readable prompts.
- Demonstrate the approach’s effectiveness on both open-source and closed-source LLMs across diverse NLP tasks.
Proposed method
- Frame discrete prompt optimization as an evolutionary process (population of prompts).
- Use LLMs to implement EA operators (crossover/mutation) to generate new prompts.
- Evaluate candidates on a development set and retain top-performing prompts.
- Instantiate EvoPrompt with two EAs: Genetic Algorithm (GA) and Differential Evolution (DE).
- Provide instructions that guide LLMs to perform EA steps while preserving prompt coherence.
Experimental results
Research questions
- RQ1Can LLMs implement evolutionary operators to generate discrete prompts without access to gradients or parameters?
- RQ2Do EvoPrompt-based prompts outperform human-designed prompts and prior automatic methods across tasks and models?
- RQ3Which EA variant (GA vs. DE) yields better results under different prompt baselines or datasets?
Key findings
- EvoPrompt with GA and DE outperforms manual prompts and APE on language understanding tasks with Alpaca-7b and GPT-3.5.
- On sentiment classification, EvoPrompt (GA) slightly outperforms EvoPrompt (DE); on subjectivity classification, EvoPrompt (DE) significantly outperforms EvoPrompt (GA).
- In language generation, EvoPrompt (GA) and EvoPrompt (DE) improve ROUGE scores on summarization and SARI on simplification, with DE often leading to higher gains.
- DE generally helps escape local optima compared to GA, especially when initial prompts are weak or diverse.
- The approach does not require access to LLM parameters or gradients and yields human-readable prompts.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.