Heal just added

PKU-Alignment/PKU-SafeRLHF

published by @PKU-Alignment

DPO and ORPO preference mixes to recover capability after ablation.

task_categories:text-generationlanguage:enlicense:cc-by-nc-4.0size_categories:100K<n<1Mformat:jsonmodality:tabularmodality:textlibrary:datasets +13 more
Lifetime downloads
930.5K
Last 30 days
14.6K
Likes
207
Size
233.0 MB

Description

Dataset Card for PKU-SafeRLHF

Warning: this dataset contains data that may be offensive or harmful. The data are intended for research purposes, especially research that can make models less harmful. The views expressed in the data do not reflect the views of PKU-Alignment Team or any of its members.

[🏠 Homepage] [🤗 Single Dimension Preference Dataset] [🤗 Q-A Dataset] [🤗 Prompt Dataset]

Citation

If PKU-SafeRLHF has contributed to your work, please consider… See the full description on the dataset page: https://huggingface.co/datasets/PKU-Alignment/PKU-SafeRLHF.

Structure 4 configs · from the README front matter

default
Data files
train data/Alpaca-7B/train.jsonl, data/Alpaca2-7B/train.jsonl, data/Alpaca3-8B/train.jsonl
test data/Alpaca-7B/test.jsonl, data/Alpaca2-7B/test.jsonl, data/Alpaca3-8B/test.jsonl
alpaca-7b
Data files
train data/Alpaca-7B/train.jsonl
test data/Alpaca-7B/test.jsonl
alpaca2-7b
Data files
train data/Alpaca2-7B/train.jsonl
test data/Alpaca2-7B/test.jsonl
alpaca3-8b
Data files
train data/Alpaca3-8B/train.jsonl
test data/Alpaca3-8B/test.jsonl

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.

Derived corpora 2 datasets in the catalog cite this one

Other datasets in the catalog whose description names this one as a source (`based on`, `derived from`, `extended from`, `subset of`, `translated from`, etc.). This is the lineage-hint layer that complements the "Used by models" section above: many models cite the derived corpus rather than this root.

Metadata

License
cc-by-nc-4.0
Language
en
Created on HF
2023-06-14 · 3 years ago
Size category
100K<n<1M
Modalities
tabulartext
Formats
json
Libraries
datasetspandasmlcroissantpolars

Related datasets same stage · Heal

Read further

Total size
233.0 MB
Files
9
Formats
jsonl, png
Head
9421ffa
Last updated on HF
2024-10-18

Download the dataset

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("PKU-Alignment/PKU-SafeRLHF")
Raw snapshot (Python)
from huggingface_hub import snapshot_download
snapshot_download(repo_id="PKU-Alignment/PKU-SafeRLHF", repo_type="dataset")
git clone (requires git-lfs)
git clone https://huggingface.co/datasets/PKU-Alignment/PKU-SafeRLHF

Files by folder from our last crawl

top level 3 files 339.7 KB
.gitattributes 2.8 KB file download
data-collection-pipeline.png 327.8 KB png download
README.md 9.1 KB md download
data/ 6 files 232.7 MB
Alpaca-7B/test.jsonl 8.6 MB jsonl download
Alpaca-7B/train.jsonl 77.5 MB jsonl download
Alpaca2-7B/test.jsonl 8.1 MB jsonl download
Alpaca2-7B/train.jsonl 72.5 MB jsonl download
Alpaca3-8B/test.jsonl 6.6 MB jsonl download
Alpaca3-8B/train.jsonl 59.4 MB jsonl download

README current version from Hugging Face

Dataset Card for PKU-SafeRLHF

Warning: this dataset contains data that may be offensive or harmful. The data are intended for research purposes, especially research that can make models less harmful. The views expressed in the data do not reflect the views of PKU-Alignment Team or any of its members.

[🏠 Homepage] [🤗 Single Dimension Preference Dataset] [🤗 Q-A Dataset] [🤗 Prompt Dataset]

Citation

If PKU-SafeRLHF has contributed to your work, please consider citing our research:

@article{ji2024beavertails,
  title={Beavertails: Towards improved safety alignment of llm via a human-preference dataset},
  author={Ji, Jiaming and Liu, Mickel and Dai, Josef and Pan, Xuehai and Zhang, Chi and Bian, Ce and Chen, Boyuan and Sun, Ruiyang and Wang, Yizhou and Yang, Yaodong},
  journal={Advances in Neural Information Processing Systems},
  volume={36},
  year={2024}
}
@article{ji2024pku,
  title={PKU-SafeRLHF: Towards Multi-Level Safety Alignment for LLMs with Human Preference},
  author={Ji, Jiaming and Hong, Donghai and Zhang, Borong and Chen, Boyuan and Dai, Josef and Zheng, Boren and Qiu, Tianyi and Li, Boxun and Yang, Yaodong},
  journal={arXiv preprint arXiv:2406.15513},
  year={2024}
}

If you encounter any issues with our dataset, please contact us through the HuggingFace Discussion.

Dataset Summary

This dataset is a sibling project of PKU-SafeRLHF-v0 and BeaverTails.

We provide a high-quality dataset consisting of 83.4K preference entries, which is annotated across two dimensions: harmlessness and helpfulness. Specifically, each entry in this dataset includes two responses to a question, accompanied by safety meta-labels and preferences for both responses based on their helpfulness and harmlessness. For a more fine-grained labeling of Q-A pairs in this dataset, see PKU-SafeRLHF-QA.

In this work, we performed SFT on Llama2-7B and Llama3-8B with Alpaca 52K dataset, resulting in Alpaca2-7B and Alpaca3-8B. This dataset contains responses from Alpaca-7B, Alpaca2-7B, and Alpaca3-8B in the corresponding folders under /data.

The data collection pipeline for this dataset is depicted in the following image:

Data Collection Pipeline

Labels of Each Q-A Pair

Harm Categories

Each Q-A pair in the dataset is labeled with one or more harm categories. Based on existing research and multiple rounds of communication with the annotation team, we identify 19 harm categories:

  • S1: Endangering National Security
  • S2: Insulting Behavior
  • S3: Discriminatory Behavior
  • S4: Endangering Public Health
  • S5: Copyright Issues
  • S6: Violence
  • S7: Drugs
  • S8: Privacy Violation
  • S9: Economic Crime
  • S10: Mental Manipulation
  • S11: Human Trafficking
  • S12: Physical Harm
  • S13: Sexual Content
  • S14: Cybercrime
  • S15: Disrupting Public Order
  • S16: Environmental Damage
  • S17: Psychological Harm
  • S18: White-Collar Crime
  • S19: Animal Abuse

Severity Level

Security issues of large language models are not a simple binary right-or-wrong problem. We explore the classification of the inherent severity of harmful events and define three severity levels of harmful events from the aspects of impact and response measures:

Severity Level Impact Response Measures
Minor Low-level impact, slight personal discomfort, or minor societal impact in a limited range, not violating the law. Simple personal measures are enough, and no government or professional agency intervention is needed.
Moderate Moderate impact, may cause noticeable damage or even death to individuals, difficult to mitigate in a short time, possibly violating the law, but usually does not lead to long-term severe consequences. May require government or professional agency intervention.
Severe Targets groups rather than individuals. May cause extremely serious consequences, involving large-scale casualties, economic losses, environmental damage, and other malicious outcomes, with broad and far-reaching impact. Requires national or international resources for response and recovery.

Human-Preference on Harmlessness and Helpfulness

Harmlessness of a Q-A Pair

The harmlessness of a Q-A pair is evaluated based on ethical considerations and safety implications inherent in the interaction.
A Q-A pair is deemed harmless when it is classified as risk-neutral across all 19 harm categories.
By risk-neutral, we mean that the Q-A pair does not engender or promote any harmful consequences or risks as per the definitions in these categories.
Thus, a risk-neutral Q-A pair neither incite harm nor leads to unsafe outcomes, effectively aligning with our safety and ethical guidelines.

Helpfulness of a Response

The helpfulness of a response pertains to how effectively it addresses a given prompt. This measure is independent of the harmlessness of the response, as it focuses solely on the quality, clarity, and relevance of the provided information. Consequently, the helpfulness judgment can be distinctly different from the harmlessness judgment. For instance, consider a situation where a user asks about the procedure to synthesize methamphetamine. In such a case, a detailed, step-by-step response would be considered helpful due to its accuracy and thoroughness. However, due to the harmful implications of manufacturing illicit substances, this Q-A pair would be classified as extremely harmful.

Ranking of Responses

Once the helpfulness and harmlessness of responses are evaluated, they are ranked accordingly. It is important to note that this is a two-dimensional ranking: responses are ranked separately for helpfulness and harmlessness. This is due to the distinctive and independent nature of these two attributes. The resulting rankings provide a nuanced perspective on the responses, allowing us to balance information quality with safety and ethical considerations. These separate rankings of helpfulness and harmlessness contribute to a more comprehensive understanding of LLM outputs, particularly in the context of safety alignment. We have enforced a logical order to ensure the correctness of the harmlessness ranking: harmless responses (i.e. all 19 harm categories risk-neutral) are always ranked higher than harmful ones (i.e., at least 1 category risky).

Usage

To load our dataset, use the load_dataset() function as follows:

from datasets import load_dataset

dataset = load_dataset("PKU-Alignment/PKU-SafeRLHF")

To load a specified subset of our dataset, add the data_dir parameter. For example:

from datasets import load_dataset

dataset = load_dataset("PKU-Alignment/PKU-SafeRLHF", name='alpaca-7b')

To load PKU-SafeRLHF-v0 (which is one of the sibling projects to this dataset):

from datasets import load_dataset

dataset = load_dataset("PKU-Alignment/PKU-SafeRLHF", revision="v0")

README history latest 20 of 34 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. 2024-10-18 Update README.md 9421ffa 8.8 KB
    Loading...
  2. 2024-09-10 Remove noisy data points. d79b19b 7.9 KB
    Loading...
  3. 2024-08-22 Update README.md 24b8dc3 7.9 KB
    Loading...
  4. 2024-08-22 Merge remote-tracking branch 'refs/remotes/origin/main' 38e2e89 7.9 KB
    Loading...
  5. 2024-08-22 Fix bug f1ad8c0 7.9 KB
    Loading...
  6. 2024-08-18 Add harm category label and severity level label. f4b036f 7.1 KB
    Loading...
  7. 2024-08-18 Add harm category label and severity level label. 3fa35d0 7.1 KB
    Loading...
  8. 2024-08-16 Update README.md a44ac7d 7.1 KB
    Loading...
  9. 2024-07-15 Update README.md 1548d5a 4.7 KB
    Loading...
  10. 2024-06-14 Update README 8b87c33 4.7 KB
    Loading...
  11. 2024-06-14 Update README 7809f1e 4.6 KB
    Loading...
  12. 2024-06-14 Update README 7339192 4 KB
    Loading...
  13. 2024-06-13 Update README 9e9f5cf 4 KB
    Loading...
  14. 2024-06-13 Update README 22b2ad9 4 KB
    Loading...
  15. 2024-06-13 main 74baebd 4 KB
    Loading...
  16. 2024-06-13 Release new PKU-SafeRLHF dataset 571c013 3.5 KB
    Loading...
  17. 2023-11-20 Move the 30k split of Beavertails to `PKU-Alignment/PKU-SafeRLHF-30K` ff7ba91 3.5 KB
    Loading...
  18. 2023-11-20 Resplit the train and test sets 2409192 3.8 KB
    Loading...
  19. 2023-10-27 Update README.md 6004642 3.8 KB
    Loading...
  20. 2023-10-27 remove duplicates 383d582 3.8 KB
    Loading...

Community discussions 8 threads · 7 open · 16 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-08-09 Prompt Harm Categories open 2 💬 #8
    Loading...
  2. 2025-06-17 PR Add link to paper open 1 💬 #7
    Loading...
  3. 2025-05-22 Harm Categories for PKU-SafeRLHF-v0 open 2 💬 #6
    Loading...
  4. 2024-09-03 Is there a dataset of the individual-level annotations? open 2 💬 #5
    Loading...
  5. 2024-08-28 Alpaca3 70B - Model Release closed 3 💬 #4
    Loading...
  6. 2024-08-21 Load dataset failes open 4 💬 #3
    Loading...
  7. 2024-06-25 PR add link to paper page open 1 💬 #2
    Loading...
  8. 2024-05-04 [bot] Conversion to Parquet open 1 💬 #1
    Loading...
Download from HuggingFace

PKU-Alignment/PKU-SafeRLHF

Catalog is the map. Apps are the tools.

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

Every GGUF 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