The Research Report
SAGE/SPO: Why Your Prompt Optimization Strategy Depends on the Landscape (And How to Prove It Works in Production)
Here's a claim that should make every prompt engineer uncomfortable: no single prompt optimization strategy dominates across all tasks. Not genetic algorithms. Not random search. Not even multi-agent diagnosis. The landscape of your problem determines which strategy wins — and sometimes the simplest one is best.
That's the central finding from a new paper by researchers at Slingshot AI and the University of Cambridge. Their framework, SPO (Stochastic Prompt Optimization), doesn't try to find the One True Algorithm for prompt improvement. Instead, it treats prompt optimization as stochastic black-box search, then systematically compares three strategies of increasing sophistication — and shows that each one wins on different tasks.
But here's what makes the paper genuinely important: they didn't stop at benchmarks. They deployed SAGE (the most sophisticated strategy) on a real mental-health chatbot and proved something most prompt optimization papers only gesture at — that iterated, noisy A/B tests can compound into statistically robust gains. In production. With real users.
Let's dig in.
The Premise: Textual Gradients Aren't Gradients
If you've followed the automatic prompt optimization (APO) space, you've seen the dominant paradigm: treat a prompt like a neural network parameter, compute "textual gradients" from errors, and iteratively update the prompt to reduce loss. DSPy does this. OPRO does this. TextGrad does this. The metaphor is seductive — prompt as parameter, error as gradient, update as descent.
There's just one problem. Recent work (Mei et al., 2025) has shown that textual gradients do not function like real gradients. The loss landscape over prompt space is not differentiable in any meaningful sense. Small perturbations to a prompt don't produce predictable changes in output quality. The gradient metaphor leaks — badly.
SPO takes this as its starting point. If prompts don't live on a smooth, differentiable landscape, then gradient-inspired optimization is the wrong framing. Instead, SPO treats prompt optimization as what it actually is: stochastic search over a discrete, high-dimensional space.
This reframing matters because it changes what you optimize for and how. You don't need smooth gradients. You need good exploration strategies. And different landscapes reward different exploration strategies.
SPO: The Framework
SPO formalizes prompt optimization as a search problem. Given a task, an initial prompt, and an evaluation function, SPO iteratively:
- Generates candidate prompts using a search strategy
- Evaluates candidates on the task
- Selects the best for the next iteration
The framework itself is agnostic to the search strategy. The paper then implements three strategies of increasing sophistication and compares them head-to-head.
Strategy 1: Error-Informed Random Search
The simplest strategy. Generate random mutations of the current prompt, but bias those mutations using error information from the evaluator. If the prompt fails on specific inputs, the mutations are nudged to address those failures.
This is stochastic search with a weak signal. It's cheap, it's fast, and it's surprisingly effective on tasks where the landscape is relatively smooth — where small changes to a prompt produce fairly predictable improvements.
Strategy 2: Genetic Algorithm with Evolutionary Operators
The middle strategy. Maintain a population of prompt variants. Apply crossover (combining elements of two parent prompts) and mutation (random perturbation) to generate offspring. Select the fittest for the next generation.
Genetic search explores more broadly than random search. Crossover can combine useful partial solutions — if prompt A has a good opening instruction and prompt B has good output formatting, their child might inherit both strengths. But this only works when the landscape has combinatorial structure worth exploiting.
Strategy 3: SAGE — Multi-Agent Diagnostic with Code Execution
The most sophisticated strategy. SAGE (SPO via Agent-Guided Exploration) deploys a multi-agent pipeline:
- A diagnostic agent examines the current prompt's failures, writes executable diagnostic code to analyze error patterns, and produces a qualitative diagnosis of what's going wrong.
- A revision agent uses that diagnosis to propose targeted prompt modifications.
- An evaluation agent tests the revised prompt.
The key innovation is the code execution step. The diagnostic agent doesn't just reason about errors in natural language — it writes and runs code to quantify failure modes. This produces richer, more structured error signals than simple pass/fail evaluation.
SAGE is the most expensive strategy per iteration, but it should — in theory — make the most informed decisions about where to explore next.
The Key Result: No Strategy Dominates
The paper evaluates all three strategies across three benchmarks. The results are nuanced and, honestly, more interesting than a clean winner-take-all conclusion:
- On some tasks, error-informed random search performs as well as or better than the more sophisticated strategies. The landscape is smooth enough that broad random exploration finds good regions efficiently.
- On other tasks, the genetic algorithm outperforms both random search and SAGE. The combinatorial structure of the prompt space rewards crossover and population-level exploration.
- On yet other tasks, SAGE wins decisively. When failure modes are complex, heterogeneous, and require qualitative diagnosis to understand, the multi-agent pipeline pays for itself.
The authors don't try to handwave this away. They lean into it:
Effectiveness depends on the interaction of landscape structure with error type.
Translation: your optimization strategy is a hyperparameter. The shape of your problem determines which search algorithm works. There is no free lunch — not in theory, and not in practice.
This is an important result for the field. Much of the APO literature implicitly assumes that more sophisticated optimization (better gradients, more agents, deeper reasoning) is always better. SPO shows that's not the case. Sometimes a simple random search with error feedback is all you need. Sometimes it isn't. The answer depends on the problem.
The Production Deployment: Where SAGE Proves Its Value
But here's where the paper goes from "interesting comparison study" to "genuinely important contribution."
The Slingshot AI team deployed SAGE on their mental-health chatbot — a production system serving real users in vulnerable moments. This isn't a synthetic benchmark. It's a high-stakes, open-ended dialogue system where prompt quality directly affects user wellbeing.
The Setup
The team ran SAGE in a continuous optimization loop: propose prompt modifications, run A/B tests, deploy the winner, repeat. They completed eight optimization cycles.
Each individual cycle was noisy. A single A/B test might show a small positive effect that could be statistical noise. This is the reality of production prompt optimization — the signal-to-noise ratio for any single test is low, especially on engagement metrics like retention.
The Compound Result
After eight cycles, SAGE produced a statistically robust gain in next-day retention. Individually noisy tests, compounded over multiple cycles, accumulated into a result that passed statistical significance.
This is a big deal for several reasons:
- It validates the iterative approach. Prompt optimization isn't a one-shot process where you find the perfect prompt and ship it. It's a continuous improvement cycle, and each individual step may be uncertain. But the compounding effect is real.
- It demonstrates qualitative + quantitative synergy. The SAGE pipeline works because it combines qualitative diagnosis (agents understanding why a prompt fails) with quantitative validation (A/B tests measuring whether the fix actually works in production). Neither alone is sufficient. Diagnosis without validation is just-so stories; validation without diagnosis is random guessing.
- It's the right metric. Retention, not accuracy. For an open-ended conversational system, whether users come back is a better signal than whether the model scores well on a held-out test set. This aligns optimization with actual product value.
- It's statistically honest. Many production A/B tests in the AI space are run with questionable methodology — peeking, multiple testing, optional stopping. The paper explicitly notes that individual cycles are noisy and only the compounded result is robust. That's the right way to think about iterative optimization.
Why This Matters for Practitioners
1. Stop Chasing the "Best" Optimizer
If you're building prompt optimization tooling, the SPO finding should change your roadmap. Don't build one algorithm and declare it the winner. Build a framework that supports multiple search strategies, and let the problem determine which one to use. Start with error-informed random search (it's cheap and fast). If that plateaus, try genetic search. If that plateaus, try SAGE-style diagnostic agents.
This is the hyperparameter tuning insight from ML, applied to prompt optimization: the search strategy is itself a hyperparameter.
2. Diagnosis + Validation = The Winning Combo
The production deployment validates something many of us have intuited but few have rigorously demonstrated: qualitative diagnosis plus quantitative A/B testing beats single-strategy optimization for open-ended tasks.
Pure A/B testing without diagnosis is expensive and slow — you're exploring randomly. Pure diagnosis without testing is unreliable — the agent's reasoning about why something fails might be wrong, and you won't know without measuring. The combination is where the magic happens.
If you're running prompt optimization in production, your pipeline should look like this:
- Diagnose: Use an agent to understand why the current prompt fails
- Propose: Generate targeted modifications based on that diagnosis
- Test: A/B test the modification against the current prompt
- Deploy: If the test reaches significance, ship the winner
- Repeat
Each cycle is noisy. That's okay. The compounding effect is what matters.
3. Match Your Strategy to Your Landscape
The paper's landscape analysis is particularly useful:
- Smooth landscapes (small prompt changes produce predictable quality changes): Random search works well. Don't over-engineer it.
- Combinatorial landscapes (good prompts combine independently useful substructures): Genetic algorithms shine. The crossover operation exploits this structure.
- Complex, heterogeneous landscapes (failure modes vary qualitatively across inputs): SAGE-style diagnostic agents earn their cost. The code execution step provides structured error analysis that simple evaluators miss.
The practical implication: before choosing your optimization strategy, characterize your landscape. Run a few random search iterations. If you see smooth improvement, keep it simple. If you hit a wall, try genetic search. If failure modes are diverse and hard to characterize, bring in diagnostic agents.
4. Code Execution as a Diagnostic Tool Is Underappreciated
One of SAGE's distinctive features is that the diagnostic agent writes and executes code to analyze errors. This isn't just natural language reasoning about what went wrong — it's quantitative, reproducible error analysis.
This is a pattern more teams should adopt. When your prompt fails on a subset of inputs, don't just ask an LLM "what went wrong?" Ask it to write code that clusters the failures, computes statistics, and identifies patterns. The code output is inspectable, debuggable, and far more reliable than free-form natural language diagnosis.
5. Retention Is the Right Metric for Conversational AI
The production result measures next-day retention, not task accuracy. This is the correct choice for mental-health chatbots (and, frankly, for most conversational AI products). A prompt that produces "accurate" responses but doesn't keep users engaged is failing at its actual job.
If you're optimizing prompts for conversational systems, measure retention, engagement, and satisfaction — not just correctness on a held-out set. The optimization landscape for retention is noisier, which is exactly why you need the compound A/B testing approach that SAGE validates.
The Honest Caveats
The paper is upfront about its limitations, and they're worth noting:
- Three benchmarks is a small comparison set. The "no strategy dominates" finding is robust across these three, but the generalization to all prompt optimization problems is a hypothesis, not a theorem.
- SAGE is expensive. Multi-agent pipelines with code execution cost significantly more per iteration than random search. If your landscape is smooth, you're burning compute for no gain.
- The production deployment is a single system. One mental-health chatbot, eight cycles. The compounding effect is encouraging, but we need more production deployments across different domains to be confident about generalization.
- The stochastic search framing, while correct, undersells the role of the evaluator. The evaluation function determines what "better" means, and for open-ended dialogue, designing good evaluators is itself a hard problem. The paper uses domain-specific evaluators for the production deployment, which is the right call but means the evaluation design is part of the system, not separate from it.
The Bigger Picture
SAGE/SPO sits at an interesting intersection in the prompt optimization landscape. On one side, you have DSPy-style gradient approaches that treat prompts as continuous parameters to be optimized. On the other, you have manual prompt engineering guided by intuition and experience.
SPO stakes out a pragmatic middle ground: treat prompt optimization as search, acknowledge that different landscapes require different strategies, and validate iteratively in production.
This is arguably the most production-ready framing for prompt optimization that the literature has produced. It doesn't require you to believe in textual gradients. It doesn't require a single algorithmic commitment. It asks you to:
- Measure what your current prompt does (with real metrics, not just accuracy)
- Diagnose why it fails (with code, not just vibes)
- Search for improvements (with the strategy that matches your landscape)
- Validate in production (with A/B tests that compound over time)
- Repeat
That loop — diagnose, propose, test, deploy, repeat — is what working prompt optimization actually looks like. Not a single magical algorithm, but a disciplined process that compounds small gains into large ones.
The paper's code is available at github.com/slingshot-ai/sage. If you're running prompt optimization in production, it's worth studying both the framework and the production deployment methodology. The finding that no single strategy dominates is a feature, not a bug — it means you need to be deliberate about which strategy you use and when.
And the compounding result — eight noisy A/B tests producing a statistically robust retention gain — is the kind of evidence this field needs more of. Not benchmark sweeps, not synthetic evaluations, but real production impact measured rigorously over time.
Paper: "SAGE: Stochastic Prompt Optimization via Agent-Guided Exploration" by Ziyi Zhu, Luka Smyth, Saki Shinoda, and Jinghong Chen. arXiv:2606.18902. June 2026.