Unit 8 of 11 · about 5 hours · derive

IPO, label smoothing, conservative DPO and unpaired-feedback variants

Loss variants matter when they change an assumption you can test. IPO and label smoothing expose finite-margin behavior; KTO and ORPO clarify that feedback format and reference use are separate choices.

You'll be able to

  • Derive the sampled IPO squared-margin objective and explain its departure from Bradley-Terry modeling.
  • Derive smoothed DPO and distinguish its label-noise convention from unbiased noise correction.
  • State which feedback KTO and ORPO consume without treating them as interchangeable DPO settings.

Covers

IPO and preference-model misspecificationLabel smoothing and conservative DPO vocabularyKTO, ORPO and unpaired-feedback vocabulary
1

Read

In this order, only the parts listed

0 of 5 done

  1. IPO: bounded preference transformation and sampled lossA General Theoretical Paradigm to Understand Learning from Human Preferences

    arXiv:2310.12036v2, Section 4.2; Section 5 equation 8; Sections 5.1 to 5.2 through equation 17 and Algorithm 1

    Follow the symmetry argument yielding the half-inverse-regularization target. Skip the uniqueness proof on the first pass; do not skip the sampling assumptions.

  2. Stanford CS224R project: DPO and IPO side by sideStanford CS224R 2026 - LLM Preference Optimization

    Section 1.3.2, Preference Optimization (IPO), pp. 7 to 8: the implicit reward (eq. 7), the DPO loss (eq. 8) and the IPO squared loss toward (eq. 9)

    Read as a design specification. The course action items are not your assignment.

  3. Smoothed DPO and ORPO codeRLHF Book - Direct Alignment

    DPOLoss.forward smoothing expression; optional ORPOLoss docstring and forward

    Use the executed smoothing expression, not its comment that replaces a sum of log-sigmoids by the log of their sum. That step is invalid. The book chapter's IPO bullet also assigns the logit transform to IPO; the original paper uses the identity transform.

  4. TRL 1.15.0: loss conventionsTRL DPO Trainer

    _compute_loss: sigmoid, ipo and robust branches

    In this release sigmoid does not apply label_smoothing; use the explicit smoothed objective for cDPO. robust subtracts a flipped-label term and is not cDPO. IPO divides each score by completion length here, unlike a raw sequence-sum oracle.

  5. Optional: KTO feedback and reference pointKTO: Model Alignment as Prospect Theoretic Optimization

    arXiv:2402.01306v5, Section 4.1, Derivation, equation 8, KL Estimate and Data

    Vocabulary and one fixed-log-probability calculation only. Do not reproduce model-scale experiments.

2

Focus on

  • For adjusted log-ratio gap , sampled IPO minimizes . The IPO paper's corresponds to DPO's . Its identity preference transform is not the Bradley-Terry logit transform.
  • Smoothed DPO uses . For , its single-pair optimum is , unlike hard-label DPO's unbounded preferred logit.
  • Conservative DPO often names this smoothing convention. It is neither a calibrated estimate of each label's correctness nor the separate unbiased label-flip correction called robust DPO.
  • Optional: KTO needs individually desirable or undesirable responses and a reference point, not matched winner-loser pairs. ORPO still uses paired responses and combines chosen-response likelihood with a reference-free odds-ratio term.
Common mistakes · 3
  • Comparing IPO and DPO by raw loss magnitude. Squared margin error and negative log likelihood have different scales and minima.
  • Assuming finite target margins guarantee robustness on arbitrary data. IPO still depends on sampling, score normalization, coverage and optimization.
  • Converting 'wins against this alternative' into 'globally desirable' without a labeling policy. Pairwise winners need not meet an absolute acceptability threshold.
3

Try it yourself

Closed-book, before checking anything

Derive IPO equation 17 by combining a labeled pair with its reverse and completing the square. For , its target adjusted margin is 1. Derive the smoothed-logistic stationary point: with , . Verify both stationary derivatives in CPU PyTorch torch.float64 to absolute tolerance . Optional: evaluate KTO equation 8 on one desirable log ratio 1 and one undesirable log ratio -1 with unit weights, and a fixed zero reference point; average their equal losses, rather than summing class means.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.Why can hard-label DPO overfit a separable pair for any fixed positive regularization coefficient?Answer

    Its empirical logistic loss keeps decreasing as the preferred adjusted log-ratio gap grows. There is no finite single-pair minimum; the coefficient rescales that gap rather than imposing a hard KL cap.

  2. 2.What happens above IPO's target margin?Answer

    The squared-loss derivative becomes positive, so descent reduces the margin. Hard-label DPO continues to favor increasing it.

  3. 3.At smoothing one half, where is the optimal logit?Answer

    Zero. The soft target expresses indifference, so either positive or negative confidence increases the loss.

  4. 4.Does KTO dispense with a reference model because its feedback is unpaired?Answer

    No. Its default loss still uses policy-to-reference log ratios and a reference point. Unpaired feedback and reference-free optimization are different properties.

You're done when

You derive both finite-margin targets, verify their derivatives and explain the feedback and reference requirements of the optional variants without adding a variant survey.

Only when you can do this without notes.

Leads to

Notes

Resources · 5 for this unit, 5 more in the section
  • RLHF Book - Direct AlignmentNathan Lambert · primary

    Study Chapter 8 (DPO, its derivation, numerical concerns and online versus offline data) and the code/direct_alignment package at natolambert/rlhf-book at commit 1042143 (DPO, IPO, KTO and APO are validated there; its SimPO and ORPO runs are marked noisy). Re-derive DPO from the KL-regularized objective, implement sequence log-ratio losses from blank tensors and test chosen-rejected swaps, prompt masking, reference drift and length normalization.

  • A General Theoretical Paradigm to Understand Learning from Human PreferencesGheshlaghi Azar et al. · required

    Study the preference-model misspecification argument and IPO objective. Use one synthetic preference problem to compare DPO and IPO behavior as noise, margin and data reuse change.

  • KTO: Model Alignment as Prospect Theoretic OptimizationEthayarajh et al. (ICML 2024) · support

    Read the unpaired-feedback setting and the KTO loss with its reference point. State what data KTO needs that DPO does not, and test its loss on fixed log probabilities.

  • Stanford CS224R 2026 - LLM Preference OptimizationStanford University · required

    Study Lecture 09 (RL for LLMs: preference optimization, slides/09_cs224r_rlhf_2026.pdf) and Section 1.3.2 (IPO) of the default project guidelines. Implement independently, preserve the reference policy and follow course material restrictions.

  • TRL DPO TrainerHugging Face · support

    After the scratch loss passes, inspect the DPOTrainer data contract and options for TRL 1.15.0. Differential-test one tiny batch against the local objective and record library version, loss type, , padding, truncation and reference behavior.

Also in this section

  • Direct Preference OptimizationRafailov et al. · required

    Read the complete derivation, objective and experiments. State the preference-model and reference assumptions, then compare a scratch DPO update with SFT and rejection-style baselines on a held-out slice.

  • SimPO: Simple Preference Optimization with a Reference-Free RewardMeng, Xia and Chen (NeurIPS 2024) · support

    Read the length-normalized, reference-free reward and the target margin. Use it as the no-reference baseline and compare its length behavior with summed-log-probability DPO.

  • TensorTonic - DPO and Preference ProblemsTensorTonic · support

    Solve Implement the DPO Loss (cs336-l15-direct-preference-optimization-loss), Canonicalize Pairwise Preference Data (cs336-l15-canonical-preference-pairs) and Score a KL-Regularized Policy Batch (cs336-l15-kl-regularized-policy-objective), free problems in the Language Modeling from Scratch plan, as closed-book checks after your own loss passes.

  • Hands-on Modern RL - Chapter 14 DPOWalking Labs · support

    Use the DPO derivation page and the hands-on page for a bounded DPO experiment and metrics. Its displayed loss is the per-pair summand (average it over the dataset), and its implicit reward is exact only at the KL-regularized optimum; its training logs are illustrative. Replace any opaque trainer-only step with a checked local loss and retain a or length regime where quality worsens. Pin commit 9231bab of walkinglabs/hands-on-modern-rl; its code/chapterNN folders do not follow the site chapter numbers.

  • LLM Post-Training Laboratory - Direct Preference ObjectiveRoadmap-Final · required

    Complete the DPO-style objective with exact sequence log probabilities, frozen reference identity, fixed loss and gradient tests, common raw evaluation records, support analysis and reward, length, style and judge-hacking probes.