SePO: Self-Evolving Prompt Agent for System Prompt Optimization

Tao Wangcheng, Han Wu, Weng-Fai WongNeurIPS 2026

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.

Figure 1: Self-referential design in system prompt optimization. (a) Common prompt optimization methods leave the prompt agent hand-engineered, so the optimization loop never includes the prompt agent itself. (b) PromptBreeder introduces a meta-stack but its top stays fixed, leaving the loop bounded but never closed. (c) Under SePO’s self-referential design, the same procedure refines both task agents’ system prompts and the prompt agent’s own, closing the loop.

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:

  1. 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$).
  2. 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.
Figure 2: Overview of SePO’s two-stage training pipeline. Pre-training (left) evolves the prompt agent’s own system prompt ˜p through open-ended evolutionary search, maintaining an archive of candidate prompts as stepping stones. The pre-training task pool is either a single task (SePO- Specialist) or a multi-task mixture (SePO-Generalist; see Section 3.3). Fine-tuning (right) reuses the resulting ˜p⋆to optimize a task agent’s system prompt p on a target task, again through open-ended evolutionary search.

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-Generalist still 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/min namespace collisions in Python, or checking for tokenizer-dropped characters in Sudoku).
Figure 4: Generalization with and without re- lated pre-training tasks. Per-task test accuracy of SePO-Generalist under two pre-training set- tings: w/ related task when the pre-training mix- ture contains a task related to the target, and w/o related task when it does not. Sudoku is held out of every pre-training mixture (gray bar). Manual- CoT shown as a dashed reference line.

Key Results

Using DeepSeek-V3.2 as the task agent and Gemini 3.1 Pro Preview as the prompt agent:

  • Consistent SOTA: SePO-Generalist achieved 76.38% average accuracy across all five tasks, beating Manual-CoT (71.89%, a +4.49 point gain), MetaSPO (71.32%), and TextGrad (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-Generalist outperformed single-task SePO-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

Abstract

System prompt optimization improves agent behavior without modifying the underlying model, yielding human-readable, model-agnostic instructions. Existing methods build a prompt agent that refines task agents' system prompts, yet leave the prompt agent's own system prompt hand-engineered and fixed. We propose Self-Evolving Prompt Optimization (SePO), which treats the prompt agent's own system prompt as an optimization target alongside task agents' system prompts. SePO adopts a self-referential design. A single prompt agent improves both task agents' system prompts and its own under an open-ended evolutionary search that maintains an archive of candidate prompts as stepping stones. Training proceeds in two stages: pre-training evolves the prompt agent on a multi-task pool, and fine-tuning then applies it to a target task. Across five benchmarks spanning math (AIME'25), abstract reasoning (ARC-AGI-1), graduate-level science (GPQA), code generation (MBPP), and logic puzzles (Sudoku), SePO consistently outperforms Manual-CoT, TextGrad, and MetaSPO, improving the average accuracy by $4.49$ points compared to Manual-CoT. The prompt optimization skill from pre-training also generalizes to tasks beyond the pre-training mixture, rather than memorizing per-task prompts.
BibTeX
@inproceedings{wangcheng2026sepo,
  author = {Tao Wangcheng and Han Wu and Weng-Fai Wong},
  title = {{SePO: Self-Evolving Prompt Agent for System Prompt Optimization}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=cJX1IpMwgF},
}
Figure