TL;DR
As Large Language Models (LLMs) become the engines of complex software, getting their instructions just right—prompt optimization—has snowballed into an arms race of complex evolutionary algorithms and massive compute budgets. This paper asks a refreshing question: what if we ditch the Rube Goldberg machines and just let a simple, tool-using agent read the error logs and fix the prompt itself? Enter ReAPO, a lightweight agentic framework that matches or beats state-of-the-art optimizers at roughly a quarter of the cost and time.
What Problem Does This Paper Address?
Adapting an LLM to a specialized task without updating its weights means tuning its natural-language instructions. When your system is a multi-stage pipeline—where Module A's output feeds Module B—tweaking one prompt can subtly break something downstream.
To solve this credit-assignment puzzle, recent prompt optimizers (like MIPROv2 and GEPA) treat prompt writing as a heavy-duty search problem. They maintain populations of candidate prompts, build Bayesian surrogate models, track Pareto fronts, and apply evolutionary mutation heuristics. While effective, this outer-loop machinery demands thousands of evaluation rollouts (running the target system on data) and often requires hand-crafted, task-specific feedback signals. The authors ask whether all this algorithmic scaffolding is actually necessary once the underlying LLMs are smart enough to reason about failures directly.
Methods
Instead of breeding populations of prompts, ReAPO (ReAct Agents for Prompt Optimization) delegates the entire optimization loop to a single LLM operating in a standard ReAct (Reason + Act) loop. It refines a single greedy lineage of prompts over a small, fixed number of rounds (typically $R = 5$).
What makes this work is the environment the optimizer lives in. Through a Model Context Protocol (MCP) server, ReAPO is given five categories of tools—allowing it to inspect the target system's architecture, run evaluations, read per-datapoint execution traces, edit prompts, and log checkpoints.
Guided by a universal, task-independent "skill prompt" (a natural-language protocol rather than hardcoded search logic), the agent executes a clean scientific loop:
- Baseline & Diagnose: Run the initial system on the training set and inspect the execution traces of the 15 worst-scoring examples.
- Attribute & Edit: Trace data flow across modules to pinpoint which prompt caused a downstream failure, cluster the reasoning errors, and write generalizable prompt updates (explicitly avoiding memorizing training examples).
- Evaluate & Checkpoint: Test the new prompt set. If the training score improves, keep it; if it drops, revert to the previous best checkpoint (unless the dip looks like random evaluation noise).
Datasets
ReAPO is tested on two distinct fronts:
- Six Public Academic Benchmarks: HotpotQA (multi-hop QA), HoVer (fact verification), AIME 2025 and LiveBench-Math (competition math), IFBench (instruction following), and PUPA (privacy-preserving delegation).
- Five New Enterprise Agentic Tasks: Introduced by the authors to test multi-turn, tool-calling agents on problems not saturated in LLM pretraining corpora. These span a spectrum from familiar tasks (SQL generation, Product Questions) to nuanced operational workflows (Meeting Management) and proprietary setups (Customer Support Triage, insurance Claim History).
Key Insights and Ideas
- The "Benchmark Saturation" Illusion: In a clever ablation, the authors stripped away ReAPO's ability to read error traces, giving it only the aggregate pass/fail score after each round. A smaller optimizer (GPT-4.1 Mini) completely collapsed. Surprisingly, a frontier optimizer (GPT-5) still aced the public benchmarks blindfolded! However, when tested blindfolded on proprietary enterprise tasks, GPT-5 tanked (losing 35 points on Meeting Management). The takeaway: frontier models have memorized academic benchmark patterns and can "distill" their latent knowledge into prompts without looking at errors. Real-world, unfamiliar workflows genuinely require execution-trace introspection.
- Single Runs Lie: LLM stochasticity is high enough that evaluating an optimized prompt once on small benchmarks creates mirages. Using bootstrap confidence intervals across five runs, the authors show many nominal "wins" between optimizers are actually statistical ties.
- Explicit Structure Transfers Better: Prompts optimized by ReAPO on GPT-4.1 Mini transferred zero-shot to an open-weight Qwen3.5-9B model remarkably well—even flipping a loss on the privacy benchmark (PUPA) into a decisive win (+5.4 points over GEPA) because ReAPO wrote cleaner, separated privacy boundaries.
Key Results
Across public benchmarks, ReAPO matches or outperforms MIPROv2 and GEPA while drastically cutting overhead:
- Massive Efficiency Gains: ReAPO uses 2.5× to 7.8× fewer evaluation rollouts. Across all six public benchmarks using GPT-4.1 Mini, total API optimization cost dropped from GEPA's $64.50 to $17.40, and wall-clock time (with a GPT-5 optimizer) shrank from 20.5 hours to 5.3 hours.
- Stronger Peak Scores: With GPT-5 optimizing for GPT-4.1 Mini, ReAPO beat GEPA with non-overlapping 95% confidence intervals on HoVer (59.1% vs. 54.6%), AIME (54.0% vs. 44.7%), and PUPA (93.1% vs. 91.1%).
- Open-Source Self-Optimization: Using a small dense model (Qwen3.5-9B) to optimize itself, ReAPO jumped AIME math accuracy from a 63.0% baseline to 72.0% (while GEPA regressed to 60.7%).
- Enterprise Wins: Under matched rollout budgets with GPT-5, ReAPO beat GEPA on three of the four tasks where prompts changed: Product Questions (+19.3 points), Meeting Management (+15.9), and SQL (+4.1).
Limitations and Future Work
- Single-Lineage Lock-in: Trading a population of candidates for a single greedy path saves huge compute, but has a blind spot. On Claim History (where GEPA beat ReAPO 90.3% to 80.2%), an early ReAPO edit accidentally told the agent to output plain text instead of using a required submission tool, and later rounds built on top of that mistake rather than recombining healthy candidates.
- Soft Protocol Adherence: Because the optimization loop is guided by a natural-language skill prompt rather than rigid code, weaker optimizer models can deviate from instructions or quit early.
- Fixed Round Budgets: Running a static $R = 5$ rounds risks under- or over-optimizing. The authors suggest future protocols should dynamically monitor training plateaus and stop automatically.
Summary updated