PKU-SafeRLHF-RLHF
A single RLHF-ready reward config derived from
PKU-Alignment/PKU-SafeRLHF.
| config | columns | use case |
|---|---|---|
| reward | prompt, chosen, rejected, margin | reward-model training |
Example counts
| split | examples |
|---|---|
| train | 33,334 |
| test | 3,688 |
| total | ** 37,022** |
SFT and DPO projections are trivially derived from this config without
re-downloading:
- sft: keep
prompt+chosen - dpo: keep
prompt+chosen+rejected
Filtering
Three signals from the source dataset are combined — severity_level per
response, safer_response_id, and better_response_id. A pair is kept when
either (a) the two severities differ AND at least one binary signal supports
the lower-severity response, or (b) severities are tied AND the two binary
signals agree. Pairs where both responses are unsafe are dropped outright.
margin = max(|sev_chosen - sev_rejected|, 1.0 if signals_agree else 0.0)
— useful for upweighting confident pairs in RM training loss.
Quick-start
from datasets import load_dataset
ds = load_dataset("AIPlans/PKU-SafeRLHF-RLHF", "reward")
# reward-model training
train = ds["train"] # columns: prompt, chosen, rejected, margin
# derive SFT subset on-the-fly
sft = train.remove_columns(["rejected", "margin"])
# derive DPO subset on-the-fly
dpo = train.remove_columns(["margin"])
Generated by convert_pku_saferlhf.py. License inherited from the source
dataset (CC-BY-NC-4.0).