# Anthropic HH-RLHF (2022)

> 170k pairs of assistant replies to the same conversation, and which one a person preferred.

Page: https://mralbu.github.io/ai-datasets/d/hh-rlhf

## Key facts

- Category: LLMs
- Task: Human preference data for RLHF (helpful and harmless)
- Creators: Yuntao Bai et al. (Anthropic)
- Size: 169,352 comparisons
- Splits: train 160,800, test 8,552
- Input: A conversation between a person and an AI assistant
- Labels: Two final assistant replies; one marked chosen, one rejected
- License: MIT
- Paper: [Training a Helpful and Harmless Assistant with Reinforcement Learning from Human Feedback](https://arxiv.org/abs/2204.05862)
- Homepage: https://github.com/anthropics/hh-rlhf
- Hugging Face: [Anthropic/hh-rlhf](https://huggingface.co/datasets/Anthropic/hh-rlhf)
- Sampled at Hub revision 09be8c5bbc57cb3887f3a9732ad6aa7ec602a1fa (2026-11-07)

## Why it matters

One of the first large public datasets of the human comparisons behind RLHF. A reward model learns to score the chosen reply above the rejected one, and the assistant is then trained to get high scores. It became the standard open dataset for reward models and preference methods: the DPO paper and many after it report results on "Anthropic HH".

## Worth knowing

- Crowdworkers chatted with early Anthropic models and picked the better of two replies at each turn. Helpfulness data rewards the more helpful reply; harmlessness data comes from people trying to get a harmful one.
- Because of the red-teaming, the dataset contains offensive and harmful requests on purpose. Samples here were picked to avoid the worst.
- Chosen and rejected share the whole conversation and differ only in the last assistant reply.
- Preference labels are noisy; the two replies are often both fine, or both bad.

## Get the data

```bash
# pip install -U huggingface_hub
hf download Anthropic/hh-rlhf --repo-type dataset \
  --local-dir hh-rlhf
```

```python
from datasets import load_dataset   # pip install datasets

ds = load_dataset("Anthropic/hh-rlhf")
print(ds)
```

```python
import polars as pl

df = pl.read_parquet("hf://datasets/Anthropic/hh-rlhf@~parquet/default/test/*.parquet")
print(df.shape)
```

## Related datasets

- [Alpaca](https://huggingface.co/datasets/tatsu-lab/alpaca): 2023, instruction data for the step before RLHF (on this site: https://mralbu.github.io/ai-datasets/d/alpaca)
- [UltraFeedback](https://huggingface.co/datasets/openbmb/UltraFeedback): 2023, preferences rated by GPT-4 instead of people
- [Chatbot Arena Conversations](https://huggingface.co/datasets/lmsys/chatbot_arena_conversations): 2023, real user votes between two models (gated)

## Landmark papers

- [Constitutional AI: Harmlessness from AI Feedback](https://arxiv.org/abs/2212.08073) (2022)
- [Direct Preference Optimization (DPO)](https://arxiv.org/abs/2305.18290) (2023)

## Papers on this site that use it

- [Helpful and harmless (2022)](https://mralbu.github.io/ai-datasets/p/helpful-harmless.md): Anthropic's RLHF assistant, and the public preference data on helpfulness and harmlessness that much of open alignment research has trained on since.
- [DPO (2023)](https://mralbu.github.io/ai-datasets/p/dpo.md): RLHF without the reinforcement learning, as one simple loss on pairs of preferred and rejected answers.
