Skip to main content

superred-optimizer-dra

A DRA (Disguise and Reconstruction Attack) jailbreak optimizer for the superred red-teaming framework.

DRA has two halves. Disguise hides the harmful request one character at a time inside ordinary cover words, where the real character is the one wrapped in parentheses. Reconstruction then asks the target to pull those parenthesized characters out, rebuild the hidden request, and answer it directly — so the model assembles and answers the request itself rather than being asked it openly.

Reference: Liu et al., "Making Them Ask and Answer: Jailbreaking Large Language Models in Few Queries via Disguise and Reconstruction," arXiv:2402.18104 (USENIX Security 2024). Official implementation: LLM-DRA/DRA (MIT License). See ASSUMPTIONS.md for the full paper-to-code mapping and every deliberate departure.

Install

DRA depends on Detoxify to decide which guide words are sensitive; it is a normal dependency of this package and is installed automatically.

pip install superred-optimizer-dra

If Detoxify cannot load in a constrained environment, the optimizer falls back to the official static sensitive-word list so the attack can still run.

Usage

from dra_optimizer import DraOptimizer

# Defaults follow the official script (T=20 retries, em_t=0.7 exact match,
# toxic_trunc=benign_trunc=0.5).
optimizer = DraOptimizer()

# A visible target model name auto-selects the GPT or Llama suffix family;
# override explicitly if you prefer.
optimizer = DraOptimizer(model="gpt", max_attempts=10)

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). The upstream reference implementation, LLM-DRA/DRA, is MIT licensed. The bundled behaviors.json originates from that repository; its MIT copyright notice is preserved in NOTICE and LICENSES/DRA-MIT.txt. This port reimplements the DRA prompt-generation structure against superred's event model rather than vendoring upstream source files. Detoxify is a third-party dependency under its own license.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

superred_optimizer_dra-0.1.0.tar.gz (22.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

superred_optimizer_dra-0.1.0-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file superred_optimizer_dra-0.1.0.tar.gz.

File metadata

  • Download URL: superred_optimizer_dra-0.1.0.tar.gz
  • Upload date:
  • Size: 22.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for superred_optimizer_dra-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4d90b143dc49fd5c5c93a4d8927b59b670b38c279565ddfda6ad39e28beaf006
MD5 70410a97e1e25f3b2d31f99e3ea5c752
BLAKE2b-256 8cd434e1400f1c603e5e8ae8681685e900c0b0f898fabbdf2cae6b3579b57791

See more details on using hashes here.

Provenance

The following attestation bundles were made for superred_optimizer_dra-0.1.0.tar.gz:

Publisher: release.yml on RoldSI/superred-modules

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file superred_optimizer_dra-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for superred_optimizer_dra-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3165dfcc5f5ea38c4dd43f442f392ede17356cc20ba5ed7731f0b4445e7fc6da
MD5 2ce22e820781cd4397b6f66551fe0ac9
BLAKE2b-256 37d9f5674c12f9428b8ced2f3cf0e5b2df2b11d9488c6f96f2b91909fa11322c

See more details on using hashes here.

Provenance

The following attestation bundles were made for superred_optimizer_dra-0.1.0-py3-none-any.whl:

Publisher: release.yml on RoldSI/superred-modules

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page