File size: 10,565 Bytes
b089d4f
a7d1c5d
55e66fc
a7d1c5d
55e66fc
a7d1c5d
 
 
 
 
971a2e7
a851049
 
 
 
 
 
 
 
 
 
 
 
 
a7d1c5d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a851049
 
 
b089d4f
d55e8cc
ba66766
d55e8cc
ba66766
ccf12e7
ba66766
 
a7d1c5d
ba66766
 
ccf12e7
ea8512b
 
ba66766
 
a7d1c5d
ba66766
a7d1c5d
ba66766
a7d1c5d
ba66766
 
 
a851049
 
 
 
 
 
 
a7d1c5d
a851049
ba66766
a851049
ba66766
a851049
 
 
ba66766
a7d1c5d
a851049
 
 
 
ba66766
a7d1c5d
a851049
 
 
 
ba66766
a7d1c5d
a851049
 
 
 
ea8512b
a7d1c5d
a851049
 
 
 
ea8512b
a7d1c5d
a851049
 
 
 
ba66766
a7d1c5d
a851049
 
 
 
ba66766
a7d1c5d
a851049
 
ccf12e7
 
 
a851049
aab561c
a7d1c5d
a851049
 
ccf12e7
a7d1c5d
ccf12e7
a7d1c5d
ea8512b
a851049
ba66766
a851049
d55e8cc
a851049
ccf12e7
a851049
ba66766
a7d1c5d
ea8512b
a851049
ccf12e7
a7d1c5d
ba66766
a851049
ba66766
 
d55e8cc
a7d1c5d
ea8512b
a851049
ea8512b
a7d1c5d
 
ea8512b
a7d1c5d
a851049
ba66766
a7d1c5d
 
ba66766
a7d1c5d
a851049
a7d1c5d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ccf12e7
 
d55e8cc
ba66766
aab561c
a851049
ccf12e7
a851049
 
 
 
 
ccf12e7
 
d55e8cc
a7d1c5d
aab561c
ba66766
ea8512b
ba66766
ea8512b
 
d55e8cc
a7d1c5d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
---
license: cc-by-4.0
task_categories:
- text-generation
task_ids:
- text2text-generation
language:
- en
size_categories:
- 10K<n<100K
configs:
- config_name: default
  data_files:
  - split: harmful
    path:
    - beavertails_unsafe_vllm.csv
    - donot_answer_vllm.csv
    - forbidden_questions_vllm.csv
    - harmfulqa_vllm.csv
    - llm_redteaming_vllm.csv
    - synthetic_harmful_prompts_vllm.csv
    - prompt_injection_unsafe_vllm.csv
  - split: safe
    path: prompt_injection_safe_vllm.csv
- config_name: beavertails
  data_files:
  - split: harmful
    path: beavertails_unsafe_vllm.csv
- config_name: donot_answer
  data_files:
  - split: harmful
    path: donot_answer_vllm.csv
- config_name: forbidden_questions
  data_files:
  - split: harmful
    path: forbidden_questions_vllm.csv
- config_name: harmfulqa
  data_files:
  - split: harmful
    path: harmfulqa_vllm.csv
- config_name: llm_redteaming
  data_files:
  - split: harmful
    path: llm_redteaming_vllm.csv
- config_name: synthetic_harmful_prompts
  data_files:
  - split: harmful
    path: synthetic_harmful_prompts_vllm.csv
- config_name: prompt_injection_unsafe_vllm
  data_files:
  - split: harmful
    path: prompt_injection_unsafe_vllm.csv
- config_name: prompt_injection_safe_vllm
  data_files:
  - split: safe
    path: prompt_injection_safe_vllm.csv
tags:
- Model_safety
- SFT
---

# Safety Aligned Datasets

<div align="center">

*A high-fidelity adversarial corpus engineered for alignment research, refusal boundary modeling, and robustness evaluation of Small Language Models.*

[![License: CC-BY-4.0](https://img.shields.io/badge/License-CC--BY--4.0-blue.svg)]() [![Harmful Split](https://img.shields.io/badge/Split-harmful-red)]() [![Safe Split](https://img.shields.io/badge/Split-safe-brightgreen)]() [![Configs: 8](https://img.shields.io/badge/Configurations-8-orange)]() [![Engine: vLLM](https://img.shields.io/badge/Engine-vLLM-green)]()

</div>

---

## The Problem This Solves

Fine-tuning a Small Language Model to be safe is not the same as fine-tuning it to *understand* safety.

Most safety datasets give models clean refusal examples on obvious prompts — and those models fail the moment an adversary wraps a harmful request in a hypothetical, a role-play, or a chain of plausible reasoning. The failure is not in the refusal mechanism. It is in the **coverage gap**: the model has never been exposed to the attack surface it will actually face in deployment.

This dataset was built to close that gap — and to go further. Because alignment is not just about refusal. It is about teaching a model to handle adversarial manipulation at the system level, including direct attacks on its own instruction context.

---

## Dataset Structure

This corpus contains **eight configurations** across **two splits**.

The `default` config combines all files and exposes both splits simultaneously — useful for full-dataset training runs. The individual named configs allow subset-level access for targeted experiments.

---

## Splits

### `harmful` — Unsafe Behavior Across Seven Configurations

Each configuration under this split targets a different failure mode in model alignment.

---

**`beavertails`**

Covers the canonical safety meta-categories — violence, hate speech, self-harm — drawn from one of the most widely cited safety benchmarks in the field. Provides a principled baseline across well-defined harm taxonomies, making it the right starting point for calibrating a model's refusal behavior before moving to more complex attack classes.

---

**`donot_answer`**

Prompts mapped to a structured AI safety evaluation framework. Best suited for benchmarking against established refusal rubrics and tracking alignment progress across model versions in a reproducible, framework-aligned way.

---

**`forbidden_questions`**

The most adversarially complex configuration in the harmful split. Prompts rely on fictional framing, nested hypotheticals, and philosophical edge cases — exactly where naive keyword-based safety mechanisms consistently break down. A model that handles this configuration well has learned to reason about intent, not just surface form.

---

**`harmfulqa`**

Query-style harmful inputs that closely mimic how real users phrase requests. Risk vectors span multiple domains, making this subset particularly important for models deployed in open-ended conversational settings where the adversarial signal is subtle.

---

**`llm_redteaming`**

Empirical jailbreaks sourced from public and academic red-teaming exercises. These are prompts that have already succeeded against deployed models in the wild. A model that has not seen this class of attack is likely to fail it.

---

**`synthetic_harmful_prompts`**

Adversarially generated expansions designed to simulate novel, unseen attack patterns. Unlike the empirical configurations above, this subset pushes models to generalize safe behavior rather than recall seen examples — the closer approximation of real-world robustness.

---

**`prompt_injection_unsafe_vllm`**

Targets prompt injection attacks — attempts to override or hijack system-level instructions through crafted user inputs. This is a distinct and increasingly critical threat class in agentic and tool-augmented LLM deployments, where user input reaches the inference context alongside a privileged system prompt. Most general-purpose safety datasets do not cover this class at all.

---

### `safe` — Correct Behavior Under Adversarial Pressure

**`prompt_injection_safe_vllm`**

The structural counterpart to `prompt_injection_unsafe_vllm`. These records show the model correctly maintaining its intended behavior under injection pressure — ignoring override instructions and staying within its sanctioned boundaries. In a DPO or contrastive SFT setup, these serve as the *chosen* side of the preference pair, with the unsafe configuration providing the *rejected* side.

---

## How to Use This Dataset

### Supervised Fine-Tuning

Each adversarial prompt and its model-generated response can be paired with a curated safe response to create contrastive training examples. The model learns not just what to refuse, but how to refuse in a way that is polite, reasoned, and non-dismissive.

### Direct Preference Optimization

The `(prompt, safety_res, model)` triplet maps naturally onto DPO's chosen/rejected framework. The `safety_res` field provides the baseline behavior to treat as the rejected sample, paired against a verified chosen response. For prompt injection specifically, `prompt_injection_unsafe_vllm` and `prompt_injection_safe_vllm` form a ready-made contrastive pair with no additional annotation overhead.

### False-Refusal Calibration

Over-refusal is an alignment failure too. Configurations like `forbidden_questions` and `harmfulqa` include borderline inputs that use sensitive keywords in genuinely benign contexts. Training on these teaches a model to reason about intent rather than pattern-match on surface signals.

### Prompt Injection Robustness

With LLMs increasingly deployed in agentic workflows, RAG pipelines, and tool-use environments, resistance to instruction hijacking is no longer optional. The injection split pair directly addresses this gap for any model operating in a multi-context deployment setting.

---

## Adversarial Technique Reference

The prompts across all configurations cover four primary attack classes.

**Role-Play Frameworks**
Instructions that force the model into an alternate persona — developer mode, uncensored assistant, fictional AI with no restrictions. These exploit the model's instruction-following strength directly against its safety constraints.

**Hypothetical Contextualization**
Harmful requests embedded inside academic thought experiments, historical framing, or fictional narratives. The surface text appears benign; the information being sought is not.

**Linguistic Obfuscation**
Multi-turn logical chains, domain jargon, and structural misdirection designed to bypass keyword filters and confuse intent classifiers. These require the model to reason about the trajectory of a conversation, not just the final message in isolation.

**Prompt Injection**
Direct attempts to override system-level instructions through adversarially crafted user inputs. Variants include goal hijacking, prompt leakage, and jailbreak injection. Particularly relevant for RAG systems, tool-augmented agents, and any deployment where user input coexists with a privileged system context.

---

## Generation Pipeline

```
Base Model  →  TheBloke/Mistral-7B-Instruct-v0.2-AWQ
Engine      →  vLLM (Vectorized LLM inference framework)
Hardware    →  NVIDIA T4 GPU · 16GB VRAM · Google Colab
```

**Why Mistral-7B-Instruct-v0.2-AWQ?**
It sits at the intersection of strong instruction-following capability and accessible compute — representative of the exact model class this dataset is designed to align. Responses generated by a model in the same capability tier as the training target produce more realistic and transferable training signal than outputs from a frontier model.

**Why vLLM?**
Batch processing across eight heterogeneous prompt distributions requires a framework that handles dynamic context lengths without throughput collapse. vLLM's PagedAttention mechanism makes this practical on constrained hardware.

---

## Data Schema

Each record across all configurations contains three fields.

| Field | Type | Description |
| --- | --- | --- |
| `prompt` | string | The raw adversarial or harmful input instruction, unmodified from its source |
| `safety_res` | string | The response generated by the inference model during the pipeline run |
| `model` | string | The specific model variant used, enabling controlled ablation across response sources |

---

## Licensing and Attribution

Upstream data portions — drawn from `BeaverTails`, `DoNotAnswer`, `HarmfulQA`, and associated red-teaming sets — retain their original licenses (CC-BY-SA 4.0, MIT, Apache 2.0). Users are responsible for compliance with each upstream source's terms.

The unified compilation framework and all synthetic responses are released under **CC-BY-4.0** for research use.

---

> **Disclaimer:** This dataset contains explicit, toxic, and adversarial content. It is hosted exclusively to advance the science of AI safety, alignment, and defensive model training. The maintainers do not condone or encourage the execution of any harmful behaviors described within these prompts. Use only in controlled research environments.