ContraSafe-VL / README.md
DeeWoo's picture
Upload folder using huggingface_hub
22ee6d2 verified
|
Raw History Blame Contribute Delete
3.31 kB
metadata
license: other
license_name: research-use-only
task_categories:
  - image-text-to-text
language:
  - en
size_categories:
  - 10K<n<100K
tags:
  - safety
  - vision-language-model
  - preference-data
  - dpo
  - red-teaming
  - contrastive
configs:
  - config_name: default
    data_files:
      - split: train
        path: data/train-*.parquet

ContraSafe-VL

A contrastive safety preference dataset for vision-language models. For a fixed text query, paired images are provided whose safety verdicts flip: the same question is unsafe with one visual context and safe with another.

Dataset statistics

item value
multimodal queries (question, image) 53,101
unsafe / safe 28,676 / 24,425
contrastive pairs (unsafe × safe, same text) 10,115 across 10,022 questions
queries participating in contrastive pairs 20,230
additional (non-paired) queries 32,871 — 18,561 unsafe + 14,310 safe
unique images 17,862
response candidates 9 VLM backbones, 460,529 responses in total
reward scores helpful_score / harmless_score per response

Files

data/train-*.parquet   single table, one row per (question, image); images embedded as bytes

Fields

field type description
id string stable hash csvl- + sha1(question + image name)[:12]
question string textual query
images list[struct] {bytes, path} per image (HF Image compatible)
image_meta list[struct] aligned with images: is_edited, source_dataset
has_safety_risk string Yes = this (question, image) pair is unsafe, No = safe
flip_images list[str] paths of all opposite-label partners
pair_data_id string | null partner id, set only when pair_count == 1
pair_data_ids list[str] ids of all opposite-label partners with the same question
pair_count int number of opposite-label partners
responses list[struct] model_name, response, helpful_score, harmless_score

source_dataset records the upstream dataset of the image (spa_vl, safe_rlhf_v, datacomp, llava) when applicable.

Loading

from datasets import load_dataset

ds = load_dataset("<user>/ContraSafe-VL", split="train")     # 53,101 rows

ds[0]["images"][0].show()                                     # 图片已解码为 PIL.Image

# contrastive pairs
pairs = [r for r in ds if r["pair_data_ids"]]
n_pairs = len({tuple(sorted((r["id"], p))) for r in pairs for p in r["pair_data_ids"]})  # 10,115

Intended use and ethics

This dataset contains harmful and sensitive images (violence, illegal acts, regulated substances, hate, self-harm, etc.) collected for safety research only. It is released for research on vision-language model safety, red-teaming and alignment. Do not use it to build or train models for harmful purposes. Access may be gated; please agree to the terms before use and cite the paper in any publication.

Citation

@article{wu2026contrasafe,
  title   = {ContraSafe-VL: A Contrastive Safety Preference Dataset for Vision-Language Models},
  author  = {Wu, Di and Zhao, Yanyan and Lu, Xin and Yang, Hao and Zhang, Taotao and Zhao, Yunzhen},
  journal = {arXiv preprint arXiv:2610.23908},
  year    = {2026}
}