Unit 6 of 11 · about 3 hours · explain
Reference identity and drift, and preference-data support mismatch
The reference is part of the objective, not just an extra model in memory. Meanwhile, nonzero token probabilities do not mean the preference dataset covers what the trained policy will generate.
You'll be able to
- Explain why a frozen reference checkpoint and reproducible score provenance define the DPO objective.
- Distinguish zero reference support from poor practical coverage in an offline preference dataset.
- Explain why data generated by another policy can leave deployment behavior unconstrained.
Covers
Read
In this order, only the parts listed
0 of 3 done
- The RLHF Book: policy-dependent preference dataRLHF Book - Direct Alignment
Chapter 8, DAAs with Synthetic Preference Data (page read 2026-10-14)
Read the contrast between matching the generating policy and learning from chosen-rejected differences. Treat these as empirical data-design findings, not a theorem that one collection policy always wins.
- DPO: reference initialization and supportDirect Preference Optimization
arXiv:2305.18290v3, Section 4, DPO outline; Appendix A.6, full-support assumption in the proof of Theorem 1
- TRL 1.15.0: reference behaviorTRL DPO Trainer
DPOTrainer parameter
ref_model; DPOConfig parametersprecompute_ref_log_probs,sync_ref_modelanddisable_dropout
Focus on
- Bind reference scores to checkpoint or adapter identity, tokenizer, template, exact token IDs, completion mask and truncation rule. A score keyed only by prompt text is insufficient.
- Keep reference parameters outside the optimizer and score deterministically. Precomputed scores remain valid only while both reference identity and preprocessing stay fixed.
- With , a positive policy probability gives infinite policy-to-reference KL. With a full-softmax model, the common problem is instead tiny probability and absent or unrepresentative comparisons.
- Audit generating-policy and annotator provenance, prompt families and chosen-rejected likelihood and length distributions. A rising margin on collected pairs does not constrain all unobserved responses.
Common mistakes · 3
- Calling a reference frozen because its outputs are detached. Its parameters or adapters can still drift if shared with the policy or updated elsewhere.
- Confusing reference support with dataset support. Full token support does not supply missing comparisons.
- Enabling
sync_ref_model=Truewhile describing the experiment as fixed-reference DPO. Reference synchronization changes the training procedure.
Try it yourself
Closed-book, before checking anything
Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.Does reusing cached scores survive a changed chat template?Answer
Not automatically. The tokenized event or context may change. Recompute after verifying the new input and mask identities.
2.Why can two identical checkpoints produce nonzero measured margins at initialization?Answer
Stochastic scoring, differing precision or preprocessing can produce different scores. Disable stochastic layers and compare identical tokenized inputs before attributing the difference to learning.
3.Must all preference responses come from the reference policy?Answer
No. The finite-data likelihood can be evaluated on other policies' responses where scores exist. Its usefulness still depends on coverage, labels and generalization to the policy's generated responses.
You're done when
You explain the reference-only loss change, identify every score-invalidating artifact and distinguish formal support failure from missing preference coverage.
Only when you can do this without notes.
Leads to
Notes
Resources · 3 for this unit, 7 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_alignmentpackage 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. - 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.
- 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
- 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.
- 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.
- 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. - 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/chapterNNfolders 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.