extract 0 0 0

bootscoder/Medical-ChatBot-DPO

published by @bootscoder

Alignment dataset tracked in the /datasets sub-catalog.

Lifetime downloads
422
Last 30 days
63
Likes
1
Size
19.7 MB
Created on HF
2025-11-01
Age
11 months ago

Description

Medical-ChatBot-DPO 数据集

数据集概述

本数据集是一个用于 DPO (Direct Preference Optimization) 训练的偏好对齐数据集,专门为医疗对话机器人设计。数据集包含 40,672 条样本,融合了通用对话安全性、人类偏好对齐和医疗领域专业知识。

数据来源与处理

1. Anthropic/hh-rlhf (harmless-base)

数据量: 10,000 条

来源: Anthropic/hh-rlhf

子集: harmless-base (无害对话子集)

处理方式:

从原始对话中提取最后一轮 Human-Assistant 对话

从 chosen 字段提取最后的 Assistant 回复作为 chosen(安全的拒绝回复)

从 rejected 字段提取最后的 Assistant 回复作为 rejected(有帮助但可能有害的回复)

过滤掉无效样本(prompt 为空的样本)

随机采样 10,000… See the full description on the dataset page: https://huggingface.co/datasets/bootscoder/Medical-ChatBot-DPO.

Tags

size_categories:10K<n<100Kformat:parquetformat:optimized-parquetmodality:textlibrary:datasetslibrary:pandaslibrary:polarslibrary:mlcroissantarxiv:2304.00729region:us

README current version from Hugging Face

Medical-ChatBot-DPO 数据集

数据集概述

本数据集是一个用于 DPO (Direct Preference Optimization) 训练的偏好对齐数据集,专门为医疗对话机器人设计。数据集包含 40,672 条样本,融合了通用对话安全性、人类偏好对齐和医疗领域专业知识。

数据来源与处理

1. Anthropic/hh-rlhf (harmless-base)

  • 数据量: 10,000 条
  • 来源: Anthropic/hh-rlhf
  • 子集: harmless-base (无害对话子集)
  • 处理方式:
    • 从原始对话中提取最后一轮 Human-Assistant 对话
    • 从 chosen 字段提取最后的 Assistant 回复作为 chosen(安全的拒绝回复)
    • 从 rejected 字段提取最后的 Assistant 回复作为 rejected(有帮助但可能有害的回复)
    • 过滤掉无效样本(prompt 为空的样本)
    • 随机采样 10,000 条(seed=42)
  • 用途: 提供基础的安全性对齐能力

2. PKU-Alignment/PKU-SafeRLHF-30K

  • 数据量: 26,872 条(原始 26,874 条,过滤后 26,872 条)
  • 来源: PKU-Alignment/PKU-SafeRLHF-30K
  • 处理方式:
    • 直接从 Hugging Face Hub 加载完整训练集
    • 采用"安全优先"策略进行 chosen/rejected 标注:
      • 情况1: 两个回复安全性相同(都安全或都不安全)→ 根据 better_response_id(有用性评分)选择 chosen
      • 情况2: response_0 安全但 response_1 不安全 → chosen=response_0, rejected=response_1
      • 情况3: response_1 安全但 response_0 不安全 → chosen=response_1, rejected=response_0
    • 重要说明: 约 15-20% 的样本(6,000-8,000 条)中,两个回复都被标记为不安全(is_response_0_safe=False 且 is_response_1_safe=False),此时 better_response_id 仅反映有用性而非安全性
  • 用途: 提供多维度(安全性+有用性)的人类偏好对齐

3. shibing624/medical (reward 子集)

  • 数据量: ~3,800 条
  • 来源: shibing624/medical
  • 子集: reward/train.json(本地加载)
  • 处理方式:
    • 从本地克隆的 dataset/medical/reward/train.json 文件加载
    • 逐行解析 JSON 格式数据
    • 从 question 字段提取 prompt
    • 从 response_chosen 字段提取 chosen
    • 从 response_rejected 字段提取 rejected
    • 跳过无效的 JSON 行
  • 用途: 提供医疗领域专业知识的偏好对齐

数据格式

每条样本包含三个字段:

{
  "prompt": "###System: You are a helpful assistant.\\n###Question: 用户的问题\\n###Answer: ",
  "chosen": "更优质的回答 <|end_of_text|>",
  "rejected": "较差的回答 <|end_of_text|>"
}

数据混合策略

  1. 加载: 分别从 Hugging Face Hub 和本地路径加载三个数据源
  2. 统一格式: 将所有数据统一处理为 {prompt, chosen, rejected} 格式
  3. 合并: 将三个数据源直接拼接
  4. 打乱: 使用 random.shuffle(seed=42) 打乱所有样本
  5. 保存: 保存为 Hugging Face Dataset 格式

使用示例

from datasets import load_dataset

# 从 Hugging Face Hub 加载
dataset = load_dataset("bootscoder/Medical-ChatBot-DPO")

# 或从本地加载
from datasets import load_from_disk
dataset = load_from_disk("./dataset/dpo_dataset_from_resume")

# 查看样本
print(dataset[0])

数据集统计

数据源 样本数 占比 特点
hh-rlhf (harmless) 10,000 24.6% 安全性对齐
PKU-SafeRLHF 26,872 66.1% 安全性+有用性双维度
Medical Reward 3,800 9.3% 医疗领域专业知识
总计 40,672 100% -

注意事项

  1. PKU-SafeRLHF 处理说明: 约 15-20% 的 PKU 样本中,chosen 和 rejected 都被标记为不安全。在这些样本中,选择标准基于有用性而非安全性。使用时请注意这一特点。

  2. 适用场景: 本数据集适合用于医疗对话机器人的 DPO 初步对齐训练,建议后续配合 PPO 进行更精细的对齐。

  3. 领域覆盖: 数据集覆盖通用对话安全性、人类偏好对齐和医疗专业知识三个维度。

引用

如果使用本数据集,请引用原始数据来源:

@misc{hh-rlhf,
  author = {Anthropic},
  title = {HH-RLHF: Helpful and Harmless RLHF Dataset},
  year = {2022},
  url = {https://huggingface.co/datasets/Anthropic/hh-rlhf}
}

@article{ji2024pku,
  title={PKU-SafeRLHF: A Safety Alignment Preference Dataset for RLHF},
  author={Ji, Jiaming and Liu, Mickel and others},
  journal={arXiv preprint arXiv:2304.00729
        
        },
  year={2024}
}

@misc{medical,
  author = {Xu Ming},
  title = {Medical: Chinese Medical Dialogue Dataset},
  year = {2023},
  url = {https://huggingface.co/datasets/shibing624/medical}
}

许可证

本数据集遵循原始数据源的许可协议。请在使用前查阅各数据源的具体许可证要求。

README history 5 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-11-12Update README.md154d3595 KB
    Loading...
  2. 2025-11-12Update README.md10b4d1c5 KB
    Loading...
  3. 2025-11-12Update README.md8557cdc4.3 KB
    Loading...
  4. 2025-11-01Upload datasetfbe40f0352 B
    Loading...
  5. 2025-11-01initial commit9f3188d0 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-11-02[bot] Conversion to Parquetopen1 💬#1
    Loading...

Related datasets same stage · extract

Read further

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