TL;DR
When we use an AI agent to automatically rewrite and improve prompts for other AI agents, there’s a quiet irony at play: the "optimizer" agent’s own system prompt is still hand-written by humans and frozen in time. SePO (Self-Evolving Prompt Optimization) closes this loop by letting the prompt optimizer rewrite its own instructions using the exact same evolutionary search it uses on downstream tasks. By turning prompt optimization from a static tool into a learnable, transferable skill, SePO boosts performance across everything from Olympiad math to Python coding—without touching a single model weight.
What Problem Does This Paper Address?
Suppose you want to make an LLM-based agent better at solving physics problems or writing code, without the massive expense of retraining its weights. A popular solution is system prompt optimization: you set up a second LLM—a prompt agent—to read evaluation feedback (where the task agent succeeded or failed) and propose better instructions.
Whether prior methods use evolutionary algorithms, meta-learning, or "textual gradients" (natural language critiques backpropagated like math gradients), they share an asymmetric blind spot. Only the task agent's prompt actually learns. Even methods with meta-layers (like PromptBreeder) top out at a fixed, human-written "hyper-prompt." Because the prompt agent itself never evolves, the ceiling of automated prompt engineering remains bounded by how clever a human prompt engineer was when designing the optimizer, and the optimizer never gets wiser as it sees more tasks.
Methods
The authors introduce self-referential closure: the realization that a prompt agent is just a special kind of task agent whose "task" is improving prompts. Therefore, one algorithm can optimize both.
SePO uses an open-ended evolutionary search over an archive of candidate prompts. Instead of greedily keeping only the newest prompt (linear search), maintaining an archive allows older, diverse prompts to act as "stepping stones" to escape local optima. In each generation, parent prompts are sampled, evaluated on batches of successes and failures (~1:1 ratio), and mutated into child prompts that enter the archive if they improve accuracy.
Borrowing from standard deep learning, SePO splits this into a two-stage pipeline:
- Stage 1: Pre-training (Self-Evolution). On a multi-task pool (
SePO-Generalist, chosen via a simple greedy heuristic), the prompt agent optimizes a copy of itself, evolving its seed prompt into a battle-tested optimizer prompt ($\tilde{p}^\star$). - Stage 2: Fine-tuning. Now frozen with $\tilde{p}^\star$, the evolved prompt agent runs the same evolutionary search to optimize a target task agent’s prompt ($p^\star$). Pre-training happens once, amortizing its cost across any number of future tasks.
Datasets
No new benchmarks are introduced. Evaluation spans five existing datasets covering distinct reasoning skills:
- AIME’25: High-school Olympiad math problems (integer answers).
- ARC-AGI-1: Abstract visual grid-to-grid transformation puzzles.
- GPQA: Graduate-level science questions (physics, chemistry, biology).
- MBPP: Python code synthesis evaluated against unit tests.
- Sudoku: $4\times 4$ logic puzzles checked by a constraint validator.
(Note: During multi-task pre-training mixture selection, the pool also draws on STEM and LIMO math tasks).
Key Insights and Ideas
- Prompt optimization is a transferable skill, not memorization: Even when tasks related to the target are removed from the pre-training mixture,
SePO-Generaliststill beats baselines. Remarkably, Sudoku was completely held out of all pre-training mixtures, yet accuracy jumped from 96.95% to 99.90%. - More pre-training tasks isn't always better: When testing task mixture sizes of $\{1, 2, 4, 8\}$, size 4 hit the sweet spot. Too few tasks miss complementary skills; too many dilute the signal and make it harder to consolidate one cohesive optimization strategy.
- Preserve what works, scaffold the rest: Qualitatively, the evolved prompt agent learned defensive principles—like guarding against chain-of-thought truncation and avoiding overfitting to specific test cases. Rather than rewriting seed prompts from scratch, it learned to preserve formatting rules while surgically injecting domain-specific guardrails (e.g., blocking
max/minnamespace collisions in Python, or checking for tokenizer-dropped characters in Sudoku).
Key Results
Using DeepSeek-V3.2 as the task agent and Gemini 3.1 Pro Preview as the prompt agent:
- Consistent SOTA:
SePO-Generalistachieved 76.38% average accuracy across all five tasks, beatingManual-CoT(71.89%, a +4.49 point gain),MetaSPO(71.32%), andTextGrad(70.39%). Notably, TextGrad and MetaSPO actually degraded performance below Manual-CoT on at least three tasks. - Generalist beats Specialist (for less money): Multi-task
SePO-Generalistoutperformed single-taskSePO-Specialist(74.09% avg.) while costing less overall—amortizing a single $37.14 pre-training run (~$7.43/task) plus $2.41–$15.51 in fine-tuning, comparable to or cheaper than TextGrad ($14.75–$26.52/task). - Both halves of the engine matter: Removing self-improvement dropped ARC-AGI-1 by 3.63 points; replacing open-ended archive evolution with linear search tanked AIME’25 by 6.98 points.
- Model-agnostic: Swapping the models to Gemini 3.1 Flash-Lite (task) and Claude Opus 4.6 (prompt) preserved the gains across every benchmark (+2.13 points average over Manual-CoT).
Limitations and Future Work
- Simple task selection: For assembling the pre-training task mixture, the authors rely on a basic greedy heuristic scored on two hard splits (AIME’25 and ARC-AGI-1), noting that dedicated multi-task grouping algorithms could be plugged in for further gains.
- System prompts only: SePO leaves model weights, external tools, and code workflows locked. For future work, the authors suggest expanding this exact self-referential, two-stage evolutionary blueprint so agents can rewrite and evolve their own tools, workflows, and broader system scaffolds.
Summary updated