RLHF preference data: how to collect good chosen and rejected pairs
For companies4 min read
Preference data tells a model which of two answers people prefer. A good set has prompts that matter, candidate answers that differ in ways worth judging, and a ranking rule that your annotators can apply the same way. Disagreement between annotators is the main enemy.
What the data looks like
A preference record has a prompt, a chosen response and a rejected response. In Hugging Face's TRL library, the preference type uses exactly those three fields, and the docs recommend an explicit prompt column where possible.
{ "prompt": [{"role": "user", "content": "Summarise this clause ..."}], "chosen": [{"role": "assistant", "content": "The clause says ..."}], "rejected": [{"role": "assistant", "content": "This clause is about ..."}]}Source: Hugging Face TRL: dataset formats and types(opens in a new tab)
Why ranking, not scoring
The Hugging Face RLHF overview explains that annotators rank outputs because scores from different people are uncalibrated and noisy, while comparisons give a more reliable signal. It also warns that annotator disagreement is a source of variance and that RLHF performance depends on annotation quality.
Source: Hugging Face: Illustrating RLHF(opens in a new tab)
Choose prompts and candidates
- Prompts: from real use, covering common and hard cases. Easy prompts where every model is good produce pairs with little to learn from.
- Candidates: sample from the model you are training and from variants with different settings so the pairs differ in meaningful ways.
- Pairs: avoid pairs that differ only in length, since annotators will learn to pick the longer one and so will the model.
- Include ties and both-bad cases, with an explicit option for them.
Write a ranking rule that settles trade-offs
| Situation | Rule to write down |
|---|---|
| One answer correct, one longer and wrong | Correctness wins over detail |
| Both correct, one clearer | Prefer the clearer, mark the margin |
| One refuses, one complies with a harmful request | Refusal wins; mark severity |
| One refuses a harmless request | Compliance wins; the refusal is a defect |
| Both wrong | Mark both bad, do not force a pick |
Collect a strength of preference as well as the choice: slightly better, better, much better. It lets you filter out coin-flip pairs later.
Calibrate, then measure
- Have every annotator rank the same 20 pairs.
- Compute agreement. Cohen's kappa works for two raters and Krippendorff's alpha for more.
- Discuss each split pair and add the missing rule.
- Rank 20 new pairs and repeat until agreement stops improving.
- Keep double-ranking 10 to 20 percent of pairs during production.
Filter before training
- Drop pairs where two annotators disagreed and no senior ruling exists.
- Drop pairs with a very small preference margin.
- Check for annotator bias such as favouring one position or the longest answer.
- Keep the rationale for each pair; it helps debugging.
Watch for drift
Annotators change over time. They get faster, develop habits, or start reading the guideline more loosely. Seed gold pairs into each batch and track each person's agreement with the gold ranking over weeks. A slow slide is easier to fix early.
Do not mix up the stages
Preference pairs train a reward model or feed direct preference methods. Demonstrations teach the model what to write. Different data, different quality bars. Do not reuse pairs from one prompt for evaluation if you also train on them.
A worked pair
Prompt: explain what a force majeure clause does. Answer A gives a correct definition and one example. Answer B is longer, correct in the definition, but states that the clause always cancels the contract. A careful lawyer would pick A because B contains a wrong claim, even though B looks fuller. Mark the margin as clear. A rule that says correctness beats detail settles this pair in seconds. Without the rule, some annotators will pick B for being thorough, and the reward model will learn that length beats accuracy.
Spend effort where pairs are close
Pairs where one answer is obviously better teach little. The valuable pairs are the near ones, where careful reading is needed. Aim candidates at that zone by sampling several answers per prompt and choosing two that differ in a specific, judgeable way, and ask annotators for a short reason for each close pair.
Annotator fatigue
Ranking looks easy, and that is the danger. After an hour of comparing similar paragraphs, people start picking by habit. Limit session length, break up long answers into smaller comparisons where the task allows it, and seed gold pairs so you can see when attention drops. A slow rise in the share of first-position picks is a typical sign.
Curatrain's experts do preference ranking (RLHF) with written reasons, and every match is one you approve from a shortlist of people who passed the tests your project needs.