misc 0 0 0

Ztrimus/Prompt-Perturbation-Safety-Dataset

published by @Ztrimus

Alignment dataset tracked in the /datasets sub-catalog.

Lifetime downloads
1.1K
Last 30 days
27
Likes
-
Size
656.7 MB
Created on HF
2025-07-01
Age
1 years ago

Description

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… See the full description on the dataset page: https://huggingface.co/datasets/Ztrimus/Prompt-Perturbation-Safety-Dataset.

Tags

task_categories:text-classificationtask_categories:sentence-similaritytask_categories:question-answeringlanguage:enlicense:apache-2.0size_categories:100K<n<1Mformat:csvmodality:tabularmodality:textlibrary:datasetslibrary:pandaslibrary:mlcroissantlibrary:polarsregion:ussafetyperturbationnlprobustnessPrompt PerturbationsSafety AlignmentRobustness EvaluationInput SensitivitySafety Flip

README current version from Hugging Face


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

README history 8 revisions

Every night we snapshot the README of every dataset in the catalog. When the SHA changes we archive the new version and diff it against the last. This is the evolving thought record of the alignment-data field: what the author decided to say about the corpus, and how that framing shifted over time.

  1. 2025-07-01Update README.md4f4500d7.4 KB
    Loading...
  2. 2025-07-01Update README.mda385b0a5 KB
    Loading...
  3. 2025-07-01Update README.mdf1cc94c3.8 KB
    Loading...
  4. 2025-07-01Update README.md480e9bb3.7 KB
    Loading...
  5. 2025-07-01Update README.md8a9c4e94.4 KB
    Loading...
  6. 2025-07-01Update README.mdf9d9ec74.4 KB
    Loading...
  7. 2025-07-01Upload Perturbation_Experiments_Data.csv58cdca431 B
    Loading...
  8. 2025-07-01initial commit3cc5be631 B
    Loading...

Used by abliterated models none yet

No abliterated models in our catalog have declared this dataset in their YAML metadata yet. This can mean the dataset is used but not declared, is used outside abliteration workflows, or is new. The link will populate automatically as models are indexed.

Community discussions 1 thread · 1 open · 1 comments

Threads posted by the community on Hugging Face: bug reports, questions about usage, pull requests on the README, license clarifications. Click any thread to expand and read the full conversation inline. Newest first.

  1. 2025-07-02[bot] Conversion to Parquetopen1 💬#1
    Loading...

Related datasets same stage · misc

Read further

Metadata

License
apache-2.0

Repository

Download the dataset

0

Copy any of these snippets into your notebook or terminal. All three fetch directly from Hugging Face using your own credentials.

Recommended: datasets library (Python)
from datasets import load_dataset
ds = load_dataset("Ztrimus/Prompt-Perturbation-Safety-Dataset")
Raw snapshot (Python)
from huggingface_hub import snapshot_download
snapshot_download(repo_id="Ztrimus/Prompt-Perturbation-Safety-Dataset", repo_type="dataset")
git clone (requires git-lfs)
git clone https://huggingface.co/datasets/Ztrimus/Prompt-Perturbation-Safety-Dataset
Catalog is the map. Apps are the tools.

Run models on your own machine, not in the cloud.

Every model page has an "Open in Abliteration" button that hands the model directly to the first-party desktop client, at the quantization your rig can actually run. No API keys, no subscription, no prompt leakage.

Open in Abliteration