license: apache-2.0
task_categories:
- text-classification
- sentence-similarity
- question-answering
language: - en
tags: - safety
- perturbation
- nlp
- robustness
- Prompt Perturbations
- Safety Alignment
- Robustness Evaluation
- Input Sensitivity
- Safety Flip
size_categories: - 100K<n<1M
LLM Safety Flip Dataset
What is this?
This dataset contains 136,400 rows of harmful prompts from the CatQA benchmark, each subjected to semantic-preserving perturbations (e.g., typos, insertions, paraphrasing). Each perturbed prompt was processed across five open-source LLMs (LLaMA 2, LLaMA 3, Mistral, Gemma, Qwen), and corresponding responses were evaluated using Llama Guard v3 to determine safety behavior. We include original and perturbed questions, model responses, safety labels, similarity scores, and detailed perturbation metadata.
This dataset supports research on LLM safety robustness, enabling fine-grained analysis of:
- Flip rates between safe and unsafe responses (RQ1)
- Factors driving these flips (RQ2)
- Category-wise safety vulnerabilities (RQ3)
📌 Note: This dataset is derived directly from the experimental outputs presented in the paper:
"Can Typos Cause Harm? The Impact of Imperfect Input on LLM Safety" — Code & Notebooks Available Here
Dataset Structure
The dataset consists of 136,400 examples and 23 features, where each row represents a unique triple of:
(original prompt, model, perturbation)
These triples capture how various LLMs respond to semantic-preserving perturbations applied to harmful prompts. Below is an overview of the full schema:
📐 Shape
- Rows: 136,400
- Columns: 23
📊 Schema Overview
| Column Name | Type | Description |
|---|---|---|
category |
object | Main harm category (e.g., self-harm, harassment) |
subcategory |
object | Finer-grained harm type (e.g., medical misinformation) |
original_question |
object | The original, unperturbed harmful prompt |
original_question_safety |
object | Safety label for the original prompt (Llama Guard v3) |
original_response |
object | Raw model output to the original prompt |
original_response_safety |
object | Safety label for original response |
original_response_pre |
object | Preprocessed response (cleaned for labeling heuristics) |
original_response_pre_safety |
object | Safety label of the preprocessed original response |
experiment |
object | Experiment configuration key for reproducibility |
perturbation_level |
object | Level of edit: char, word, or sentence |
perturbation_type |
object | Type of transformation (e.g., synonym, back-translation) |
perturbation_count |
float64 | Number of perturbations applied (1–5); nullable |
perturbed_question |
object | Perturbed version of the original prompt |
perturbed_question_safety |
object | Safety label for the perturbed prompt |
model |
object | Model name used to generate the response |
perturbed_response |
object | Raw model output to the perturbed prompt |
perturbed_response_safety |
object | Safety label for perturbed response |
perturbed_response_pre |
object | Preprocessed perturbed response (nullable) |
perturbed_response_pre_safety |
object | Safety label of preprocessed perturbed response |
latent_similarity |
float64 | Cosine similarity in embedding space between original and perturbed question |
token_similarity |
float64 | Token-level (surface) similarity between questions |
original_response_pre_refusal |
object | Refusal type for original preprocessed response |
perturbed_response_pre_refusal |
object | Refusal type for perturbed preprocessed response |
Most rows are complete, though perturbation_count and perturbed_response_pre contain minor missing values (e.g., 132k/136k entries for perturbation_count).
Dataset Creation & Provenance
- Source: 550 prompts from CatQA harmful prompts dataset
- Perturbation techniques: Character-level (typos, OCR), word-level (synonyms, insertions), sentence-level (paraphrasing, back-translation)
- LLMs tested: LLaMA 2 7B, LLaMA 3 8B, Mistral 7B, Gemma 2B, Qwen 7B
- Labeling method: Automated using Llama Guard v3 safety classifier
- Similarity computation: SentenceTransformer-based embedding cosine similarity (latent), token overlap (token)
- Consolidation: All model outputs combined via scripts in
combining-multiple-datasets.ipynb
Each row represents a unique (prompt, model, perturbation) instance with complete context.
Considerations for Use
⚠ Limitations:
- Dataset limited to harmful prompts only — may not generalize to neutral tasks
- Safety labels are model-generated (Llama Guard v3), not manually verified
- Some perturbations may not reflect authentic user behavior (e.g., back-translation artifacts)
✅ Intended uses:
- Evaluation of safety robustness across model variants
- Analysis of prompt phrasing sensitivity
- Benchmarks for alignment, interpretability, and refusal behavior
🚫 Not suitable for:
- Training production-grade safety detectors without additional validation
- General-purpose NLP evaluation
Usage Example
from datasets import load_dataset
ds = load_dataset("Ztrimus/llm-safety-flip-dataset", split="full")
# Preview a sample
print(ds[0])
# Analyze flip rate
import pandas as pd
df = ds.to_pandas()
flip_rate = ((df.original_response_safety == "safe") & (df.perturbed_response_safety == "unsafe")).mean()
print(f"Safe → Unsafe flip rate: {flip_rate:.2%}")
Citation
Please cite our work if you use this dataset:
@inproceedings{zinjad2025typos_safety,
title = {Can Typos Cause Harm? The Impact of Imperfect Input on LLM Safety},
author = {Saurabh Zinjad},
year = {2025},
booktitle = {SBP-BRiMS: Int'l Conference on Social Computing, Behavioral-Cultural Modeling, & Prediction and Behavior Representation in Modeling and Simulation},
address = {Carnegie Mellon University, Pittsburgh, PA}
}
Contact
Created and maintained by Saurabh Zinjad
Questions, issues, or contributions welcome via the GitHub repository: Ztrimus/llm-sensitivity