System 1 prompt injection dataset
A deduplicated dataset for fine-tuning a prompt injection
Decision model with Unsloth, using
Jev-style questions. Each prompt gets two decisions:
is_malicious(Noul): "Is this prompt a prompt injection or malicious?"prompt_type(Choice): "What type of prompt is this?"
For non-commercial educational use. It was built for PwnGPT, a prompt injection
CTF. It contains real prompt injection, jailbreak and harmful request text, some of it
offensive.
Splits
| Split | benign | injection | jailbreak | obfuscated | harmful | Total |
|---|---|---|---|---|---|---|
train |
17,510 | 6,084 | 1,856 | 121 | 3,448 | 29,019 |
evaluation |
2,189 | 761 | 231 | 15 | 431 | 3,627 |
test |
2,189 | 760 | 233 | 15 | 432 | 3,629 |
Use evaluation to choose a checkpoint and test once for the final score.
from datasets import load_dataset
from unsloth import FastDecisionModel
train = load_dataset("cgoosen/system1-prompt-injection", split="train")
items, report = FastDecisionModel.build_dataset(train, tokenizer, model)
In Unsloth Studio, set Train as to Decision model and pick this dataset.
Columns
state: the prompt, as a JSON string such as{"user_message": "..."}.questions: the two questions, as a JSON string.gold: the answers, as a JSON string.source,subsource,attack_type: where the row came from and its original type.
Don't pass these to a model, because they reveal the answer.group_id: the near-duplicate cluster. Rows in a cluster stay in one split.
Labels
Answers come from the source datasets, not from a model. obfuscated has few rows, so
expect weaker results on it. Prompts from sources that only say "attack" are labelledinjection, so some of them may really be jailbreaks.
Sources
- cgoosen/llm_guard_dataset
- deepset/prompt-injections
- leolee99/NotInject
- htb-ac-1424625/llm-prompt-injection-filtered-cyber
curated: harmless password and security prompts written for this dataset, to teach that those words alone aren't an attack
Licences: each upstream source keeps its own licence, whatever the tag on the
dataset that collected it. The subsource column names the origin of HTB rows. Some
are non-commercial, including PKU-SafeRLHF, BeaverTails and ToxicChat
(CC BY-NC 4.0), and ALERT (CC BY-NC-SA 4.0). Others, including jayavibhav-PI andsafe-guard-PI, have no licence tag on Hugging Face. Check these terms before reusing
this dataset, and don't use it commercially.
Removed from the HTB rows: WildGuardMix, WildJailbreak.
Processing
- Exact duplicates were removed, ignoring case, spacing and punctuation. Texts with
conflicting labels were dropped (46 rows). - Near-duplicates were removed with MinHash at
0.8 similarity
(1,330 rows). [System: ...]wrappers were stripped from SPML and TensorTrust rows, because they
appeared almost only on attacks and would give away the label.- HTB upstream sources were capped at 3,000 rows per
class, and texts over 8,000 characters were dropped.
Known limitations
- Keyword bias. Nearly every prompt that mentions "password" is labelled malicious.
Expect false positives on harmless security questions, and test for them separately,
because thetestsplit has the same skew. - Other signals. Malicious prompts tend to be longer, and more of them are all
lowercase.### Instruction:templates also mark manyALERTrows. - Residual near-duplicates. MinHash is approximate, so a small share of held-out
rows may still closely resemble a training row.