Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

M3 — GEPA reflective prompt evolution

Paper: Agrawal, Tan, Soylu, Ziems, Khare, Opsahl-Ong, Singhvi, … Zaharia, Khattab — GEPA: Reflective Prompt Evolution Can Outperform Reinforcement Learning (ICLR 2026 Oral)

Linear: AGE-8 · Crate: chatty-optimize (offline) · Promotion: pending

Mechanism

Optimize prompts Π in a compound system Φ = (modules, control flow) under rollout budget B — weights frozen, no training stack required.

Three load-bearing details:

  1. Pareto candidate selection — keep every candidate best on ≥1 instance; prune dominated; sample proportional to win count. Ablating to greedy costs 6.4 aggregate points in the paper.
  2. FeedbackFn (µ_f) — scalar plus natural-language traces (compiler output, missing docs, failed constraints), optionally per module. Scalar-only = prompt shuffling.
  3. Reflective mutation — round-robin module updates; meta-prompt asks for domain-specific declarative instructions (not quasi-exemplars).

Optional Merge (GEPA+Merge): system-aware crossover, capped at 5 invocations, off by default (hurts some models).

Chatty mapping

Paper conceptChatty locationStatus
Module promptsModelConfig.preambleShips (user-editable)
Compound systemReAct loop (M1) or IrRepr (M2)M1 first; M2 later
Pareto archivechatty-optimizeTo build
select_candidatechatty-optimize/src/gepa/select.rsReserved
mergechatty-optimize/src/gepa/merge.rsReserved
REFLECTION_META_PROMPTchatty-optimize/src/gepa/prompts.rsReserved
Train vs validation rolloutschatty-trace budget viewTo build
Per-model costModelConfig.cost_per_million_*Ships

Product feature: “optimize this agent’s preamble against a task set you supply” — never in the chat request path.

Eval protocol

Stage 0 (AGE-23): synthetic task with known-optimal instruction recovered by one reflective mutation — separates broken code from broken reflection.

Stage A:

  • Pareto selection unit-tested against paper’s worked example
  • Module-level µ_f for multi-hop system
  • Rollout accounting splits train vs validation
  • Same optimizer runs against M1 system and M2 IrRepr (required before module done)

Stage B: HotpotQA, IFBench, HoVer, PUPA — the human reviewer posts numbers before agents cite them.

Production landing

MechanismLikely promotion
Full GEPA searchOffline / chatty-tui --optimize / CI (AGE-44)
Optimized preambleSetting per model
Apply optimized preambleReview UI / export / auto (AGE-45)
Merge operatorAblation flag, default off

Reserved symbols

select_candidate, merge, REFLECTION_META_PROMPT — see RESERVED.md.

Depends on

  • M0 Trace — FeedbackFn, budget split
  • M1 ReAct — first CompoundSystem (not blocked on M2)

Antagonist

M4 ACE argues against brevity-bias optimizers like GEPA — head-to-head in AGE-21 only.

Further reading