Nanyang Technological University
Genetic algorithms for automated and adaptive prompt engineering in large language model
Abstract
dc:description.abstractLarge language models are increasingly deployed in practical systems, yet their performance often depends heavily on the quality of the prompts used to guide them. In many applications, a prompt must do more than improve task accuracy: it must also preserve output structure, satisfy explicit constraints, and remain stable under stochastic decoding. This makes prompt design a difficult optimization problem. Existing prompt optimization methods can improve performance, but they often treat prompts as unstructured text and therefore struggle to maintain consistency when tasks require multiple instructions or strict output conditions. This dissertation studies prompt optimization from the perspective of structured search. It proposes ECPS, a constrained prompt-program optimization framework that represents a prompt as a modular program composed of typed instruction blocks. Instead of rewriting the whole prompt as a free-form string, the method performs local typed mutations on individual components, allowing the search process to improve one part of a prompt while preserving others. To make the optimization more reliable, the framework further introduces a holdout certification mechanism for feasibility validation and a basin-aware parent selection strategy that favors prompts whose local neighborhoods produce more certified offspring. Together, these components aim to balance utility improvement with structural robustness. The proposed method is evaluated on six benchmarks covering multi-hop question answering, fact verification, instruction following, structured-output generation, and mathematical reasoning, using two frozen model backends, GPT-4.1 Mini and Qwen3-8B. The results show that ECPS consistently achieves the strongest aggregate performance among the compared prompt optimization baselines. In particular, it delivers larger gains on tasks with strong structural or instruction-following constraints, while remaining competitive on reasoning-dominant benchmarks. Ablation studies further show that typed mutation, holdout certification, and basin-aware selection each contribute to the final performance, with structured mutation having the largest direct effect. These findings suggest that prompt optimization benefits from treating prompts as structured programs rather than flat text strings. More broadly, the dissertation shows that combining evolutionary search with feasibility-aware control can improve both effectiveness and stability in automated prompt engineering for frozen large language models.
Degree
thesis:*- College dc:contributor.school
- School of Electrical and Electronic Engineering
- Grantor dc:publisher
- Nanyang Technological University
- Year dc:date.issued
- 2025
Author and committee
dc:creator, dc:contributor.*- Author dc:creator
-
- Cai, Hongtian
- Advisor dc:contributor.supervisor
-
- Mao Kezhi
Subjects
dc:subject × 1Rights
- Language dc:language.iso
- en
Identifiers
dc:identifier.*- Handle dc:identifier.uri
- https://hdl.handle.net/10356/214399