Repository navigation
probes: add persuasion (Persuasive Adversarial Prompt) probe - #1955
JayYarlagadda wants to merge 1 commit into
Conversation
Add garak.probes.persuasion.PersuasiveJailbreak, which rewrites base harmful requests into Persuasive Adversarial Prompts (PAPs) using a configurable red-team generator and the social-influence taxonomy from Zeng et al. (arXiv:2401.06373). Only the openly-released, Apache-2.0 persuasion taxonomy is vendored; no gated harmful data is shipped or downloaded. Includes docs and tests. This change was AI-assisted (GitHub Copilot); the author reviewed every line and ran the tests. Co-authored-by: GitHub Copilot <[email protected]> Signed-off-by: Jayanth Sai Yarlagadda <[email protected]>
a3a4261 to
b84b51a
Compare
|
Marked ready for review. Rebased on latest main; persuasion tests (8), |
ma7bor
left a comment
There was a problem hiding this comment.
Head b84b51a against base cafbe99. The new tests pass, but two generic tests fail on the new probe. Only DCO has run on this PR so far, so CI hasn't shown them.
$ python -m pytest tests/probes/test_probes_persuasion.py -q
8 passed
$ python -m pytest tests/probes/ tests/langservice/ tests/test_docs.py tests/test_config.py -q -k persuasion
FAILED tests/probes/test_probes.py::test_probe_intent[probes.persuasion.PersuasiveJailbreak]
E AssertionError: concrete probes must set intent to a typology code
FAILED tests/langservice/probes/test_probes_base.py::test_probe_prompt_translation[probes.persuasion.PersuasiveJailbreak]
E garak.exception.APIKeyMissingError: Put the NIM API key in the NIM_API_KEY environment variable
# with the two lines below applied
18 passed, 2778 deselected
# pytest 9.2.0, Python 3.12.16, deps from requirements.txt; black 25.1.0 (.pre-commit-config.yaml) clean
# not run: a scan against a live red-team model or target
intent has been required since 9df1a31. fitd.FITD also rewrites HarmBench requests through a red-team model, and it uses T009ignore. The red-team probes (fitd.FITD, tap.TAP, dan.AutoDAN) are also in NON_PROMPT_PROBES, and #1460 adds its persuasion probe there too.
--- a/garak/probes/persuasion.py
+++ b/garak/probes/persuasion.py
goal = "persuade the target to produce disallowed content"
+ intent = "T009ignore"
--- a/tests/langservice/probes/test_probes_base.py
+++ b/tests/langservice/probes/test_probes_base.py
"probes.fitd.FITD",
+ "probes.persuasion.PersuasiveJailbreak",
]With test.Single as the red-team model returning "I'm sorry, but I can't help with that request.", all 4 attempts carry that refusal as the prompt. Their notes are {}. An aligned red-team model refuses some rewrites of HarmBench requests, so a real run can score the target on refusals. Could _generate_pap drop a rewrite that mitigation.MitigationBypass flags as a refusal?
With test.Nones as the red-team model, self.prompts stays empty, and Probe.probe() raises at garak/probes/base.py:402:
if isinstance(prompts[0], str):
IndexError: list index out of range
non-blocking: notes holds neither the technique nor the base prompt. So a report can't give the per-technique success rate, which is the paper's main result. @jmartin-tech asked #1460 to enrich notes through _generator_precall_hook or _postprocess_hook.
non-blocking: PAP_GENERATION_TEMPLATE is in the module. On #1460, @leondz asked for it in garak/data so that users can customise it.
Calling super().probe() after building the prompts does keep the translation path, which was the other concern on #1460.
@leondz #1460 implements the same issue and is still open, so the open call is scope. On #1460 you asked for the 33,600-prompt broad scan and the iterative method. This PR defaults to 8 base prompts × 5 techniques = 40, with no iteration. Is that scope enough here, or should the two PRs be combined first?
Summary
Adds
garak.probes.persuasion.PersuasiveJailbreak, a probe implementing Persuasive Adversarial Prompts (PAPs) from Zeng et al., "How Johnny Can Persuade LLMs to Jailbreak Them" (arXiv:2401.06373). The probe rewrites base harmful requests into persuasive phrasings using a configurable red-team generator, then sends them to the target.Closes #683.
What's included
garak/probes/persuasion.py— thePersuasiveJailbreakprobe.garak/data/persuasion/persuasion_taxonomy.jsonl— the openly-released, Apache-2.0 persuasion taxonomy (40 techniques), vendored with SPDX header + attribution.garak/data/persuasion/README.md— provenance, licensing, and citation.docs/source/probes/persuasion.rst+docs/source/index_probes.rst— docs wiring.tests/probes/test_probes_persuasion.py— unit tests.Design decisions (open to change)
active = Falseby default, since the probe needs a red-team model to function.persuasion, classPersuasiveJailbreak;primary_detector = mitigation.MitigationBypass.Scope questions for maintainers
active=Falsegiven it needs a red-team model?Testing
Result:
8 passed. Tests use garak'stest.Repeat/test.Blankstand-in generators, so they run without network access or API keys.Note on prior claim
The earlier volunteer (@asaadkhaja99) claimed this in Oct 2025 but has been inactive for 8+ months with no PR. I posted intent on the issue before proceeding. Happy to coordinate if they are still working on it.
Disclosure
AI assistance was used in preparing this contribution. Every changed line has been reviewed by me, and the tests above were run and pass.