Saved in:
Bibliographic Details
Main Authors: Hazman, Muzhaffar, Pham, Minh-Khoi, Soundararajan, Shweta, Mordido, Goncalo, Custode, Leonardo, Lynch, David, Cruciata, Giorgio, Shi, Yucheng, Song, Hongmeng, Chao, Wang, Yue, Pan, Milenovic, Aleksandar, Agapitos, Alexandros
Format: Preprint
Published: 2025
Subjects:
Online Access:https://arxiv.org/abs/2507.10326
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866913940084097024
author Hazman, Muzhaffar
Pham, Minh-Khoi
Soundararajan, Shweta
Mordido, Goncalo
Custode, Leonardo
Lynch, David
Cruciata, Giorgio
Shi, Yucheng
Song, Hongmeng
Chao, Wang
Yue, Pan
Milenovic, Aleksandar
Agapitos, Alexandros
author_facet Hazman, Muzhaffar
Pham, Minh-Khoi
Soundararajan, Shweta
Mordido, Goncalo
Custode, Leonardo
Lynch, David
Cruciata, Giorgio
Shi, Yucheng
Song, Hongmeng
Chao, Wang
Yue, Pan
Milenovic, Aleksandar
Agapitos, Alexandros
contents Prompt engineering has proven to be a crucial step in leveraging pretrained large language models (LLMs) in solving various real-world tasks. Numerous solutions have been proposed that seek to automate prompt engineering by using the model itself to edit prompts. However, the majority of state-of-the-art approaches are evaluated on tasks that require minimal prompt templates and on very large and highly capable LLMs. In contrast, solving complex tasks that require detailed information to be included in the prompt increases the amount of text that needs to be optimised. Furthermore, smaller models have been shown to be more sensitive to prompt design. To address these challenges, we propose an evolutionary search approach to automated discrete prompt optimisation consisting of two phases. In the first phase, grammar-guided genetic programming is invoked to synthesise prompt-creating programmes by searching the space of programmes populated by function compositions of syntactic, dictionary-based and LLM-based prompt-editing functions. In the second phase, local search is applied to explore the neighbourhoods of best-performing programmes in an attempt to further fine-tune their performance. Our approach outperforms three state-of-the-art prompt optimisation approaches, PromptWizard, OPRO, and RL-Prompt, on three relatively small general-purpose LLMs in four domain-specific challenging tasks. We also illustrate several examples where these benchmark methods suffer relatively severe performance degradation, while our approach improves performance in almost all task-model combinations, only incurring minimal degradation when it does not.
format Preprint
id arxiv_https___arxiv_org_abs_2507_10326
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Grammar-Guided Evolutionary Search for Discrete Prompt Optimisation
Hazman, Muzhaffar
Pham, Minh-Khoi
Soundararajan, Shweta
Mordido, Goncalo
Custode, Leonardo
Lynch, David
Cruciata, Giorgio
Shi, Yucheng
Song, Hongmeng
Chao, Wang
Yue, Pan
Milenovic, Aleksandar
Agapitos, Alexandros
Computation and Language
Prompt engineering has proven to be a crucial step in leveraging pretrained large language models (LLMs) in solving various real-world tasks. Numerous solutions have been proposed that seek to automate prompt engineering by using the model itself to edit prompts. However, the majority of state-of-the-art approaches are evaluated on tasks that require minimal prompt templates and on very large and highly capable LLMs. In contrast, solving complex tasks that require detailed information to be included in the prompt increases the amount of text that needs to be optimised. Furthermore, smaller models have been shown to be more sensitive to prompt design. To address these challenges, we propose an evolutionary search approach to automated discrete prompt optimisation consisting of two phases. In the first phase, grammar-guided genetic programming is invoked to synthesise prompt-creating programmes by searching the space of programmes populated by function compositions of syntactic, dictionary-based and LLM-based prompt-editing functions. In the second phase, local search is applied to explore the neighbourhoods of best-performing programmes in an attempt to further fine-tune their performance. Our approach outperforms three state-of-the-art prompt optimisation approaches, PromptWizard, OPRO, and RL-Prompt, on three relatively small general-purpose LLMs in four domain-specific challenging tasks. We also illustrate several examples where these benchmark methods suffer relatively severe performance degradation, while our approach improves performance in almost all task-model combinations, only incurring minimal degradation when it does not.
title Grammar-Guided Evolutionary Search for Discrete Prompt Optimisation
topic Computation and Language
url https://arxiv.org/abs/2507.10326