arXiv:2609.04197cs.CLSep 2026

Manuscript Offprint

arXiv:2609.04197

ESPO: Error-Structured Prompt Optimization via Diagnose, Diversify, and Stabilize

Lihao Liu, Peng Tang, Kunwar Yashraj Singh, Shabnam Ghadar

Abstract

Evolutionary prompt optimizers such as GEPA suffer from prompt bloat: each iteration appends rules and caveats, producing prompts up to 3× longer yet no more accurate. We trace this to three deficiencies - incomplete error observation, limited search diversity, and unreliable selection - and propose ESPO (Error-Structured Prompt Optimization), which decomposes prompt optimization into three phases: Diagnose clusters all training errors into structural patterns in one round; Propose generates candidates via four complementary strategies with independent biases; Select applies bootstrap stability selection. On seven public NLP benchmarks - Tweet, MMLU, GSM8K, HotpotQA, ScoNe, HoVer, and PUPA - ESPO improves average accuracy by +3.76 pp over the state-of-the-art (74.67% vs. 70.91% for GEPA), matching or exceeding GEPA on every dataset while producing prompts 47% shorter (1,004 vs. 1,878 chars) and faster at inference. Cross-model experiments across four additional student models (Gemma 3 12B, Mistral 14B, Qwen3 32B, Claude Haiku 4.5) show ESPO yields the best average accuracy on every model tested, with the largest gap on Qwen3 GSM8K (15.00% → 91.40%). A generalization bound (Appendix) grounds each phase in a corresponding term of the test-time gap, and the ablation confirms a key prediction: adding diversity without bootstrap selection actually hurts performance (-1.20%).

1 Introduction

Large language models are increasingly steered through natural-language prompts rather than parameter updates (Brown et al., 2020; Wei et al., 2022). As tasks grow more complex, automated prompt optimizers such as APE (Zhou et al., 2023), OPRO (Yang et al., 2024), MIPROv2 (Opsahl-Ong et al., 2024), and GEPA (Agrawal et al., 2026) have emerged to replace manual trial-and-error with systematic search. Among these, GEPA achieves state-

of-the-art results through an evolutionary loop: it evaluates prompts on training examples, reflects on errors using a strong LLM, proposes mutations, and selects survivors via a Pareto front.

A persistent shortcoming of evolutionary prompt optimization is prompt bloat: each iteration tends to append rules and caveats, so prompts grow without bound. In our experiments, GEPA produces prompts up to 3× longer than ESPO's (1.87× on average) yet less accurate from the same weak start, increasing latency and token cost, and can harm generalization by overfitting to training noise. We trace this to three structural deficiencies in the evolutionary paradigm. (i) Incomplete error observation: GEPA reflects on 3–8 random errors per round; by a coupon-collector argument, observing all systematic failure patterns with 95% probability needs ~15 rounds, and in the meantime the optimizer accumulates redundant or contradictory rules addressing symptoms rather than root causes. (ii) Limited search diversity: a single mutation operator locks in one bias profile; when it fails on certain error types, it compensates by stacking more rules - inflating length without improving accuracy. (iii) Unreliable selection: point estimation on a small (~30-example) validation set with ~10 candidates is a multiple-testing problem, and the optimizer may pick a verbose candidate that ranks first by noise rather than true quality.

We propose ESPO (Error-Structured Prompt Optimization), a framework that recasts prompt optimization from evolutionary search to structured statistical estimation. ESPO decomposes optimization into three principled phases. The Diagnose phase analyzes all training errors and clusters them into 3–7 structural patterns, achieving complete error coverage in a single round. The Propose phase generates candidates through K=4 complementary strategies - diagnostic revision, consolidation, ablation, and factual injection - each addressing different error types with different inductive biases.

The Select phase applies bootstrap stability selection (B=20B=20 resamples) to reliably identify the most robust candidate under validation-set noise. ESPO subsumes existing evolutionary methods: setting the number of proposal strategies K=1K=1, bootstrap resamples B=1B=1, and diagnosis batch size m=3m=3 (i.e., only 3 errors observed per reflection round) recovers GEPA, revealing that all three sources of sub-optimality are left unaddressed.

Our contributions are threefold. (1) Framework. We introduce ESPO, a three-phase framework (Diagnose–Propose–Select) that unifies prompt optimization as statistical estimation, subsumes existing evolutionary methods as a degenerate case, and is grounded in a generalization bound whose three terms - bias floor, exploration gain, and selection error - each correspond to one phase (§3; full theory in Appendix A). (2) Experiments. On seven public benchmarks starting from an intentionally weak default prompt, ESPO averages 74.67% accuracy versus 70.91% for GEPA (+3.76 pp), while producing prompts 47% shorter (1,004 vs. 1,878 chars) with consistently lower inference latency (§4). (3) Cross-model generalization. Experiments with four additional student models (Gemma 3 12B, Mistral 14B, Qwen3 32B, Claude Haiku 4.5) show ESPO yields the best average accuracy on every model tested, with the largest gap on Qwen3 GSM8K (15.00% → 91.40% from default; +56.00 pp over GEPA).