Constitutional and Principle-Based Alignment › The Math of the Preference Stage

Michael BrenndoerferNovember 29, 20264 min read
Language AI HandbookAll chapters
Part 38 of 67Scalable Oversight and Safety Training
Chapter 288Constitutional and Principle-Based Alignment › The Math of the Preference Stage
Reading section 5 of 12 · The Math of the Preference Stage · 4 minSection 5 of 12 · 4 min

Section 5 of 12 · 4 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

From a Score Difference to a Choice

A preference model assigns a scalar score to a prompt and response. A Bradley–Terry model turns the score difference into the probability that response aa beats response bb. Write xx for their shared prompt, ϕ\phi for the preference-model parameters, and Δ\Delta for the difference.

Δ=rϕ(x,a)−rϕ(x,b),P(a≻b∣x)=σ(Δ),σ(z)=11+e−z.\Delta = r_\phi(x,a)-r_\phi(x,b), \qquad P(a \succ b \mid x)=\sigma(\Delta), \qquad \sigma(z)=\frac{1}{1+e^{-z}}.

Equal scores give probability 1/21/2. The probability rises above 1/21/2 when the model scores aa higher. Adding the same constant to the two scores leaves the probability unchanged, so this comparison identifies differences rather than an absolute reward level.

Soft Labels from an AI Labeler

Let ℓA\ell_A and ℓB\ell_B be the feedback model's log probabilities for the two answer-option tokens at the same choice position. Normalize the two probabilities over those options. This calculation assumes both options are represented by single tokens in the chosen format.

p=eℓAeℓA+eℓB=σ(ℓA−ℓB).p=\frac{e^{\ell_A}}{e^{\ell_A}+e^{\ell_B}}=\sigma(\ell_A-\ell_B).

For example, if the probabilities of the option tokens are 0.3 and 0.2, the two-option target for aa is 0.3/(0.3+0.2)=0.60.3/(0.3+0.2)=0.6. The remaining probability mass can be assigned to other tokens by the language model. A 0.6 target is a soft label, and its empirical calibration has to be measured separately.

The binary cross-entropy below penalizes the preference model when its predicted probability σ(Δ)\sigma(\Delta) departs from that target. The expectation averages over the training comparisons. A chosen-first hard target p=1p=1 leaves just the term −log⁡σ(Δ)-\log \sigma(\Delta).

L(ϕ)=−E[plog⁡σ(Δ)+(1−p)log⁡(1−σ(Δ))].\mathcal{L}(\phi)=-\mathbb{E}\left[p\log\sigma(\Delta)+(1-p)\log(1-\sigma(\Delta))\right].

Averaging repeated independent judgments can help estimate the mean of the judge's scores. It leaves systematic errors in that mean. Bai et al. studied using multiple principles across their labeling data. The authors also sampled principles in their rationale-conditioned prompts. For the main results with those prompts, they clamped the near-binary probabilities produced after the model gave a rationale.

Repeated Judgments and Shared Error

Suppose mm repeated scores each have a constant offset bb and independent zero-mean errors of variance σ2\sigma^2. The average error has mean bb and variance σ2/m\sigma^2/m. Squaring and taking the average gives mean squared error b2+σ2/mb^2+\sigma^2/m. This model treats scores as numbers with additive error. It illustrates why agreement across repeated samples can coexist with a systematic mistake.

PythonIn [5]
CollapseExpand
import numpy as np

m_values = np.arange(1, 31)
sigma_ind = 0.20
bias = 0.08

independent_rmse = np.sqrt(sigma_ind**2 / m_values)
shared_bias_rmse = np.sqrt(bias**2 + sigma_ind**2 / m_values)
VisualizationOut [6]
CollapseExpand
Two decreasing error curves. The curve for a fixed offset stays above a dashed line at 0.08.
Root mean squared error of the average of m scores with independent errors of standard deviation 0.20, with and without a fixed 0.08 offset. The offset leaves an error floor as the noise shrinks.

The curve with the offset approaches 0.08 as the number of samples increases. Both curves use the same independent noise at each sample count.

The RL Objective

A simplified objective balances expected preference score and drift from a reference policy. πθ\pi_\theta is the policy being trained, πref\pi_\mathrm{ref} is a fixed reference, and β≥0\beta\geq 0 sets the strength of the penalty. The inner expectation is over responses yy to prompt xx. The KL divergence compares the two response distributions for that prompt.

max⁡θ  Ex[Ey∼πθ(⋅∣x)[rϕ(x,y)]−βDKL ⁣(πθ(⋅∣x) ∥ πref(⋅∣x))].\max_{\theta}\;\mathbb{E}_x\left[ \mathbb{E}_{y\sim\pi_\theta(\cdot\mid x)}[r_\phi(x,y)]- \beta D_\mathrm{KL}\!\left(\pi_\theta(\cdot\mid x)\,\|\,\pi_\mathrm{ref}(\cdot\mid x)\right) \right].

This objective gives the policy a reason to pursue higher-scoring responses while limiting distributional drift. The penalty measures difference from the reference distribution. It cannot certify that a response follows a particular rule. Under the ordinary finite-KL assumption, every response with positive probability under the policy must have positive probability under the reference. For an intuitive two-response example, suppose the reference chooses each with probability one half. Putting all mass on one reply has forward KL of log⁡2\log 2 nats, whereas keeping the probabilities at one half gives zero KL. The higher-scoring reply can justify increasing its probability under the objective even when moving all the way to a deterministic choice incurs too large a penalty. See the earlier PPO chapter for the distinction between this objective and PPO's clipped update rule.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy