probe: add simple adaptive attacks probe#1742
Conversation
|
DCO Assistant Lite bot All contributors have signed the DCO ✍️ ✅ |
|
Thank you @neerazz, will take a look |
jmartin-tech
left a comment
There was a problem hiding this comment.
A suggestion not a full review. The desire to support Full probes is somewhat in limbo as they create duplication when activated at the same time as the restricted versions.
|
I have read the DCO Document and I hereby sign the DCO |
Implements AdaptiveAttacks and AdaptiveAttacksFull probes based on
Andriushchenko, Croce, and Flammarion, "Jailbreaking Leading
Safety-Aligned LLMs with Simple Adaptive Attacks" (ICML 2024,
arXiv:2404.02151).
The v1 probe is template-only: it combines a paraphrased adaptive
prompt template (direct-assistant role + structured response scaffold
+ no-"I" affirmative-opener constraint) with a small cached set of
seed forbidden behaviors and pre-computed adversarial suffixes drawn
from public AdvBench results. No gradient computation or online
search is performed.
- garak/probes/adaptiveattacks.py: AdaptiveAttacks (active, capped)
and AdaptiveAttacksFull (uncapped, opt-in)
- garak/data/adaptive_attacks/{seeds,suffixes}.txt: 20 seeds,
3 suffix variants
- tests/probes/test_probes_adaptiveattacks.py: 8 tests covering
load, prompt content, template markers, and prompt-cap behavior
Smoke run against test.Blank completes without error.
Closes NVIDIA#583.
Signed-off-by: Neeraj Kumar Singh <[email protected]>
263fb39 to
4a507c7
Compare
|
Thanks for the review @jmartin-tech. Pushed two fixes: 1. CI failure ( 2. |
Address @jmartin-tech review on NVIDIA#1742: (a) Use the canonical follow_prompt_cap guard pattern (per NVIDIA#1546/NVIDIA#1562 + encoding.py / latentinjection.py) instead of an unconditional self._prune_data() call. (b) Add DEFAULT_PARAMS override on AdaptiveAttacksFull to flip follow_prompt_cap to False, replacing the previous Probe.__init__ bypass. This makes the no-cap behavior a configurable param rather than a constructor hack, matches how every other Full variant in the repo expresses uncapped intent, and lets users re-enable the cap on Full via config if they want. AdaptiveAttacks: follow_prompt_cap=True -> prunes to soft_probe_prompt_cap AdaptiveAttacksFull: follow_prompt_cap=False -> keeps every (seed, suffix) pair All 8 tests in tests/probes/test_probes_adaptiveattacks.py still pass, plus tests/test_docs.py adaptive cases (4) and the broader probe suite (1130 passing; the 1 remaining failure is the pre-existing audio probe optional-deps issue unrelated to this PR). Signed-off-by: Neeraj Kumar Singh <[email protected]>
Address @jmartin-tech review on NVIDIA#1742: (a) Use the canonical follow_prompt_cap guard pattern (per NVIDIA#1546/NVIDIA#1562 + encoding.py / latentinjection.py) instead of an unconditional self._prune_data() call. (b) Add DEFAULT_PARAMS override on AdaptiveAttacksFull to flip follow_prompt_cap to False, replacing the previous Probe.__init__ bypass. This makes the no-cap behavior a configurable param rather than a constructor hack, matches how every other Full variant in the repo expresses uncapped intent, and lets users re-enable the cap on Full via config if they want. AdaptiveAttacks: follow_prompt_cap=True -> prunes to soft_probe_prompt_cap AdaptiveAttacksFull: follow_prompt_cap=False -> keeps every (seed, suffix) pair All 8 tests in tests/probes/test_probes_adaptiveattacks.py still pass, plus tests/test_docs.py adaptive cases (4) and the broader probe suite (1130 passing; the 1 remaining failure is the pre-existing audio probe optional-deps issue unrelated to this PR). Signed-off-by: Neeraj Kumar Singh <[email protected]>
|
Just pushed a85aa90 which applies the canonical pattern more directly per your earlier suggestion:
Local verification (Python 3.12): 8/8 |
|
Friendly nudge — wanted to make this easy to action on whatever timeline works. State recap as of today:
Two simple paths from here, whichever you prefer:
Happy to do either. Just let me know which shape you'd rather merge. |
|
Simplified to a single probe per the earlier feedback thread — dropped What changed:
Uncapped runs still possible via This matches option 2 from my earlier comment. All 16 CI checks were green on the previous commit; no functional change to |
AdaptiveAttacksFull was inactive by default (active=False) to prevent prompt duplication when both probes run together. Removing it entirely gives the same safety guarantee with a simpler surface: one probe, one configurable cap, no opt-in class to maintain. AdaptiveAttacks keeps follow_prompt_cap=True and the soft_probe_prompt_cap guard. Uncapped runs remain possible via --config follow_prompt_cap=false. Signed-off-by: Neeraj Kumar Singh <[email protected]>
3ceba9b to
c2f2ae3
Compare
|
Fixed DCO sign-off. Amended commit `3ceba9b` → `c2f2ae3` to add the missing `Signed-off-by` line: ``` Force-pushed to `probe-adaptive-attacks-583`. DCO check should now pass. @jmartin-tech @leondz — ready for your review when you have a chance. |
jmartin-tech
left a comment
There was a problem hiding this comment.
One minor tweak and an information request.
Do you know of a target within the last year that will show a rate of successful attack from this probe?
c2f2ae3 to
90eb9f9
Compare
New probes should have no aliases; aliases are for tracking renamed probes. Addresses @jmartin-tech review feedback. Signed-off-by: Neeraj Kumar Singh <[email protected]>
|
Thanks for the review, @jmartin-tech! Alias tweak (commit Recent target with measurable success rate: The technique this probe implements (adaptive template + cached suffix) is directly from Andriushchenko, Croce, and Flammarion (ICML 2024, arxiv:2404.02151). The paper reports concrete attack success rates against several safety-aligned models that remain in active deployment today: GPT-3.5-turbo, GPT-4, Gemini Pro, and Llama-2-7B/13B-chat. Those are the primary documented targets with published success rates. For a more recent reference: within the past year, Meta Llama 3 variants (released April 2024) and derivative fine-tuned models have been widely studied as jailbreak targets and are commonly used in garak evaluation runs against this class of prompt-injection attack. Standard RLHF safety training without specific defenses against template-based adaptive prompting continues to show non-trivial attack success rates with this technique. If you'd prefer a specific success rate number on a 2025-era model, I can run the probe against an open-source model (e.g., Llama-3.1-8B-Instruct) and report the output — but I didn't want to delay the PR for that if the paper's citations and the broader Llama 3 evaluation context are sufficient for your purposes. Let me know. |
|
Hi @jmartin-tech — wanted to follow up since my Jun 9 response may have gotten buried. All items from your review are addressed:
On your question about a recent target with measurable success rate — I replied with references to the ICML 2024 paper targets (GPT-3.5/4, Gemini Pro, Llama-2) and Llama 3 variants. If you'd find it more useful to have a direct number from running the probe against Llama-3.1-8B-Instruct, I'm happy to do that before you close the review — just say the word. Whenever you get a chance to re-review, I'd really appreciate it. Thanks again for the detailed feedback that made this a cleaner, simpler probe. |
jmartin-tech
left a comment
There was a problem hiding this comment.
Testing looks good, couple minor revisions.
I can make these adjustment before landing if all are in agreement.
|
Thanks @jmartin-tech — those revisions sound good to me. Please feel free to make the adjustments before landing. |
Signed-off-by: Jeffrey Martin <[email protected]>
f4e7bcf to
a462062
Compare
|
Minor adjustment pushed, maintainer discussion landed on naming convention as |
Summary
Implements
adaptiveattacks.AdaptiveAttacksandadaptiveattacks.AdaptiveAttacksFullbased on Andriushchenko, Croce, and Flammarion, "Jailbreaking Leading Safety-Aligned LLMs with Simple Adaptive Attacks" (ICML 2024, arXiv:2404.02151).The v1 probe is template-only: it combines a paraphrased adaptive prompt template (direct-assistant role + structured response scaffold + no-
Iaffirmative-opener constraint) with a small cached set of seed forbidden behaviors and pre-computed adversarial suffixes drawn from public AdvBench results. No gradient computation or online search is performed.Files
garak/probes/adaptiveattacks.py—AdaptiveAttacks(active, capped viasoft_probe_prompt_cap) andAdaptiveAttacksFull(uncapped, opt-in)garak/data/adaptive_attacks/seeds.txt— 20 seed forbidden behaviorsgarak/data/adaptive_attacks/suffixes.txt— 3 cached adversarial suffix variantstests/probes/test_probes_adaptiveattacks.py— 8 tests covering load, prompt content, template markers, prompt-cap behaviorEngagement context
The original ticket #583 was soft-claimed by @enesyesil on 2025-09-17. After 7 months without a PR, I posted a polite check-in on 2026-04-28 (comment) saying I would proceed in 7 days unless they responded. No response received. Happy to step aside if @enesyesil resumes or @leondz prefers a different approach.
Test plan
pytest tests/probes/test_probes_adaptiveattacks.py -v— 8/8 passgarak --list_probes | grep adaptiveattacks— both classes registered, default-active marker showngarak --probes adaptiveattacks.AdaptiveAttacks --model_type test.Blank— completes in 1.42s with no errors-s; will sign CA on bot promptScope
v1 is intentionally minimal (single template + cached suffixes) per "good first issue" sizing. Future variants (random-search suffix optimization, GCG-style gradient suffix, multi-turn self-transfer) can land as follow-up PRs.
Closes #583.