Datasets:
Tasks:
Text Generation
Modalities:
Text
Formats:
csv
Sub-tasks:
text2text-generation
Languages:
English
Size:
10K - 100K
License:
|
Download README.md from vvsd-charan/safety_aligned_datasets: direct link, hf CLI and curl.
- Browser
- Download file 10.6 kB
-
https://huggingface.co/datasets/vvsd-charan/safety_aligned_datasets/resolve/main/README.md
- Command line
-
hf download hf://datasets/vvsd-charan/safety_aligned_datasets/README.md
-
curl -L -o README.md https://huggingface.co/datasets/vvsd-charan/safety_aligned_datasets/resolve/main/README.md
10.6 kB
| 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.* | |
| []() []() []() []() []() | |
| </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. |