Abstract
Automated prompt engineering has emerged as a vital tool for maximizing the performance of Large Language Models (LLMs). However, current methods often suffer from "prompt drifting"—where fixing specific errors inadvertently degrades performance on previously correct cases—and a lack of actionable guidance for complex tasks. This paper introduces STRAGO (Strategic Guided Optimization), a framework that generates detailed, step-by-step "how-to" strategies derived from both successful and failed examples. By balancing insights from what went right and what went wrong, STRAGO establishes a new state-of-the-art across reasoning, domain-specific, and industrial benchmarks, while significantly improving optimization stability.
Introduction
Prompt engineering is the primary interface for steering LLMs toward desired behaviors, yet manual iteration is notoriously labor-intensive and non-scalable. While automated optimizers like OPRO and APO have attempted to solve this, they face two fundamental hurdles. First is the issue of prompt drifting: when an optimizer focuses exclusively on fixing errors, the resulting prompt often loses the characteristics that made it successful for other inputs. Second is the lack of actionable guidance: most methods provide feedback (e.g., "this answer was incorrect") but rely on the LLM's intrinsic ability to guess the fix. For specialized domains like medicine or complex logical deduction, models often lack the methodology to self-correct without a clear strategy.
The STRAGO Framework
STRAGO introduces a three-pillar architecture designed to move beyond simple trial-and-error by providing the model with a structured "how-to" guide for optimization.
1. The Analyzer
Unlike traditional reflection methods that focus solely on failures, the Analyzer examines both successful ($D_{correct}$) and failed ($D_{incorrect}$) cases. It extracts "positive experiences" (identifying critical factors for success) and "negative experiences" (identifying root causes of failure). This dual approach ensures that the optimization process preserves the strengths of the original prompt while addressing its weaknesses.
2. The Refiner
The Refiner is the core innovation of the framework. Instead of passing raw feedback to the optimizer, it uses in-context learning to generate multiple actionable strategies—detailed execution plans for the task at hand. To mitigate "self-enhancement bias," where a model overrates its own output, STRAGO employs a separate LLM (e.g., Claude) to score these strategies based on clarity and feasibility, selecting only the highest-quality guidance.
3. The Optimizer
The Optimizer generates two distinct sets of revised prompts: one based on positive experiences and one on negative. It then performs a crossover operation, inspired by genetic algorithms, to merge these into a "hybrid prompt." This hybrid retains the stability of successful cases while incorporating the fixes suggested by the strategies. A final paraphrasing step is used to polish the candidates for maximum clarity.
Experimental Evaluation
STRAGO was evaluated across a diverse array of benchmarks to test reasoning, domain knowledge, and real-world utility:
- Big-Bench Hard (BBH): Five challenging reasoning tasks including logical deduction and movie recommendation.
- Natural Language Understanding (NLU): SST-5 (sentiment analysis) and TREC (question classification).
- Domain-Specific Knowledge: MedQA and MedMCQA (medical board exam questions).
- Industrial Application: "Personalized Intent Query," a task involving the reordering of search results based on user history.
Key Results
STRAGO consistently outperformed state-of-the-art baselines, including APO, OPRO, and EvoPrompt:
- Superior Accuracy: STRAGO achieved 79.77% on BBH (a 2.37% improvement over the previous best) and 87.21% on TREC.
- Stability and Reliability: The framework demonstrated the lowest Adverse Correction Rate (ACR). In MedQA, STRAGO broke only 4.49% of previously correct cases, whereas APO broke 10.41%.
- Domain Expertise: In medical tasks where baselines often showed zero improvement or even regressed, STRAGO delivered gains of over 1%, proving its ability to induce domain-specific knowledge through strategic guidance.
- Efficiency: STRAGO converged to high-performance prompts faster than search-based methods, requiring fewer iterations to reach peak scores.
Discussion and Insights
The success of STRAGO suggests that LLMs do not necessarily lack the intelligence to optimize prompts, but rather lack a methodology. By providing a strategic "how-to" guide, the framework unlocks latent capabilities that simple feedback cannot reach. Furthermore, the results highlight that success is as important as failure; identifying why a model succeeded acts as a stabilizer that prevents the optimization process from "throwing the baby out with the bathwater."
Limitations
Despite its performance, STRAGO has a higher token consumption than simpler methods due to the generation of detailed strategies and the maintenance of a prompt cache. Additionally, the method's effectiveness is tied to the capability of the primary model; while it excels with GPT-4, the gains are less pronounced with smaller models like GPT-3.5-turbo, which may struggle to follow complex strategic instructions.
Conclusion
STRAGO represents a significant step forward in automated prompt engineering. By shifting the focus from error correction to strategic guidance, it provides a robust solution to the problem of prompt drifting and enables LLMs to tackle highly specialized and complex tasks with greater accuracy and stability.
Summary updated