Introduction
Large Language Models (LLMs) are highly sensitive to prompt engineering, where minor phrasing adjustments can lead to significant performance variations. Traditional Automatic Prompt Engineering (APE) tools typically optimize prompts against fixed, static datasets. However, this approach suffers from two primary limitations: fragility and limited iteration. Prompts optimized for a specific dataset often fail when encountering real-world distribution shifts, and static datasets provide no clear path for continuous improvement once a model has "solved" the training set.
To address these challenges, we introduce SIPDO (Self-Improving Prompts through Data-Augmented Optimization), a closed-loop framework that pairs a "stress-testing" synthetic data generator with an iterative prompt optimizer. SIPDO moves beyond static optimization by generating increasingly difficult examples that expose a prompt's weaknesses, subsequently refining the prompt to address them.
The SIPDO Framework
SIPDO operates as a "two-agent" closed-loop system designed to systematically harden prompts against edge cases and complex reasoning requirements.
The system consists of two primary components:
- The Synthetic Data Generator: Instead of relying on a fixed dataset, this agent creates new training examples using a "Progressive Difficulty" curriculum. By adjusting a difficulty parameter ($c$), the generator produces examples that are just beyond the current prompt's capabilities. A KL-divergence penalty is employed to ensure that the generated data remains realistic and does not drift into nonsensical territory.
- The Auto Prompt Optimizer: Acting as a coach, this agent performs a three-step refinement process:
- Error Analysis: Identifying where the current prompt failed on the synthetic data.
- Recommendation: A reflection module suggests the underlying cause of failure (e.g., "the model ignored numerical constraints").
- Targeted Refinement: An editor module rewrites the prompt based on these insights.
This loop repeats—the generator finds a new weakness, and the optimizer patches it—until the prompt can handle the highest difficulty level or the computational budget is exhausted.
Experimental Setup
SIPDO was evaluated across a diverse array of challenging benchmarks to test its robustness:
- BIG-Bench: Tasks including Penguins in a Table, Geometric Shapes, and Causal Judgment.
- Logical Reasoning: Benchmarks such as ProofWriter (depth-5 logic), FOLIO (first-order inference), and PrOntoQA (5-hop reasoning).
- MMLU (Massive Multitask Language Understanding): Focus on expert-level subjects like College Computer Science, Machine Learning, and College Biology.
Key Results and Analysis
SIPDO consistently outperformed state-of-the-art baselines, including TextGrad, PromptAgent, and REVOLVE, across various LLM backbones.
As shown in the experimental results, SIPDO achieves superior performance on complex reasoning tasks. For instance, on the PrOntoQA benchmark, SIPDO reached 96.3% accuracy, surpassing standard Chain-of-Thought (95.6%) and Neuro-Symbolic methods. In the MMLU College Computer Science subject, SIPDO achieved 93% accuracy, significantly higher than TextGrad (89%) and REVOLVE (90%).
A critical finding from the ablation studies was the importance of the difficulty gradient. When the progressive ramping of challenge was removed, performance plummeted. On the Object Counting task, accuracy dropped by over 40%, proving that the structured generation of synthetic data is as vital as the optimization process itself.
Discussion and Future Work
The core philosophy of SIPDO is a "Red Teaming" approach to prompt engineering. By intentionally attempting to break the prompt with synthetic data, the system forces the creation of more descriptive and robust instructions. Furthermore, SIPDO provides a theoretical grounding by using a KL penalty to bound the "population worst-case error," offering a mathematical basis for its empirical success.
Despite its strengths, SIPDO has limitations. Synthetic data generation is dependent on the base model's capabilities; in highly specialized domains like law or finance, general-purpose LLMs might struggle to synthesize authentic edge cases. Additionally, the multi-agent loop is more token-intensive than single-pass methods. Future work will explore fully automated variants and methods to reduce the computational overhead while maintaining high robustness.
Summary updated