Skip to content

Add artprompt transform for ASCII-art word masking.#5

Open
panditdhamdhere wants to merge 1 commit into
JailbrokenAI:mainfrom
panditdhamdhere:feat/artprompt-transform
Open

Add artprompt transform for ASCII-art word masking.#5
panditdhamdhere wants to merge 1 commit into
JailbrokenAI:mainfrom
panditdhamdhere:feat/artprompt-transform

Conversation

@panditdhamdhere

Copy link
Copy Markdown

Summary

Implements the artprompt transform from the improvement roadmap (Phase 0).

Based on ArtPrompt (Jiang et al., ACL 2024), the transform:

  1. Picks a likely trigger word (prefers terms from the existing NEUTRAL list, otherwise the longest substantive word)
  2. Masks it in the prompt with ?
  3. Appends a 5-line block-letter ASCII art rendering of that word

This lets the harness evaluate vision-in-text jailbreak resistance via parseltongue / query_target transform chains.

Changes

  • wallbreaker/transforms/ascii_art.py — new artprompt_encode() implementation
  • wallbreaker/transforms/__init__.py — register as one-way, lossy transform
  • tests/test_transforms.py — unit test for masking + ASCII art output

Test plan

  • pytest tests/test_transforms.py -q (76 passed)
  • pytest tests/test_transforms.py tests/test_target_encode.py tests/test_extra_features.py -q (94 passed)
  • Full suite (pytest -q) on maintainer CI

Notes

  • Technique is attributed to the ArtPrompt paper; no novelty claimed.
  • Uses a built-in block font (no new dependencies).
  • Masks one trigger word per call, matching the paper's per-masked-prompt pattern.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant