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.
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_many_shot-0.1.0.tar.gz.
File metadata
- Download URL: superred_optimizer_many_shot-0.1.0.tar.gz
- Upload date:
- Size: 207.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d750eeeb46221de54929ee32af1efe1447f274c0cbdf958087ca61bac2755293
|
|
| MD5 |
1c07f605f214897bb9a87ee149e3347d
|
|
| BLAKE2b-256 |
41c23a3b09774f2ebb6eabbcf17a1557afcceec081f0662c5f561e6659628539
|
Provenance
The following attestation bundles were made for superred_optimizer_many_shot-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_many_shot-0.1.0.tar.gz -
Subject digest:
d750eeeb46221de54929ee32af1efe1447f274c0cbdf958087ca61bac2755293 - Sigstore transparency entry: 2519650464
- Sigstore integration time:
-
Permalink:
RoldSI/superred-modules@8b933f0c46a6d8931656a454da738fdd702ca985 -
Branch / Tag:
refs/tags/superred-optimizer-many-shot-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@8b933f0c46a6d8931656a454da738fdd702ca985 -
Trigger Event:
push
-
Statement type:
File details
Details for the file superred_optimizer_many_shot-0.1.0-py3-none-any.whl.
File metadata
- Download URL: superred_optimizer_many_shot-0.1.0-py3-none-any.whl
- Upload date:
- Size: 203.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f670b42f677be576be2b514a2da3a5348fcee9558e3ccecaf8dc826875ec82a
|
|
| MD5 |
eaf5a7e747f001e87bb207e207df6179
|
|
| BLAKE2b-256 |
9d76a2a58b1114b73528e59021c8fb8076482442b4f30809b539c464d1d56046
|
Provenance
The following attestation bundles were made for superred_optimizer_many_shot-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_many_shot-0.1.0-py3-none-any.whl -
Subject digest:
5f670b42f677be576be2b514a2da3a5348fcee9558e3ccecaf8dc826875ec82a - Sigstore transparency entry: 2519650550
- Sigstore integration time:
-
Permalink:
RoldSI/superred-modules@8b933f0c46a6d8931656a454da738fdd702ca985 -
Branch / Tag:
refs/tags/superred-optimizer-many-shot-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@8b933f0c46a6d8931656a454da738fdd702ca985 -
Trigger Event:
push
-
Statement type: