GEPA reflective prompt evolution optimizer for superred
Project description
superred-optimizer-gepa
A GEPA (Genetic-Pareto) reflective prompt evolution optimizer for the superred red-teaming framework.
GEPA treats the attack prompt as a single evolving candidate. Each superred run rolls out one candidate; at the end of a run, a separate reflection LM call inspects that rollout (score, target reply, evaluator feedback) and proposes a revised candidate for the next run to try. Across many runs this grows a small pool of candidates by reflective mutation rather than gradient-free search or manual prompt engineering.
Reference: Agrawal et al., "GEPA: Reflective Prompt Evolution Can Outperform
Reinforcement Learning," arXiv:2507.19457
(ICLR 2026). The reflective meta-prompt is reproduced verbatim from the
official gepa-ai/gepa reference
implementation (MIT-licensed) — see ASSUMPTIONS.md for the
exact source files and every deliberate departure this superred port makes
(all forced by superred's single-Goal, single-instance session model, where
GEPA's paper assumes a full training set to batch and Pareto-select over).
For an agent-target variant of this same reflective loop (surface discovery,
tool-return injection), see superred-optimizer-gepa-agentic.
Install
pip install superred-optimizer-gepa
Usage
from gepa_optimizer import GEPAOptimizer
optimizer = GEPAOptimizer(max_attempts=20)
Wire it into a Controller like any other superred optimizer — see the
framework's architecture overview and a
target's README (e.g. superred-target-chatbot) for a full Controller.run()
example.
Behaviour notes
- One run = one rollout of one candidate. The seed candidate is the adversarial goal's own description; each later candidate is proposed by the reflection LM from the best-scoring candidate's most recent rollout.
- Runs in all four adversarial information-access settings without a
setting flag. Settings without a score signal collapse candidate selection
to latest-wins on ties; settings with feedback drive score-based parent
selection and success early-stop.
max_no_signal_runs(disabled by default) bounds cost in the score-blind settings. - No acceptance test / single-instance Pareto. The paper's acceptance test
replays a candidate on a fixed minibatch before keeping it; superred's
single-
Goal, single-attempt-per-run model makes that replay impossible, so every rolled-out candidate enters the pool and parent selection collapses to current-best. Documented as a deliberate departure, not an oversight. - Reflection parse failures (malformed or missing fenced-code-block output) do not crash the run — the optimizer logs a warning and skips that mutation, keeping the previous best candidate as the parent.
License
MIT for this port's code. The reflective meta-prompt text is reproduced
verbatim from gepa-ai/gepa (MIT License, Copyright (c) 2025 Lakshya A
Agrawal and the GEPA contributors) — see the attribution comment in
src/gepa_optimizer/prompts.py and ASSUMPTIONS.md.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file superred_optimizer_gepa-0.1.0.tar.gz.
File metadata
- Download URL: superred_optimizer_gepa-0.1.0.tar.gz
- Upload date:
- Size: 28.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0bd9467a0968e58664a2b853961caf9cb14d0a837f4aa0feac8a133d265d663a
|
|
| MD5 |
7fef2875b6aabaf782ed3cf0132e11bb
|
|
| BLAKE2b-256 |
cf739ecdd3f8ce2b36933587d1205df7de16ef2cc278908118cc4d1241a88a3c
|
Provenance
The following attestation bundles were made for superred_optimizer_gepa-0.1.0.tar.gz:
Publisher:
release.yml on RoldSI/superred-modules
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
superred_optimizer_gepa-0.1.0.tar.gz -
Subject digest:
0bd9467a0968e58664a2b853961caf9cb14d0a837f4aa0feac8a133d265d663a - Sigstore transparency entry: 2214952139
- Sigstore integration time:
-
Permalink:
RoldSI/superred-modules@ff92389cd4ecc6690ecd16f410231274785c4afb -
Branch / Tag:
refs/tags/superred-optimizer-gepa-v0.1.0 - Owner: https://github.com/RoldSI
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ff92389cd4ecc6690ecd16f410231274785c4afb -
Trigger Event:
push
-
Statement type:
File details
Details for the file superred_optimizer_gepa-0.1.0-py3-none-any.whl.
File metadata
- Download URL: superred_optimizer_gepa-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f03eee0c4ccc0a807af7a25af1c02dc904e3e195efc01b9865c25d565689b8d
|
|
| MD5 |
67b767c587099e35d80690e312c4706c
|
|
| BLAKE2b-256 |
bdebaa10273a8caef59349ee1b03d9d4d0d68d4af52cf30484632a338706e55f
|
Provenance
The following attestation bundles were made for superred_optimizer_gepa-0.1.0-py3-none-any.whl:
Publisher:
release.yml on RoldSI/superred-modules
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
superred_optimizer_gepa-0.1.0-py3-none-any.whl -
Subject digest:
4f03eee0c4ccc0a807af7a25af1c02dc904e3e195efc01b9865c25d565689b8d - Sigstore transparency entry: 2214952165
- Sigstore integration time:
-
Permalink:
RoldSI/superred-modules@ff92389cd4ecc6690ecd16f410231274785c4afb -
Branch / Tag:
refs/tags/superred-optimizer-gepa-v0.1.0 - Owner: https://github.com/RoldSI
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ff92389cd4ecc6690ecd16f410231274785c4afb -
Trigger Event:
push
-
Statement type: