A Toolbox for Improving Evolutionary Prompt Search (2025)

Abstract: Evolutionary prompt optimization has demonstrated effectiveness in refining prompts for LLMs. However, existing approaches lack robust operators and efficient evaluation mechanisms. In this work, we propose several key improvements to evolutionary prompt optimization that can partially generalize to prompt optimization in general: 1) decomposing evolution into distinct steps to enhance the evolution and its control, 2) introducing an LLM-based judge to verify the evolutions, 3) integrating human feedback to refine the evolutionary operator, and 4) developing more efficient evaluation strategies that maintain performance while reducing computational overhead. Our approach improves both optimization quality and efficiency. We release our code, enabling prompt optimization on new tasks and facilitating further research in this area.

## introduction the recent advent of large language models (llms) has ushered in a new era of interactional artificial intelligence, democratizing access to powerful conversational agents and machine translation systems. despite impressive empirical gains, state-of-the-art llms continue to exhibit notable gaps in genuine language understanding, often producing outputs that lack grounding. one crucial bottleneck in harnessing llms for real-world tasks lies in the formulation of prompts: the textual instructions that guide model behavior. prompt quality has been shown to exert a profound influence on model performance, yet designing optimal prompts remains an art: manual tuning is labor-intensive, ad hoc, and often fails to generalize across tasks or domains @xcite . to overcome these limitations, a growing body of work has explored automatic prompt optimization methods, including evolutionary strategies in which candidate prompts are iteratively mutated and selected based on llm responses @xcite @xcite . while promising, these approaches suffer from two key drawbacks: (i) their feedback loop relies on expensive api calls or compute resources to evaluate every candidate prompt, and (ii) their mutation operators themselves are typically hand-crafted, limiting adaptability and often propagating hallucinations or other undesired artifacts @xcite . one promising approach for improving prompt optimization is incorporating human feedback to verify and refine llm outputs @xcite . while llms can automate prompt generation, human input remains crucial for verifying the accuracy of their results and correcting errors. by integrating human feedback into the prompt optimization process, we aim to create a more robust system where humans not only verify llm-based evolutionary operator instructions human judge chain of instructions our proposed method previous research efficient evaluation on target task { ... llm output but also guide future prompt evolutions. in the case that human feedback is not available (e.g., if there are no domain experts available, or it would be too costly), we allow another llm to act as judge and to take the responsibility of the human verifying the output of the evolutionary operator. additionally, since fewer instructions are simpler to verify and chain-of-thought (cot) reasoning was shown to improve llm performance as well @xcite , we believe that the evolutionary operator as well as human feedback and the judging mechanism can benefit from more fine-grained instructions; we call this chain-of-instructions (coi). this design choice is motivated by several factors: 1) we hypothesize that reducing the complexity of individual instructions makes them easier for the model to follow, akin to how cot reasoning enhances model performance. 2) it minimizes confusion for the judge, allowing them to assess each step independently, rather than rejecting the entire evolutionary process due to errors in specific parts. 3) human interaction becomes more efficient, as users can review and validate each evolution step separately -similar to the judge -and provide targeted feedback for improvements. furthermore, since the evaluation of generated prompts is crucial for the evolution, we introduce methods to efficiently evaluate prompts, finally leading to increased resource efficiency while maintaining task performance. in this paper, we address the following research questions regarding llm-based evolutionary prompt optimization methods with the ultimate goal of improving language understanding in llms: rq1: how can new candidate prompts be evaluated more efficiently without forfeiting overall performance? rq2: does coi-based evolution help judges and improve the evolutionary operator? rq3: can llm-based judges assess the output quality of textgenerative evolutionary operators? rq4: how can human feedback be effectively leveraged to enhance evolutionary prompt optimization? rq5: how does the selection of the llm influence the effectiveness of the proposed improvements? to explore these questions, we propose an approach where the llm serves as both an operator for evolutions and a judge of prompts while allowing humans to intervene when the model output is incorrect. this feedback loop allows human corrections to be leveraged for further optimizing the prompt search process. additionally, several evaluation strategies aim to make the evaluation more efficient and feedback loops faster. an overview is given in figure 1 . our contributions are as follows: 1) we introduce a novel human-inthe-loop approach for refining llm-based prompts, where the feedback is used for future optimizations. 2) we introduce an llm-based judge for verifying llm-based evolutions. 3) we present chain-ofinstructions as a mechanism to enhance control over the evolutionary process and facilitate more effective feedback. 4) we show how the efficiency of prompt optimization methods can be increased without sacrificing performance. 5) we present empirical results investigating the benefits of our approaches in the context of evolutionary prompt optimization methods. 6) we publish all code that is necessary to reproduce the findings presented in this paper under a permissive license to enable further research into the topic of evolutionary prompt optimization and human feedback. ## background in this section, we introduce the foundational concepts and methods that underpin our research on evolutionary prompt optimization. ## method our goal is to find the ideal prompt p for a given low-resource nlp task (see section 4.1) using in-context learning with an llm. to achieve this goal, a small set of labeled validation data d is available (|d| ≤ 200). the llm is treated as a black-box function, so no access to its parameters or inner architecture is available and needed, enabling models that are only available via apis. the optimization process resembles a genetic algorithm, where a population of prompts is evolved over t generations. initialization: to generate the initial population, we select the best ⌊i/2⌋ prompts from a task-specific set of base prompts and generate the remaining ⌈i/2⌉ prompts by paraphrasing the selected base prompts, where i is the population size. this initialization warmstarts the optimization process with a diverse set of prompts @xcite . evolution: we follow the work of lehman et al. @xcite , meyerson et al. @xcite , guo et al. @xcite and use an llm to perform the operations of mutation and crossover of the evolutionary algorithm. we use the same operator implementations for differential evolution (de) and generic algorithm (ga) as baselines to improve upon, also using demonstration data in the input for in-context learning. that is, for the classification tasks, we randomly select one input-output pair per class, and a single example for the other tasks. evaluation: prompt fitness si is defined as the performance of an evaluation model with prompt pi on the validation data: @xmath0, d). selection: prompts for evolution are selected following lipowski and lipowska @xcite using a roulette-wheel style algorithm with stochastic sampling. specifically, a prompt is selected with probability @xmath1 this section describes the experiments conducted to explore the effectiveness of the proposed methods. all code, data and information that is neccessary to reproduce the results of the presented experiments is published online. 3 ## quantitative results this section presents the results of the conducted experiments in a quantitative manner to show the effectiveness of each modification, analyzing their implications with respect to our research questions. ## qualitative analysis of human feedback figure 3 presents an example of human feedback within our approach. upon reviewing the model output from the first evolution step, it was observed that not all differences were identified, and some similarities were erroneously included. additionally, unexpected extraneous output was generated. to address these issues, the prompt for the first evolution step was refined by incorporating the following instructions: "output a list of all different parts and make sure that differences are only in the form of words and phrases." and "if the same phrase appears in both prompts, do not list it, i.e., do not list similarities." this example also highlights the ambiguities associated with human involvement: multiple instructions exist, just as there are various input: step 1: identify the different parts between prompt 1 and prompt 2: prompt 1: analyze the sentence and categorize it into one of five categories based on the sentiment: terrible, bad, okay, good, or great. prompt 2: classify the given review into one of five categories: extremely negative (terrible), somewhat negative (bad), neutral (okay), somewhat positive (good), or extremely positive (great). ## conclusion we introduced and investigated extensions to evolutionary prompt optimization that leverage coi, an llm-based judge, human feedback and efficient evaluation methods to optimize prompts for a given task. coi, by enabling greater control and better decision-making, can enhance performance in prompt optimization (rq2) and holds promise for broader applications. in particular, when combined with judgebased assessment (rq3) and human feedback (rq4), it provides a robust framework for identifying optimal prompts in nlp tasks. lastly, beyond performance improvements, reducing computational cost is also a key consideration. our efficient evaluation methods offer a significant reduction in computational overhead while maintaining performance during the search for optimal prompts (rq1). we are convinced that our contributions, including investigations and releasing our code, help future research in the area, promoting the effective and efficient use of llms in nlp, and especially help in grounding llms for better language understanding.