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.
Metadata
Release files for superred-optimizer-gepa 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| superred_optimizer_gepa-0.1.0.tar.gz | 28.6 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| superred_optimizer_gepa-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 43.9 kB
Release files / superred_optimizer_gepa-0.1.0.tar.gz
| Download URL | superred_optimizer_gepa-0.1.0.tar.gz |
|---|---|
| Size | 28.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0bd9467a0968e58664a2b853961caf9cb14d0a837f4aa0feac8a133d265d663a
|
|
BLAKE2b-256 checksum How to use checksums |
cf739ecdd3f8ce2b36933587d1205df7de16ef2cc278908118cc4d1241a88a3c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 21, 2026.
Transparency logRelease files / superred_optimizer_gepa-0.1.0-py3-none-any.whl
| Download URL | superred_optimizer_gepa-0.1.0-py3-none-any.whl |
|---|---|
| Size | 15.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4f03eee0c4ccc0a807af7a25af1c02dc904e3e195efc01b9865c25d565689b8d
|
|
BLAKE2b-256 checksum How to use checksums |
bdebaa10273a8caef59349ee1b03d9d4d0d68d4af52cf30484632a338706e55f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 21, 2026.
Transparency logSecurity for superred-optimizer-gepa 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for superred_optimizer_gepa-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 21, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.