Anthropic's RLHF training methodology for creating helpful and harmless AI assistants using preference modeling and reinforcement learning from human feedback
Scanned 9/11/2026
Install to Claude Code
npx -y skills add hiyenwong/ai_collection --skill rlhf-helpful-harmless-assistant --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Rlhf Helpful Harmless Assistant?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/hiyenwong-rlhf-helpful-harmless-assistant)More formats (shields.io, HTML) on the badges page.
---
name: rlhf-helpful-harmless-assistant
description: Anthropic's RLHF training methodology for creating helpful and harmless AI assistants using preference modeling and reinforcement learning from human feedback
category: ai_collection
tags: [RLHF, alignment, helpfulness, harmlessness, preference-modeling, reinforcement-learning, PPO, Anthropic, online-training]
created: 2026-04-26
source: "Training a Helpful and Harmless Assistant with RLHF"
arXiv: https://arxiv.org/abs/2204.05862
---
# RLHF Helpful and Harmless Assistant Training
## 核心贡献
### 1. 对齐训练框架
- 使用**偏好建模(PM)**和**人类反馈强化学习(RLHF)**微调语言模型
- 同时训练模型在**有用性(Helpfulness)**和**无害性(Harmlessness)**两个维度上表现优异
- 对齐训练几乎改善所有NLP评估指标,与专业技能训练兼容
### 2. 迭代在线RLHF训练
- 以**周为周期**更新偏好模型和RL策略
- 使用新鲜的人类反馈数据持续改进模型和数据集
- 在线训练显著提升模型质量,填充数据分布的上尾
### 3. RLHF鲁棒性研究
- 发现RL奖励与策略和初始化之间**KL散度平方根**的近似线性关系
- 大型偏好模型在RLHF训练中更稳健,过拟合更少
- 提出评估RLHF训练稳定性的方法论
### 4. 帮助性与无害性的张力
- 过度关注避免伤害可能导致"安全"但不实用的回复
- 过度关注有用性可能导致帮助用户造成伤害
- 大型PM模型能更好地同时学习两个概念
## 方法论
### 数据收集流程
**Helpfulness Dataset** (44k comparisons)
- 众包工作者与模型进行开放式对话
- 选择更有用和诚实的回复
**Harmlessness/Red-Teaming Dataset** (42k comparisons)
- 众包工作者对抗性探测模型
- 选择更有害的回复(用于充分探索不良行为)
### 三阶段数据分布
1. **Base数据集**: 使用上下文蒸馏LM收集
2. **RS数据集**: 使用拒绝采样(16样本)+PM选择 (52k有用性, 2k无害性)
3. **Online数据集**: 使用迭代更新的RLHF模型收集 (22k有用性)
### 训练流程
```
预训练LM → 上下文蒸馏 → 初始策略 → RLHF (PPO) → 最终策略
↓ ↑
└── 偏好模型训练 ──────────────┘
```
## 关键发现
### 1. 对齐与能力的关系
| 模型规模 | RLHF效果 |
|---------|---------|
| 小型模型 | 对齐税 - 性能下降 |
| 13B/52B | 对齐红利 - Zero-shot提升 |
- 代码模型经自然语言RLHF后HumanEval提升
### 2. PM校准
- 仅在有用性数据上训练的PM校准良好
- 混合HH数据训练的PM略微欠自信
- PM分数忠实地编码人类偏好的概率
### 3. 专业化技能兼容性
- 与摘要任务混合训练无损性能
- Python代码模型经自然语言RLHF后编程能力提升
- 对齐训练可与特定技能训练结合
### 4. 性别偏见分析
- RLHF模型偏见分数更高(由于输出熵更低)
- 类似于将基础模型在T≈0.6温度下采样
## 评估指标
### NLP评估
- MMLU, Lambada, HellaSwag, OpenBookQA
- ARC-Easy/Challenge, TriviaQA
### 对齐评估
- HHH Evaluations (BIG-Bench)
- TruthfulQA (诚实性)
- BBQ-Lite (偏见)
- Bot Adversarial Dialogues
### 人工评估
- Elo评分系统比较不同模型
- 与专业写作者对比
## 关键公式
### Elo评分转换
```
Win Fraction = 1 / (1 + 10^(-ΔElo/400))
ΔElo ≈ 174 * ΔPM Score
```
### RLHF目标
```
R_total = R_helpfulness + λ * R_harmlessness
```
## OOD检测拒绝有害请求
使用**Simplified Relative Mahalanobis Distance**测量与有用性数据的偏离
| 模型 | AUROC | 说明 |
|-----|-------|-----|
| 52B (无异常暴露) | ~0.85 | 中间层最佳 |
| 52B (10个异常暴露) | 0.94 ± 0.02 | 显著提升 |
## 局限性与建议
### 局限性
1. 诚实性/真实性未作为主要焦点
2. 众包工作者分布不固定
3. 红队数据选择更有害回复可能影响训练
4. PM对对抗性样本不稳健
### 建议
- 收集红队数据时选择更有益的回复方向
- 使用其他技术(非纯人类反馈)训练诚实性
- 对齐数据应作为公共产品发布
## 激活词
RLHF, 人类反馈, 对齐训练, 有用性, 无害性, 偏好建模, PPO, 在线训练, Anthropic, 助手训练
## 参考资源
- 论文: https://arxiv.org/abs/2204.05862
- 数据集: https://github.com/anthropics/hh-rlhf
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!