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

Lihao Liu, Peng Tang, Kunwar Yashraj Singh, Shabnam GhadararXiv 2026

TL;DR

ESPO (Error-Structured Prompt Optimization) is a new framework that fixes "prompt bloat"—the tendency for automated prompt optimizers to create excessively long, redundant instructions. By decomposing optimization into structured diagnosis, diverse proposal strategies, and bootstrap selection, ESPO produces prompts that are 47% shorter and 3.76 percentage points more accurate than current state-of-the-art evolutionary methods.

What Problem Does This Paper Address?

Large Language Models (LLMs) are increasingly steered by natural-language prompts. Because manual prompt engineering is tedious, researchers developed automated optimizers like GEPA. However, these evolutionary optimizers suffer from a persistent flaw: prompt bloat.

In each iteration, these tools tend to append new rules and caveats to fix specific errors. This results in prompts that grow up to 3× longer without becoming more accurate, increasing latency and cost while risking overfitting to training noise. The authors trace this to three structural deficiencies:

  1. Incomplete Error Observation: Looking at only a few random errors per round.
  2. Limited Search Diversity: Relying on a single mutation operator.
  3. Unreliable Selection: Picking a "winner" based on a single, small validation set, which is often just picking up on statistical noise.

Methods

ESPO recasts prompt optimization from a random evolutionary search into a structured statistical estimation problem across three phases:

  1. Diagnose: Instead of sampling a few errors, ESPO uses a strong LLM to cluster all training errors into 3–7 structural patterns in a single round. This ensures complete coverage of systematic failure modes.
  2. Propose: ESPO generates candidates using four complementary strategies:
  3. Diagnostic Revision: Fixing root causes identified in the diagnosis.
  4. Consolidation: Merging redundant rules to prevent bloat.
  5. Ablation: Removing over-triggered rules that cause false positives.
  6. Factual Injection: Adding domain-specific context.
  7. Select: To combat noise, ESPO uses Bootstrap Stability Selection. It evaluates candidates across 20 bootstrap resamples of the validation set. The prompt that wins the most resamples is chosen, naturally favoring robust, generalizable, and concise instructions.

Datasets

The authors evaluated ESPO across seven diverse NLP benchmarks:

  • Classification: Tweet (sentiment), MMLU (general knowledge), HoVer (fact verification).
  • Reasoning/Math: GSM8K (grade school math), HotpotQA (multi-hop QA), ScoNe (natural language inference).
  • Privacy: PUPA (privacy-preserving generation).

They tested these across multiple "student" models, including Claude Sonnet 4.5, Gemma 3 12B, Mistral 14B, Qwen3 32B, and Claude Haiku 4.5.

Key Insights and Ideas

  • The MDL Principle in Action: The authors invoke the Minimum Description Length (MDL) principle—essentially Occam's Razor—showing that shorter prompts often represent better "compression" of the task logic and generalize more effectively to unseen data.
  • Diversity Requires Stability: A key finding from their ablation study is that adding search diversity (more proposal strategies) actually hurts performance (-1.20%) if you don't also use bootstrap selection. Without stable selection, the optimizer is more likely to pick a "lucky" but low-quality candidate from a larger pool.
  • Structured Diagnosis vs. Length Constraints: Simply forcing a prompt to be short (as seen in the "Constrained GEPA" experiment in Figure 3) doesn't work. Without structured diagnosis to tell the model what is essential, accuracy drops. ESPO achieves brevity by design, not just by force.
Table 2: Constrained GEPA vs. standard GEPA and ESPO. Single-seed values (the constrained-GEPA vari- ant was not rerun over 3 seeds); the point-estimate view of Table 1. Length control alone does not improve GEPA. Best accuracy in bold.

Key Results

ESPO consistently outperformed the previous state-of-the-art (GEPA) while being significantly more efficient:

  • Accuracy: Improved average accuracy by +3.76 pp (74.67% vs 70.91%).
  • Efficiency: Produced prompts that were 47% shorter (1,004 vs 1,878 characters) on average.
  • Cross-Model Power: On the Qwen3 model for GSM8K, ESPO improved accuracy from a weak 15.00% start to 91.40%, a massive 56-point lead over GEPA.
  • Ablation: As shown in Figure 5, the combination of all three phases (Diagnose, Diversity, Bootstrap) provides a synergistic gain (+6.18%) that exceeds the sum of individual parts.
Table 4: Ablation on Tweet: ✓= active, D = Diagnose, K = Diversity (K=4), B = Bootstrap (B=20).

Limitations and Future Work

  • Optimization Cost: While ESPO uses fewer "reflection" tokens than GEPA, the bootstrap selection phase requires many student model evaluations (B resamples × N candidates), which can be expensive for very large student models.
  • Verifiable Tasks: The current framework relies on ground-truth labels for the "Diagnose" phase. Extending this to open-ended generation (like creative writing or dialogue) where "errors" are subjective and require a judge model is a suggested next step.
  • Reflection Model Dependency: The quality of the optimization still depends on the "reflection" LLM's ability to cluster errors effectively. While stable, it may struggle with very subtle or numerous error patterns.

Summary updated

BibTeX
@misc{liu2026espo,
  author = {Lihao Liu and Peng Tang and Kunwar Yashraj Singh and Shabnam Ghadar},
  title = {{ESPO: Error-Structured Prompt Optimization via Diagnose, Diversify, and Stabilize}},
  year = {2026},
  eprint = {2609.04197},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2609.04197},
}
Figure