Skip to content
Skip to lesson
Back to Topics
HardAlignment & Safety13 min read

RLHF & DPO Alignment

An internal reward score can climb while blinded human comparisons stay flat. Turn preference pairs into a PPO update or a DPO loss, and verify the real behavior change.

On this page

Your candidate raises internal reward-model score by +0.31, yet wins only 184 of 400 blinded human comparisons while growing 48 tokens longer and prepending "Verified answer:". Would you ship it?

That divergence between proxy score and human preference defines alignment engineering. On our Python softmax(z) overflow question, subtracting max(z) before exp(z) scored 1.80 while casting to float64 after exp(z) scored 0.70 (a 1.10 margin, ~75% win probability). Should you optimize the policy online against that with , or directly on preference pairs with ?

What preference pairs add to SFT

imitates demonstrations yet still leaves subtle bugs, verbosity, and miscalibrated refusals.[1] Pairwise preferences give the optimizer an explicit contrast on the exact same prompt (pushing "subtract max(z) before exp(z)" above "cast after exp(z)"), and comparing two outputs is faster to label than writing gold answers from scratch.

A single softmax overflow prompt branches into two answers: A (chosen) subtracts max(z) before exp(z) with score 1.80, and B (rejected) casts after exp(z) with score 0.70. On the right, a shared score axis marks the 1.10 reward margin mapping through Bradley-Terry to P(A preferred over B) = sigma(1.10) approximately 0.750.
A 1.10 reward margin maps through Bradley-Terry to ~75% preference for subtracting `max(z)` before `exp(z)`.

RLHF: a judge, then an actor

Classic RLHF runs three stages: SFT, reward modeling under Bradley-Terry loss LRM=−E[log⁡σ(r(x,yw)−r(x,yl))]\mathcal{L}_{\text{RM}} = -\mathbb{E}[\log\sigma(r(x, y_w) - r(x, y_l))], and online optimizing expected reward minus a penalty from the frozen SFT reference πref\pi_{\text{ref}}:[2][1][3]

max⁡θ  Ex, y∼πθ(⋅∣x)[r(x,y)]−β Ex[DKL ⁣(πθ(⋅∣x)∥πref(⋅∣x))]\max_\theta \; \mathbb{E}_{x,\, y \sim \pi_\theta(\cdot \mid x)} \left[ r(x, y) \right] - \beta \, \mathbb{E}_{x} \left[ \mathbb{D}_{\text{KL}}\!\left(\pi_\theta(\cdot \mid x) \parallel \pi_{\text{ref}}(\cdot \mid x)\right) \right]

For fixed rr and xx, factoring −β-\beta reveals an exact closed-form optimum (intractable to sample directly because Z(x)Z(x) sums over all strings, which PPO approximates via rollouts and DPO cancels algebraically[4]):

π∗(y∣x)=1Z(x)πref(y∣x)exp⁡ ⁣(r(x,y)β),Z(x)=∑yπref(y∣x)exp⁡ ⁣(r(x,y)β)\pi^*(y \mid x) = \frac{1}{Z(x)} \pi_{\text{ref}}(y \mid x) \exp\!\left( \frac{r(x, y)}{\beta} \right), \qquad Z(x) = \sum_y \pi_{\text{ref}}(y \mid x) \exp\!\left(\frac{r(x, y)}{\beta}\right)

Token-level reward shaping and the four model roles

PPO coordinates four logical roles: trainable actor (πθ\pi_\theta) and critic (VψV_\psi), plus frozen reference (πref\pi_{\text{ref}}) and reward model (rϕr_\phi). With four separate 70B backbones (16 B/param trainable, 2 B/param frozen), state alone takes 2,520 GB (1,120 each for actor/critic, 140 each for ref/reward); dropping the critic cuts 44.4% to 1,400 GB (in practice roles can share weights or use smaller critics, and frameworks like OpenRLHF support colocated or async rollout engines[5]).

We charge the per-token KL drift −β(log⁡πold−log⁡πref)-\beta(\log\pi_{\text{old}} - \log\pi_{\text{ref}}) at every token and add rϕ(x,y)r_\phi(x, y) at final token TT. Generalized Advantage Estimation (GAE) propagates terminal reward backward via δt=Rt+γV(st+1)−V(st)\delta_t = R_t + \gamma V(s_{t+1}) - V(s_t) and A^t=δt+γλA^t+1\hat{A}_t = \delta_t + \gamma\lambda \hat{A}_{t+1} (V(sT+1)=0V(s_{T+1}) = 0 at true termination):[6]

terminal_credit_and_kl_shaping.py
def gae(rewards: list[float], values: list[float], lam: float, gamma: float = 1.0) -> list[float]:
    adv, running = [0.0] * len(rewards), 0.0
    for t in reversed(range(len(rewards))):
        running = (rewards[t] + gamma * values[t + 1] - values[t]) + gamma * lam * running
        adv[t] = running
    return adv
GAE credit and KL-shaped reward
GAE lambda=1.0 -> [1.0, 1.0, 1.0]
GAE lambda=0.5 -> [0.25, 0.5, 1.0]
near_reference : raw=1.20, log_ratio=+0.1, shaped=1.18
preamble_hack  : raw=1.35, log_ratio=+1.6, shaped=1.03
Three token transitions have rewards 0, 0, and 1. The critic predicts zero at all four states, including terminal V3, so the TD residuals are 0, 0, and 1. Backward GAE accumulation gives advantages [1, 1, 1] at lambda 1 and [0.25, 0.5, 1] at lambda 0.5; arrows point from the terminal decision toward earlier tokens.
Backward GAE carries terminal reward to earlier tokens; smaller λ\lambda decays credit further from the end.
One sampled response produces reward 1.35 and a sampled reference charge of 0.32, giving return 1.03. The critic value 0.80 is subtracted to produce advantage 0.23. With policy ratio 1.20, the clipped surrogate is 0.276. Reward and reference are frozen roles; critic and actor are trainable roles. This example does not imply four simultaneously resident model copies.
One PPO step across all four logical roles: return `1.03`, critic `0.80`, advantage `0.23`, clipped surrogate `0.276`.

What PPO actually clips

Across rollout-batch epochs, PPO forms ratio ρt(θ)=πθ(at∣st)/πold(at∣st)\rho_t(\theta) = \pi_\theta(a_t \mid s_t) / \pi_{\text{old}}(a_t \mid s_t) (denominator is the rollout snapshot πold\pi_{\text{old}}, not πref\pi_{\text{ref}}) and maximizes:

Lt=min⁡ ⁣(ρtA^t,  clip⁡(ρt,1−ϵ,1+ϵ)A^t)L_t = \min\!\left(\rho_t \hat{A}_t,\; \operatorname{clip}(\rho_t, 1 - \epsilon, 1 + \epsilon)\hat{A}_t\right)

Clipping removes gradient incentive past 1+ϵ1+\epsilon when A^t>0\hat{A}_t > 0 or below 1−ϵ1-\epsilon when A^t<0\hat{A}_t < 0, while leaving harmful moves fully penalized (it is not a hard clamp on probabilities or KL).

ppo_clipped_surrogate.py
def surrogate(ratio: float, advantage: float, epsilon: float = 0.2) -> float:
    return min(ratio * advantage, min(max(ratio, 1 - epsilon), 1 + epsilon) * advantage)

for advantage in (1.0, -1.0):
    print(f"A={advantage:+.0f} at [0.5, 1.0, 1.5] -> {[round(surrogate(r, advantage), 2) for r in (0.5, 1.0, 1.5)]}")
PPO clipped surrogate
A=+1 at [0.5, 1.0, 1.5] -> [0.5, 1.0, 1.2]
A=-1 at [0.5, 1.0, 1.5] -> [-0.8, -1.0, -1.5]
Two side-by-side PPO clipped-surrogate panels show the probability ratio from 0.5 to 1.5 with epsilon 0.2. For positive advantage A > 0 (left), the solid clipped objective flattens at +1.2 once ratio exceeds 1.2 while the dashed unclipped line keeps climbing. For negative advantage A < 0 (right), the solid clipped objective flattens at -0.8 below 0.8 while still penalizing harmful moves above 1.0.
Solid curves show the clipped PPO objective; clipping flattens overshoot incentives while keeping harmful moves penalized.

DPO: turn reward fitting into policy fitting

Why an offline loss can stand in for RL

Solving the closed-form optimal policy for r(x,y)r(x, y) gives r(x,y)=βlog⁡π∗(y∣x)πref(y∣x)+βlog⁡Z(x)r(x, y) = \beta \log \frac{\pi^*(y \mid x)}{\pi_{\text{ref}}(y \mid x)} + \beta \log Z(x). Substituting into Bradley-Terry cancels Z(x)Z(x) identically, defining implicit reward r^θ(x,y)=βlog⁡πθ(y∣x)πref(y∣x)\hat{r}_\theta(x, y) = \beta \log \frac{\pi_\theta(y \mid x)}{\pi_{\text{ref}}(y \mid x)} and the DPO objective:[4]

LDPO(θ)=−E(x,yw,yl)[log⁡σ ⁣(βlog⁡πθ(yw∣x)πref(yw∣x)−βlog⁡πθ(yl∣x)πref(yl∣x))]\mathcal{L}_{\text{DPO}}(\theta) = -\mathbb{E}_{(x, y_w, y_l)} \left[ \log \sigma\!\left( \beta \log \frac{\pi_\theta(y_w \mid x)}{\pi_{\text{ref}}(y_w \mid x)} - \beta \log \frac{\pi_\theta(y_l \mid x)}{\pi_{\text{ref}}(y_l \mid x)} \right) \right]

Differentiating produces a hard-pair-weighted push-pull update:

∇θLDPO=−β E[σ(r^l−r^w)(∇θlog⁡πθ(yw∣x)−∇θlog⁡πθ(yl∣x))]\nabla_\theta \mathcal{L}_{\text{DPO}} = -\beta \, \mathbb{E} \left[ \sigma(\hat{r}_l - \hat{r}_w) \left( \nabla_\theta \log \pi_\theta(y_w \mid x) - \nabla_\theta \log \pi_\theta(y_l \mid x) \right) \right]

Notice the dual role of β\beta: for fixed preference odds p/(1−p)p/(1-p) over a uniform reference, the ideal optimal policy has odds (p/(1−p))1/β(p/(1-p))^{1/\beta} (so larger β\beta stays closer to πref\pi_{\text{ref}}), while at initialization (m=0m=0) the loss slope for one observed vote is ∂L/∂m=−β/2\partial L / \partial m = -\beta / 2 (larger β\beta scales initial gradient magnitude up).

Computing DPO from token logits

On our softmax(z) pair, suppose summed response log-probabilities are chosen (-8.2 policy, -8.5 ref) and rejected (-9.5 policy, -9.1 ref) with β=0.1\beta = 0.1: the chosen log-ratio is +0.3, the rejected log-ratio is -0.4, the margin is +0.7, the scaled logit is 0.07, and the DPO loss is −ln⁡σ(0.07)≈0.659-\ln\sigma(0.07) \approx 0.659.

Sum response log-probabilities across response tokens plus EOS only, shifting logits by one and masking prompt and padding positions by index (never by token ID, since 0 can be valid content):

dpo_loss_from_token_logits.py

def response_logprob(logits: torch.Tensor, ids: torch.Tensor) -> torch.Tensor:
    token_logp = F.log_softmax(logits[:-1], dim=-1).gather(-1, ids[1:].unsqueeze(-1)).squeeze(-1)
    resp_mask = attn_mask[1:].clone()
    resp_mask[: prompt_len - 1] = False
    return (token_logp * resp_mask).sum()

c_logp, r_logp = response_logprob(chosen_pi, chosen_ids), response_logprob(rejected_pi, rejected_ids)
margin = (c_logp - response_logprob(chosen_ref, chosen_ids)) - (r_logp - response_logprob(rejected_ref, rejected_ids))
loss = -F.logsigmoid(beta * margin)
loss.backward()
DPO token logprob loss in PyTorch
chosen=-0.993, rejected=-1.882, margin=0.640, loss=0.662
zero grad on prompt/pad: True

Likelihood displacement and TRL setup

Because DPO maximizes the difference between chosen and rejected log-ratios, the margin can climb (0 -> +1.50) while both responses drop below reference likelihood (rejected simply falls faster), a phenomenon Razin et al. called likelihood displacement (DPOP adds a penalty when chosen drops below reference).[8][9] Monitor log⁡πθ(yw)\log\pi_\theta(y_w), log⁡πθ(yl)\log\pi_\theta(y_l), margin, and held-out generations together.

The pairwise margin climbs from 0 to 1.50 even as the chosen response falls below its SFT reference likelihood.

In TRL's DPOTrainer, precompute_ref_log_probs=True caches reference sums and valid target counts per (prompt, completion) so only one model stays in GPU memory,[10][11] meaning uncached completions cannot be scored against the freed reference later (pass all eval splits upfront and set max_length so differences aren't truncated).[7][12]

trl_dpo_setup_fragment.py
from trl import DPOConfig, DPOTrainer

trainer = DPOTrainer(
    model=sft_checkpoint, processing_class=tokenizer,
    args=DPOConfig(output_dir="runs/softmax-dpo", beta=0.1, precompute_ref_log_probs=True,
                   max_length=2048, learning_rate=5e-6, max_steps=200),
    train_dataset=train_pairs, eval_dataset=eval_pairs,
)
trainer.train()

Comparing RLHF and DPO

RLHF and DPO trade online exploration against simplicity:[1][4] PPO samples fresh completions every step (4 logical roles, rollout cost, reward hacking risk), whereas vanilla DPO optimizes a fixed offline pair set (2 roles, lower cost, vulnerable to stale pairs and unseen-response mass).

PPO draws a fresh response from the current actor, scores it with reward, reference, and critic roles, then updates the actor for a later rollout. Vanilla DPO keeps one stored chosen/rejected pair, scores the same responses under the updated policy and a frozen reference cache, computes pairwise loss, and updates the policy to rescore that stored pair. The DPO path does not sample new responses.
PPO scores fresh completions from the live policy every step; vanilla DPO optimizes against a fixed pair dataset.
DimensionRLHF (PPO)Vanilla DPO
Reward modelSeparate trained scorer rϕr_\phiImplicit in βlog⁡(πθ/πref)\beta \log(\pi_\theta/\pi_{\text{ref}})
LoopOn-policy RL with live rolloutsOffline pairwise classification
Logical rolesActor, reference, reward, criticPolicy, reference (can precompute)
Online explorationYes: sees new failures it inventsNo, unless pairs refresh iteratively
Primary risksReward hacking, critic noise, rollout costStale pairs, unseen mass, displacement

DPO's blind spot: the answer nobody compared

With three candidate answers (A correct, B buggy, unseen C buggy), any two policies keeping identical 4:1 A-to-B odds incur the exact same DPO loss even if unseen C absorbs 90% of probability mass:

dpo_unseen_response_mass.py
from math import exp, log, log1p

ref = {"A": 1 / 3, "B": 1 / 3, "C": 1 / 3}
for name, pi in [("Policy 1", {"A": 0.40, "B": 0.10, "C": 0.50}), ("Policy 2", {"A": 0.08, "B": 0.02, "C": 0.90})]:
    margin = log(pi["A"] / ref["A"]) - log(pi["B"] / ref["B"])
    print(f"{name}: A/B odds={pi['A'] / pi['B']:.1f}, DPO loss={log1p(exp(-0.1 * margin)):.4f}, unseen C={pi['C']:.0%}")
Unseen response coverage
Policy 1: A/B odds=4.0, DPO loss=0.6262, unseen C=50%
Policy 2: A/B odds=4.0, DPO loss=0.6262, unseen C=90%
A probability simplex contains a uniform reference and two policies. Policy 1 assigns probabilities 0.40, 0.10, and 0.50 to A, B, and unseen C; policy 2 assigns 0.08, 0.02, and 0.90. Both keep A-to-B odds at 4 to 1, so the DPO pair loss remains 0.62623 at beta 0.1 while C mass rises from 50 to 90 percent.
Along the constant A/B odds line, DPO loss stays frozen at `0.62623` while unseen bug C climbs from 50% to 90% mass.

Iterative / Online DPO closes this gap without a critic by periodically sampling fresh pairs from the current policy, labeling them, and updating again.[13]

When the proxy lies

Returning to our opening candidate (+0.31 reward, +48 tokens, "Verified answer:" prefix, 184/400 human wins): check reward hacking (length gaming, sycophancy, format exploitation) with controlled rewrites, and remember DPO's 0.693 (ln⁡2\ln 2) step-0 loss is normal (if it stays stuck, check optimizer updates, contradictory labels, or truncation).

Never ship on internal reward alone. Gate promotion on blinded held-out human comparisons using a 95% Wilson CI (lower bound > 50%) plus a length-growth cap (+20 tokens):[14] 184/400 gives 46.0% with 95% Wilson CI [41.2%, 50.9%], failing both checks.

A release example records 184 wins in 400 blinded comparisons, a 46.0 percent rate with a 95 percent Wilson interval from 41.2 to 50.9 percent that crosses the 50 percent baseline. Proxy reward rises by 0.31, while mean response length grows 48 tokens against a 20-token limit. The lower-confidence win gate and length gate both fail, so promotion is held; the interval shows neither improvement nor degradation.
The 95% Wilson interval crosses 50% and length jumps 48 tokens, overriding the `+0.31` proxy reward gain.
MethodMechanismTradeoff
IPO[15]Squared loss E[(m−12τ)2]\mathbb{E}[(m - \frac{1}{2\tau})^2] targeting finite margin 1/(2τ)1/(2\tau) (derivative 2(m−12τ)2(m - \frac{1}{2\tau}))Curbs runaway margins on deterministic pairs
KTO[16]Unpaired desirable/undesirable labels around z0z_0 (raising log-ratio lowers desirable loss, raises undesirable loss)No pairs needed; sensitive to selection bias
ORPO[17]SFT + odds-ratio penalty in one stage, no reference modelSaves reference VRAM; couples SFT and preference
SimPO[18]Length-normalized average token log-prob + target margin, no referenceCuts length bias; check completeness
GRPO[19][20]Online RL without a critic: standardizes rewards across GG rollouts per promptCuts critic VRAM; flat groups give zero advantage

GRPO: group-relative advantage without a critic

GRPO samples GG completions per prompt, scores each, and standardizes within the group (A^i=(ri−μ)/(σ+ϵ)\hat{A}_i = (r_i - \mu) / (\sigma + \epsilon)), applying A^i\hat{A}_i to every token inside a clipped surrogate plus a non-negative KL penalty ki,t=exp⁡(ℓi,t)−ℓi,t−1k_{i,t} = \exp(\ell_{i,t}) - \ell_{i,t} - 1 (ℓi,t=log⁡(πref/πθ)\ell_{i,t} = \log(\pi_{\text{ref}} / \pi_\theta)):[19][20]

LGRPO=−1G∑i=1G1Ti∑t=1Ti[min⁡ ⁣(ρi,tA^i,  clip⁡(ρi,t,1−ϵ,1+ϵ)A^i)−βki,t]\mathcal{L}_{\text{GRPO}} = -\frac{1}{G}\sum_{i=1}^G \frac{1}{T_i}\sum_{t=1}^{T_i} \left[\min\!\left(\rho_{i,t}\hat{A}_i,\; \operatorname{clip}(\rho_{i,t}, 1-\epsilon, 1+\epsilon)\hat{A}_i\right) - \beta k_{i,t}\right]

When every rollout in a group earns the same reward, σ=0\sigma = 0 and all reward advantages collapse to 0.0 while any separate KL penalty stays active (TRL tracks frac_reward_zero_std and defaults beta=0.0 unless enabled).[21][22]

grpo_ipo_kto_signals.py

print("GRPO mixed:", group_advantages([1.0, 0.0, 0.5, 1.0]), "| flat:", group_advantages([1.0] * 4))
print("IPO (tau=0.1, target=5) at m=[0,5,10]:", [round((m - 5.0) ** 2, 1) for m in (0.0, 5.0, 10.0)])
print(f"KTO desirable 1->2: {kto_loss(1.0, True):.3f}->{kto_loss(2.0, True):.3f} | undesirable 1->2: {kto_loss(1.0, False):.3f}->{kto_loss(2.0, False):.3f}")
GRPO group advantages and IPO/KTO signals
GRPO mixed: [0.905, -1.508, -0.302, 0.905] | flat: [0.0, 0.0, 0.0, 0.0]
IPO (tau=0.1, target=5) at m=[0,5,10]: [25.0, 0.0, 25.0]
KTO desirable 1->2: 0.401->0.289 | undesirable 1->2: 0.599->0.711
Four completion rewards [1, 0, 0.5, 1] have population mean 0.625 and standard deviation about 0.4146. Subtracting the mean and dividing by the standard deviation yields signed advantages [+0.90, −1.51, −0.30, +0.90]. A uniform group [1, 1, 1, 1] has zero standard deviation and assigns zero reward advantage to every sample while a separate KL penalty remains active.
GRPO centers and scales rewards within each prompt group; identical rewards give zero reward-driven advantages while separate KL penalties remain active.

Constitutional AI, RLAIF, and automated red teaming

Constitutional AI (CAI) scales safety alignment from a written constitution in two phases:[23][24]

  1. SL-CAI (critique-revision SFT): Elicit red-team draft y0y_0, critique and revise against a principle into y∗y^*, and run SFT on (x,y∗)(x, y^*) only.
  2. RLAIF: Sample pairs from πSL\pi_{\text{SL}}, extract soft AI-judge preferences q∈(0,1)q \in (0, 1) averaged across swapped A/B orders to cancel position bias, fit a soft cross-entropy reward model (dLdd=σ(d)−q\frac{d\mathcal{L}}{dd} = \sigma(d) - q), and run RL alongside human helpfulness labels.[23][25]

Automated red teaming probes both single-turn and multi-turn escalations (such as Crescendo[26][27]) across held-out attack families. Always pair Attack Success Rate (ASR) with False Refusal Rate (FRR) on benign lookalikes, report unjudged coverage bounds rather than treating unresolved attempts as passes, and keep alignment separate from access control: enforce auth, tenant permissions, and tool validation in deterministic code backed by classifiers such as Llama Guard 4 or Constitutional Classifiers++.[28][29][30]

Check your understanding

Mastery Check

Check each question as you go, or answer all of them and check together. Score 75% or higher to complete this lesson.

0 of 10 answered
1.Use the four separate logical backbones taught for PPO-style RLHF, each with 3 billion parameters. Trainable state uses 16 bytes per parameter and frozen state 2. Which aggregate budget and frozen-role pairing follow, before activation or rollout storage?
2.For three generated tokens, the old policy’s log probabilities minus the reference log probabilities are [0.2, −0.1, 0.4]. Use beta 0.5 for the drift charge and add the sequence reward of 2 only at the last token. With gamma 1, lambda 0.5, four zero critic values and a true terminal step, what are the three GAE advantages?
3.In a stored PPO batch, two sampled tokens have probability ratios of 0.6 and 1.4. Both advantages are −2, and epsilon is 0.2. What are the two clipped surrogate values, in that order, and which policy supplies the denominator of each ratio?
4.Chosen policy/reference summed response log scores are −4.2/−5.0; rejected scores are −6.3/−5.9. With beta 0.4, which unscaled margin, scaled logit and observed-label DPO loss follow?
5.A DPO input has token IDs [2, 0, 1, 3, 0, 4, 0]. The first three tokens form the prompt, the attention mask is [1, 1, 1, 1, 1, 1, 0], and ID 4 ends the response. Which target positions count, starting from index 0? For a separate pair, the chosen log ratios sum to 1.20 over 4 targets and the rejected log ratios sum to 0.90 over 2. Both counts include the end token. The summed margin is +0.30. What chosen-minus-rejected margin do the per-token means give?
6.A and B are the only answers to a prompt. The DPO reference gives them equal probability, and reviewers choose A 80% of the time. For beta 0.5 and then beta 1, what probability does the ideally fitted policy give A? For the same beta values, find the initial loss derivative for one recorded A-over-B vote. Differentiate with respect to the unscaled A-minus-B margin at zero.
7.After a DPO update, the evaluator has only the updated actor and a cache of reference sums and valid target counts. A new pair has a familiar prompt and two uncached completions. An older pair still has the same tokens and masks. Its cached log probabilities sum to −15 over 4 chosen targets and −12 over 6 rejected targets. Can the evaluator recover the original reference scores for the new pair? What are the chosen and rejected means for the older pair?
8.Policy U gives answers A, B and C probabilities of 0.45, 0.15 and 0.40. Policy V gives them 0.15, 0.05 and 0.80. The DPO reference is uniform and beta is 1. A reviewer chose A over B in the only labeled comparison. To three decimal places, what DPO loss does each policy incur on that vote? Could an evaluator recover C’s share from that pair loss alone?
9.An IPO pair has margin 4 at tau 0.2. A KTO check increases an undesirable answer’s log ratio at a fixed reference point, with positive beta and unit weight. In a GRPO group, every answer earns 2 and a separate KL penalty is enabled. Which result gives the IPO loss derivative with respect to the margin, the change in KTO loss, and the GRPO update terms?
10.An evaluator provides 95% win-probability intervals for two predeclared candidates under one planned evaluation design. Candidate A has [0.54,0.63] and mean length growth 23 tokens; B has [0.49,0.58] and growth 12. Promotion requires lower bound > 0.50 and length growth < 20. Which candidates qualify?

10 questions remaining.

References

Training Language Models to Follow Instructions with Human Feedback (InstructGPT).

Ouyang, L., et al. · 2022 · NeurIPS 2022

https://arxiv.org/abs/2203.02155

Learning to Summarize from Human Feedback.

Stiennon et al. · 2020

https://arxiv.org/abs/2009.01325

Proximal Policy Optimization Algorithms.

Schulman, J., et al. · 2017

https://arxiv.org/abs/1707.06347

Direct Preference Optimization: Your Language Model is Secretly a Reward Model.

Rafailov, R., et al. · 2023

https://arxiv.org/abs/2305.18290

OpenRLHF: Execution Modes and Performance Tuning

OpenRLHF Contributors · 2026

https://github.com/OpenRLHF/OpenRLHF

High-Dimensional Continuous Control Using Generalized Advantage Estimation

Schulman, J., Moritz, P., Levine, S., Jordan, M., & Abbeel, P. · 2015 · ICLR 2016

https://arxiv.org/abs/1506.02438

TRL 1.13.0: DPOTrainer Implementation

Hugging Face TRL Contributors · 2026

https://github.com/huggingface/trl/blob/3d9261f1fec9f9a8140099c78a65c7da73dce79c/trl/trainer/dpo_trainer.py

Unintentional Unalignment: Likelihood Displacement in Direct Preference Optimization

Razin, N., Malladi, S., Bhaskar, A., Chen, D., Arora, S., & Hanin, B. · 2025 · ICLR 2025

https://arxiv.org/abs/2410.08847

Smaug: Fixing Failure Modes of Preference Optimisation with DPO-Positive

Pal, A., Karkhanis, D., Dooley, S., Roberts, M., Naidu, S., & White, C. · 2024

https://arxiv.org/abs/2402.13228

DPO Trainer

Hugging Face TRL Contributors · 2026

https://huggingface.co/docs/trl/dpo_trainer

TRL 1.17.1: DPOTrainer Implementation

Hugging Face TRL Contributors · 2026

https://github.com/huggingface/trl/blob/v1.17.1/trl/trainer/dpo_trainer.py

TRL 1.17.1: DPOConfig

Hugging Face TRL Contributors · 2026

https://github.com/huggingface/trl/blob/v1.17.1/trl/trainer/dpo_config.py

Human Alignment of Large Language Models through Online Preference Optimisation.

Calandriello, D., et al. · 2024

https://arxiv.org/abs/2403.08635

NIST/SEMATECH e-Handbook: Confidence Intervals for Proportions

NIST/SEMATECH · 2026

https://www.itl.nist.gov/div898/handbook/prc/section2/prc241.htm

A General Theoretical Paradigm to Understand Learning from Human Preferences

Azar, M. G., Rowland, M., et al. · 2023

https://arxiv.org/abs/2310.12036

KTO: Model Alignment as Prospect Theoretic Optimization.

Ethayarajh, K., et al. · 2024 · ICML 2024

https://arxiv.org/abs/2402.01306

ORPO: Monolithic Preference Optimization without Reference Model.

Hong, J., Lee, N., & Thorne, J. · 2024

https://arxiv.org/abs/2403.07691

SimPO: Simple Preference Optimization with a Reference-Free Reward

Meng, Y., et al. · 2024

https://arxiv.org/abs/2405.14734

DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models

Shao, Z., et al. · 2024

https://arxiv.org/abs/2402.03300

DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning

DeepSeek-AI · 2025

https://arxiv.org/abs/2501.12948

GRPO Trainer.

Hugging Face · 2026

https://huggingface.co/docs/trl/grpo_trainer

TRL 1.13.0: GRPOTrainer Implementation

Hugging Face TRL Contributors · 2026

https://github.com/huggingface/trl/blob/3d9261f1fec9f9a8140099c78a65c7da73dce79c/trl/trainer/grpo_trainer.py

Constitutional AI: Harmlessness from AI Feedback.

Bai, Y., et al. · 2022 · arXiv preprint

https://arxiv.org/abs/2212.08073

Claude's New Constitution

Anthropic · 2026

https://www.anthropic.com/news/claude-new-constitution

RLAIF vs. RLHF: Scaling Reinforcement Learning from Human Feedback with AI Feedback

Lee, H., Phatale, S., Mansoor, H., et al. · 2023

https://arxiv.org/abs/2309.00267

Red Teaming Language Models with Language Models.

Perez, E., et al. · 2022 · EMNLP 2022

https://arxiv.org/abs/2202.03286

Great, Now Write an Article About That: The Crescendo Multi-Turn LLM Jailbreak Attack

Russinovich, M., Salem, A., & Eldan, R. · 2024

https://arxiv.org/abs/2404.01833

Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection

Greshake, K., et al. · 2023 · AISec 2023

https://arxiv.org/abs/2302.12173

Llama Guard 4 12B

Meta · 2025

https://huggingface.co/meta-llama/Llama-Guard-4-12B

Next-generation Constitutional Classifiers: More Efficient Protection Against Universal Jailbreaks

Anthropic · 2026

https://www.anthropic.com/research/next-generation-constitutional-classifiers

Discussion

Questions and insights from fellow learners.

Discussion loads when you reach this section.