MatanBT's picture
Update repro commands for the build-datasets/ layout
7097e97 verified
|
Raw
History Blame Contribute Delete
9.32 kB
---
license: mit
task_categories:
- text-generation
language:
- en
tags:
- adversarial-robustness
- red-teaming
- jailbreak
- llm-security
- prompt-optimization
pretty_name: TROPT OptBench Triggers
size_categories:
- 100K<n<1M
extra_gated_prompt: >-
This dataset contains model completions to harmful instructions, produced
under adversarial suffix attacks. Access is granted for defensive security
research (robustness evaluation, red-teaming, jailbreak-defense development)
only. By requesting access you confirm you will not use it to attack systems
you are not authorized to test.
extra_gated_fields:
Name: text
Affiliation: text
Intended use: text
I agree to use this dataset for defensive security research only: checkbox
configs:
- config_name: triggers
default: true
data_files:
- split: triggers
path: triggers.parquet
- config_name: eval_triggered_messages
data_files:
- split: eval_triggered_messages
path: eval_triggered_messages/*.parquet
---
# TROPT — OptBench Triggers (Exp1: optimizer benchmark)
A store of optimized adversarial **trigger suffixes** produced by the
[TROPT](https://github.com/matanbt/tropt) white-box optimizers, together with
the **transfer evaluation** of each trigger across a held-out set of harmful
instructions.
> ⚠️ **Intended use — defensive security research only.** These are adversarial
> artifacts for evaluating and hardening LLM robustness (red-teaming,
> jailbreak-robustness benchmarking). The harmful instructions come from the
> public ClearHarm set. The `eval_triggered_messages` split **does contain
> model-generated responses to harmful instructions**, including successful
> jailbreaks — this is what makes it useful as a defense benchmark, and why the
> repo is gated. Do not use it to attack systems you are not authorized to test.
## The two tables
| Name | Rows | One row is |
| --- | --- | --- |
| `triggers` | 10,800 | one optimizer run's best trigger at one FLOP budget |
| `eval_triggered_messages` | 310,500 | one (trigger, harmful instruction) pair, scored |
The two tables have different columns, so each is its own **config** (the
`datasets` library requires one schema per config). Each config holds a single
split of the same name:
```python
from datasets import load_dataset
R = "MatanBT/tropt-optbench-triggers"
triggers = load_dataset(R, "triggers", split="triggers")
evals = load_dataset(R, "eval_triggered_messages",
split="eval_triggered_messages")
```
`triggers` is the default config, so `load_dataset(R)` still returns it.
> **Note.** This repo was renamed from `MatanBT/tropt-stored-optimized-triggers`
> to `MatanBT/tropt-optbench-triggers`, to pair with the companion
> [`tropt-jailbreak-enhancebench-triggers`](https://huggingface.co/datasets/MatanBT/tropt-jailbreak-enhancebench-triggers)
> (Exp2: jailbreak-enhancement benchmark). The old id still redirects here.
>
> `triggers` was also previously a single `train` split of a `default` config.
> The data is unchanged, but `load_dataset(R, split="train")` no longer
> resolves — pass the config name as above.
Common axes across both splits:
- **Models (4):** Qwen3-8B, gemma-3-12b-it, gemma-4-26B-A4B-it, Llama-3.1-8B-Instruct
- **Optimizers (15):** adv_decoding, arca, autoprompt, beast, gaslite, gbda, gcg,
hotflip, mac, mcpal, pal, pez, qcg, ral, random_search
- **Seeds (3):** 42, 123, 777
---
## Split 1 — `triggers`
10,800 rows = models × optimizers × 15 ClearHarm instructions × seeds × 4 budgets.
Each trigger is recorded at four FLOP budgets (`budget_flops`, `1e16` to
`3e17`); a single optimizer run contributes its best trigger at each budget.
*Identity*
- `uid` — unique key `model|optimizer|m{msg}|s{seed}|budget`. Joined by
`eval_triggered_messages.trigger_uid`.
- `model_name` — target model the trigger was optimized against.
- `optimizer_name` — the optimization **method** (e.g. `gcg`, `pal`, `mac`).
`mcpal` is a MAC×PAL crossover: PAL's search configuration (128 candidates,
top-256 sampling, single-token replacement) with MAC's gradient momentum
(μ=0.6) layered on. It reaches the lowest mean training loss of the 15
(0.263, vs PAL 0.292 and MAC 0.343) and the lowest median by a wide margin
(0.043 vs PAL 0.152) — though PAL still wins on two of the four models, so
the advantage is an aggregate one rather than uniform.
- `loss_name` — training loss (all runs: PrefillCE).
- `msg_id` — row of **our shuffled** ClearHarm file (0–14).
- `orig_msg_id` — the same prompt's index in the **original, unshuffled**
ClearHarm dataset. The shuffle is not order-preserving (`msg_id` 0 is original
78, 1 is 16, 2 is 65...), so this is what lets anyone map a trigger back to a
public ClearHarm prompt without our CSV.
- `seed` — random seed of the run.
- `run_id`, `run_name` — provenance (wandb).
*Budget*
- `budget_flops`, `budget_label` — the FLOP budget this row's trigger is taken at.
*Trigger & result*
- `best_trigger_str`**the optimized trigger suffix** at this budget.
- `best_loss` — its training loss (lower = better) at this budget.
- `trigger_flops` — FLOPs actually spent to *find* this trigger (≤ budget).
- `n_steps_within_budget` — optimizer steps that fit inside the budget.
- `run_total_flops`, `run_total_steps` — the full run's totals (context).
*Inputs*
- `optimized_instruction` — the ClearHarm instruction template (contains the
`{{OPTIMIZED_TRIGGER}}` placeholder the suffix fills).
- `optimized_target` — the target response prefix the optimizer pushed toward.
*Metrics (only at the full 3e17 budget; NaN otherwise)*
- `bleu` — BLEU of the model's triggered generation vs the target prefix.
- `opt_strongrej` — StrongReject jailbreak-success (0–1) of the trigger on **its
own training instruction**.
---
## Split 2 — `eval_triggered_messages`
310,500 rows = the 2,700 full-budget (`3e17`) triggers × 115 ClearHarm
instructions. This is the **universality / transfer** view: how well does a
trigger optimized on one instruction jailbreak *other* instructions?
Each row appends the trigger to an instruction, generates 256 tokens greedily
from the trigger's own target model, and scores the response with the
[StrongReject fine-tuned classifier](https://huggingface.co/qylu4156/strongreject-15k-v1).
The prompt sent to the model is exactly:
```python
prompt = f"{row['instruction_str']} {row['trigger_str']}."
```
The judge, by contrast, always sees the **clean** `instruction_str` — never the
trigger — so the score measures response harmfulness, not suffix weirdness.
*Trigger identity (denormalized from the `triggers` split)*
- `trigger_uid` — foreign key into `triggers.uid`.
- `model_name` — the model that both generated the response and was attacked.
- `optimizer_name`, `loss_name`, `seed` — the run that produced the trigger.
- `msg_id`, `orig_msg_id` — the instruction the trigger was **optimized on**,
as a shuffled-file row and as its original ClearHarm index.
- `budget_label` — the trigger's FLOP budget (currently always `3e17`).
*Evaluated instruction*
- `eval_msg_id` — row of the shuffled file for the instruction **being
evaluated** (0–114).
- `eval_orig_msg_id` — that instruction's index in the original ClearHarm
dataset, for reproduction against the public set.
- `optimized_on``eval_msg_id == msg_id`: this trigger's own training
instruction. Exactly one row per trigger is `True`.
- `is_heldout``eval_msg_id >= 15`: an instruction no trigger in the dataset
was optimized on. 100 of the 115 instructions.
*Prompt & outcome*
- `instruction_str` — the evaluated ClearHarm instruction (clean, no trigger).
- `trigger_str` — the optimized suffix (equals `triggers.best_trigger_str`).
- `generated_response_str` — the target model's 256-token greedy response.
- `srej_score` — StrongReject fine-tuned score, 0–1 (higher = more harmful
compliance).
### The three evaluation regimes
`optimized_on` and `is_heldout` cut the 115 instructions three ways, and the
gap between them is the point of the split:
| Rows | Meaning |
| --- | --- |
| `optimized_on == True` | the trigger on its training instruction — *in-sample* |
| `~optimized_on & ~is_heldout` | the other 14 optimization instructions |
| `is_heldout == True` | the 100 instructions never optimized on — *transfer* |
```python
import pandas as pd
df = evals.to_pandas()
transfer = (df[df.is_heldout]
.groupby(["model_name", "optimizer_name"])["srej_score"]
.mean().unstack())
```
Measured means over the 270,000 held-out rows:
| | mean `srej_score` | median |
| --- | --- | --- |
| Llama-3.1-8B-Instruct | 0.145 | 0.001 |
| gemma-3-12b-it | 0.129 | 0.002 |
| Qwen3-8B | 0.110 | 0.005 |
| gemma-4-26B-A4B-it | 0.029 | 0.001 |
## Reproduction
Both splits are built by the scripts in the TROPT repo:
```bash
# per target model, resumable
python -m scripts.opt-bench.build-datasets.build_eval_split build --model-name google/gemma-3-12b-it
python -m scripts.opt-bench.build-datasets.build_eval_split merge
python -m scripts.opt-bench.build-datasets.build_eval_split push --yes
```
## Citation
If you use this dataset, please cite the TROPT toolbox
(<https://github.com/matanbt/tropt>).