superred-optimizer-many-shot
A Many-Shot Jailbreaking single-turn optimizer for the superred red-teaming framework.
Community port — not an official implementation. This module is an unofficial re-implementation of Many-shot Jailbreaking (Anil et al., Anthropic) for superred. It is not affiliated with, endorsed by, or maintained by the original authors. See ASSUMPTIONS.md for every deliberate deviation from the paper and reference code.
Many-shot jailbreaking abuses long context windows. It builds one prompt packed with many faux user/assistant exchanges in which the assistant always complies with a harmful request, then appends the real objective as the final user turn. Faced with a long run of "compliant" examples, the model tends to continue the pattern and comply too.
Reference: Anil et al., "Many-shot Jailbreaking," Anthropic, April 2024 (research page, PDF; later NeurIPS 2024). There is no official code release; this is an independent implementation from the paper. See ASSUMPTIONS.md for the full paper-to-code mapping and every deliberate departure.
Install
pip install superred-optimizer-many-shot
Usage
from many_shot_optimizer import ManyShotOptimizer
# Default: one 256-shot attempt (matches the paper's main many-shot setup).
optimizer = ManyShotOptimizer()
# Sweep the number of shots across staged runs.
optimizer = ManyShotOptimizer(example_counts=[32, 64, 128, 256, 400, 512])
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.
License
MIT for this port's code (see LICENSE). Many-shot jailbreaking was published by Anthropic without an official code release, so there is no upstream repository to vendor from; this module is an independent implementation of the technique described in the paper.
Metadata
Release files for superred-optimizer-many-shot 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_many_shot-0.1.0.tar.gz | 207.2 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| superred_optimizer_many_shot-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 410.2 kB
Release files / superred_optimizer_many_shot-0.1.0.tar.gz
| Download URL | superred_optimizer_many_shot-0.1.0.tar.gz |
|---|---|
| Size | 207.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d750eeeb46221de54929ee32af1efe1447f274c0cbdf958087ca61bac2755293
|
|
BLAKE2b-256 checksum How to use checksums |
41c23a3b09774f2ebb6eabbcf17a1557afcceec081f0662c5f561e6659628539
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.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 Aug 19, 2026.
Transparency logRelease files / superred_optimizer_many_shot-0.1.0-py3-none-any.whl
| Download URL | superred_optimizer_many_shot-0.1.0-py3-none-any.whl |
|---|---|
| Size | 203.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5f670b42f677be576be2b514a2da3a5348fcee9558e3ccecaf8dc826875ec82a
|
|
BLAKE2b-256 checksum How to use checksums |
9d76a2a58b1114b73528e59021c8fb8076482442b4f30809b539c464d1d56046
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.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 Aug 19, 2026.
Transparency logSecurity for superred-optimizer-many-shot 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_many_shot-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 Aug 19, 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.