# How Do You Collect Preference Data?

> How teams gather human and AI preference pairs, the rules labellers follow, and the bias traps to watch, explained simply for your AI interview.

**In short:** You show a model's answers to the same prompt to human labellers or a judge model, ask which one is better, and save each pick as a preferred answer and a non-preferred answer. Training learns from those pairs.

AI and LLM interview question Q307, Fine-tuning and adaptation. Intermediate, occasional (our estimate). From Venkat R. Murty's free Interview Kit: https://designervenkat.online/interview/ai/how-do-you-collect-preference-data

## Say it in 30 seconds

Preference data is a set of picks. For one prompt, the model writes a few answers, and a person or a judge model says which is better. Each pick becomes a preferred answer and a non-preferred answer. I write the rules first, have people rank two or more drafts per prompt, and check a sample by hand, because AI judges have known biases.

## Say it in 2 minutes

Preference data is a set of picks. For one prompt, the model writes several answers, and a labeller or a judge model says which one is better. Each pick is saved as a row: the prompt, a preferred answer and a non-preferred answer. Training then teaches the model to produce the kind of answer people picked. That is the same idea behind DPO, a method that learns straight from these rows.

There are two common sources. Human labellers read the drafts and rank them under written rules, such as which draft is more helpful or less toxic. An AI judge can pick the better draft with far fewer human labels, as Anthropic's Constitutional AI work showed. But AI judges do have known biases. They can favour an answer because of where it sits, or because it is longer. So I sample their picks and check them by hand.

The counting is simple. Ranking four drafts gives six pairs, since every draft can be compared with every other one. InstructGPT's labellers ranked between four and nine drafts per prompt, and its paper says the ranked pairs were an order of magnitude more than the prompts, which means about ten times more.

Before I train on any pairs, I keep some labellers aside. The InstructGPT paper tested its model on labellers who made none of its training picks, so I can tell whether the model learned the rules or one team's habits. The rules come first, so every labeller knows what to pick.

## What is preference data, in plain words?

Preference data is a set of picks. Each row holds three things: the prompt, a preferred answer and a non-preferred answer. Training reads the rows and nudges the model towards the answers people chose.

Picture a senior claims editor at an insurance company. She reads two drafts of a reply to a customer and marks the one she would send. That mark is one row of preference data.

A claims assistant that drafts those replies learns the same way. For each claim it writes several drafts, a labeller ranks them, and each ranking is saved as pairs. OpenAI's DPO guide describes the data as "prompts and pairs of responses", but the same page says "OpenAI is winding down the fine-tuning platform." Read it to learn the method, and do not plan a project around that service.

- **Prompt:** The question or task the model is given.
- **Labeller:** The person who reads the answers and picks the better one. Some teams use a judge model instead.
- **Preferred answer:** The draft that won the pick.

## How do teams collect the picks?

The steps below follow how OpenAI's InstructGPT, a model trained on human rankings, collected its data, and they scale down to a small team.

1. **Start with real prompts:** Take questions from real traffic, such as a claims team's emails with private details removed. InstructGPT's labellers were given prompts sent to its own API, with several model answers for each.
2. **Let the model write several drafts:** Give each prompt two or more drafts, so a labeller has a real choice. InstructGPT's labellers ranked between four and nine outputs per prompt.
3. **Ask labellers to rank them:** Labellers read every draft, then put them in order, best first. The InstructGPT paper says "labelers rank all the outputs for a given prompt".
4. **Turn each ranking into pairs:** Four ranked drafts give six pairs, since any two can be compared. Skip a tie, because it names no winner. Save each other pair as a row, with the higher draft as the preferred answer.
5. **Hold some labellers back:** Keep a few labellers whose picks never reach training. The InstructGPT paper tested its model on "held-out" labelers who made no training picks.
6. **Check agreement and fix the rules:** When labellers disagree, reread the rules first. Fix the rules, then relabel only the messy rows.
7. **Read real user feedback with care:** A thumbs-up, a thumbs-down or an edit a user made to a reply is a free pick, but a noisy one. A user may click without reading both answers.

*Diagram, From a prompt to preference pairs: Real prompts go to the model, which writes several drafts. Labellers rank them by written rules, or a judge model picks the better one. Either way, the picks become preferred and non-preferred pairs in one file.*
1. The model gets each real prompt and writes several drafts.
2. Labellers rank the drafts by the written rules.
3. Or a judge model picks the better draft.
4. Each human ranking is split into pairs and saved.
5. Each judge pick is saved as a pair too.

> **Tip:** Write the rules before the picks. InstructGPT's toxicity guidance covered the case where every draft looks plausible: "If all the outputs are plausible continuations of the input, prioritize differences in toxicity in your rankings, rather than differences in continuity."

Here is the ranking step in plain Python. A ranking goes in, and the pairs come out. It uses only the standard library.

```python
# Turn one labeller's ranking into preference pairs: every higher draft beats every lower one.
from itertools import combinations

def pairs_from_ranking(prompt, ranked):
    # ranked is best first, so the earlier draft in each pair is the preferred one
    return [
        {"prompt": prompt, "preferred": better, "non_preferred": worse}
        for better, worse in combinations(ranked, 2)
    ]

drafts = [
    "Reply A: cites policy clause 4.2",
    "Reply B: long, no clause",
    "Reply C: short apology",
    "Reply D: wrong refund amount",
]
rows = pairs_from_ranking("Why was my claim declined?", drafts)
print(len(rows), "pairs from", len(drafts), "drafts")
for row in rows[:3]:
    print(row["preferred"], "beats", row["non_preferred"])
```

Output:

```text
6 pairs from 4 drafts
Reply A: cites policy clause 4.2 beats Reply B: long, no clause
Reply A: cites policy clause 4.2 beats Reply C: short apology
Reply A: cites policy clause 4.2 beats Reply D: wrong refund amount
```

## Can an AI judge replace the people?

Sometimes. Anthropic's Constitutional AI paper used a model to evaluate which of the two samples is better, and says these methods help control AI behavior more precisely, with far fewer human labels.

RLHF means reinforcement learning from human feedback, a way to train a model on people's picks. The first card, from the DPO paper, describes these existing methods.

> "Existing methods for gaining such steerability collect human labels of the relative quality of model generations and fine-tune the unsupervised LM to align with these preferences, often with reinforcement learning from human feedback (RLHF)." (Direct preference optimization paper, 2023)
>
> "These methods make it possible to control AI behavior more precisely and with far fewer human labels." (Constitutional AI paper, 2022)
>
> "Our results reveal that strong LLM judges like GPT-4 can match both controlled and crowdsourced human preferences well, achieving over 80% agreement, the same level of agreement between humans." (LLM-as-a-judge paper, 2023)

The catch is bias. A 2023 paper on LLM judges names "position, verbosity, and self-enhancement biases" as limits, so a judge can favour an answer for where it sits, for its length, or because the model wrote it. The same paper found that strong judges like GPT-4 can match people well. So I use AI judges for volume and check a sample by hand.

Human picks have a clear source too. Anthropic's 2022 study used crowdworkers who chat with the model and "choose the more helpful of two model responses at every turn in the conversation".

## How much data do you really need, and how do you check it?

Here is a worked case with made-up numbers. A bank's card-dispute assistant has 2,000 real prompts, and labellers rank four drafts each. Four drafts give up to 6 pairs, fewer if labellers tie, so 2,000 prompts give up to 12,000 rows. Those rows share drafts, so they are not 12,000 independent votes.

The first sample of 1,200 rows showed a problem. Two labellers agreed on only about half the pairs, because the rules never said that a short, correct answer beats a long, wordy one. The fix was one line in the rules. Relabelling the 600 messy rows took about 10 hours at a minute a row. Now the team samples 10 percent before each training run, so the next gap shows early.

For scale, InstructGPT's paper says the RM dataset has 33k training prompts, drawn from the API and written by labelers.

*Diagram, Checking the picks before training: Human picks are checked for agreement between labellers, and judge picks are scanned for known biases such as a pull towards long answers. Only the pairs that pass go to training.*
1. Human picks are checked for agreement between labellers.
2. Judge picks are scanned for known biases.
3. Human pairs that agree go on to training.
4. Judge pairs that pass the scan go on too.

## What does the interviewer want to hear?

**A strong answer covers**

- [ ] A plain definition: a set of picks, each one a preferred and a non-preferred answer.
- [ ] Where the picks come from: labellers ranking drafts, or a judge model.
- [ ] The pair maths: four drafts make six pairs.
- [ ] The known bias of AI judges, named: position, length and self-preference.
- [ ] Written rules first, then a sample checked by hand.
- [ ] A held-out group of labellers, whose picks never train the model, to test it on people it has not learned from.

**Common traps**

- Trap: "Collect a million clicks, and the data is ready." Better: Volume helps only when the picks agree. Check agreement before you count rows.
- Trap: "The AI judge is always right, so skip the people." Better: A strong AI judge can match people, but it can still be wrong. Sample its picks and check them.
- Trap: "Let the model rate its own drafts." Better: A model can favour its own answers. Use a separate judge, and check it against people.

## Can you spot the weak rule?

**Spot the weak rule:** A labeller reads these rules for a claims-reply assistant. Which one will teach the model a bad habit?

A. Pick the reply that cites the right policy clause.
B. Pick the longer reply, since it looks more thorough.
C. Pick the reply a senior claims handler would send.
D. Pick the reply that needs no edits from the handler.

**Answer:** B. Length says nothing about quality. AI judges are known to favour longer answers, so a longer-is-better rule teaches the model to pad its replies.

**Quick check:** A team ranks 4 drafts for each of 300 prompts, with no ties. How many preference pairs does that make?

A. 300
B. 1,200
C. 1,800
D. 2,400

**Answer:** C. Four drafts give 6 pairs each, since every draft is compared with every other one. 300 prompts times 6 is 1,800.

## Can you answer these from memory?

**Flash cards**

- **What is a preference pair?** A prompt with a preferred answer and a non-preferred one.
- **Where do the picks come from?** Labellers ranking drafts, or a judge model choosing the better one.
- **How many pairs from 4 drafts?** Six. Every draft can be compared with every other one.
- **What is a held-out labeller?** A labeller whose picks never go into training, used to test the model.
- **Which biases do AI judges have?** Position, verbosity and self-enhancement, per a 2023 study.
- **Why keep a human check?** AI judges can be wrong. Sample and check their picks.

## Likely follow-up questions

- Q288 What is RLHF? https://designervenkat.online/interview/ai/what-is-rlhf
- Q289 What is a reward model? https://designervenkat.online/interview/ai/what-is-a-reward-model
- Q291 What is DPO? https://designervenkat.online/interview/ai/what-is-dpo
- Q250 What biases do judges have (position, length, self-preference)? https://designervenkat.online/interview/ai/llm-judge-biases
- Q294 How do you prepare a fine-tuning dataset? https://designervenkat.online/interview/ai/how-to-prepare-a-fine-tuning-dataset
