LLMs & GenAI

Curating Preference Data

Building high quality preference datasets of chosen and rejected response pairs for RLHF and DPO alignment.

🔴 advanced5 min readalignmentdata
Preference Data Curation generates pairwise comparison datasets containing a Prompt x, a Chosen response y_w (winning), and a Rejected response y_l (losing). These datasets train Reward Models for RLHF and directly align models using DPO. Quality depends on Annotator Inter Rater Reliability, hard negative sampling, domain diversity, and filtering out superficial biases like response length.

What is a Preference Dataset?

Supervised Fine Tuning (SFT) teaches an LLM how to format responses using single prompt response pairs $(x, y)$.

Reinforcement Learning from Human Feedback (RLHF) and Direct Preference Optimization (DPO) require Pairwise Preference Datasets:

$$\mathcal{D}{\text{preference}} = { (x^{(i)}, y_w^{(i)}, y_l^{(i)}) }{i=1}^N$$

  1. Prompt ($x$): The user instruction or query.
  2. Chosen Response ($y_w$): The preferred, winning response.
  3. Rejected Response ($y_l$): The non preferred, losing response.
  Prompt (x): "Explain quantum computing in one sentence."

  Chosen Response (y_w):  "Quantum computing uses quantum mechanics principles like superposition to process complex information faster than classical computers."

  Rejected Response (y_l): "It is a new fast computer that uses Qubits to run programs." (Lacks precision!)

How Preference Pairs Are Created

┌──────────────────────────┬──────────────────────────┬──────────────────────────┐
│ 1. HUMAN ANNOTATION      │ 2. MODEL SELF PAIRING    │ 3. AI JUDGE (RLAIF)      │
├──────────────────────────┼──────────────────────────┼──────────────────────────┤
│ Human crowd workers      │ Sample two outputs from  │ Generate responses from  │
│ write responses or rank  │ target model: one with   │ multiple models. Use     │
│ model candidate outputs. │ high temperature, one    │ GPT-4 judge with rubrics │
│ High cost, high quality. │ with low temperature.    │ to rank win/loss pairs.  │
└──────────────────────────┴──────────────────────────┴──────────────────────────┘

Common Biases in Preference Data

Human annotators introduce systematic biases that can corrupt alignment models:

  1. Verbosity Bias: Annotators consistently rate longer responses as higher quality, even when they contain unnecessary filler words.
  2. Formatting Bias: Annotators favor responses with bold headers, bullet points, and markdown styling over plain text.
  3. Sycophancy Bias: Annotators prefer responses that politely agree with their opinions, even when the user premise is factually wrong.

Mitigation Strategies

Key Open Preference Datasets

  1. HH-RLHF (Anthropic): 160k human preference pairs covering Helpful and Harmless dimensions.
  2. UltraFeedback (OpenBMB): 64k prompts with responses generated from 4 distinct LLMs, annotated by GPT-4 across fine-grained rubrics.
  3. LMSYS Chatbot Arena: Real-world crowd-sourced side-by-side battle rankings across frontier models.

Say this out loud

Preference Data Curation builds pairwise datasets containing prompt x, chosen response y_w, and rejected response y_l. These pairs train Reward Models and DPO alignment algorithms. High-quality curation requires filtering out human biases like verbosity and formatting bias, using multi-aspect rubrics or AI LLM judges like UltraFeedback to generate preferences at scale.

Followups to expect

Check yourself

Question 1 of 3

What are the three components comprising a single sample in a Preference Dataset for DPO or RLHF training?

More in LLMs & GenAI

See all →
Pretraining → SFT → RLHF5 minFine-Tune vs RAG vs Prompt: Choosing5 minRetrieval-Augmented Generation5 min