Unit 7 of 11 · about 3 hours · explain, measure
Offline versus online objectives, and SFT and no-reference baselines
A gain over an untouched model does not establish the value of preference optimization. Simple controls can reveal that preferred-response exposure or a changed sequence score explains it.
You'll be able to
- Separate offline preference fitting from an online reward-guided policy update.
- Specify SFT, preferred-only fine-tuning and a no-reference preference baseline on shared data.
- Design a small comparison that isolates reference removal from length normalization and margin changes.
Covers
Read
In this order, only the parts listed
0 of 3 done
- The RLHF Book: offline versus online dataRLHF Book - Direct Alignment
Chapter 8, DAAs vs. RL: Online vs. Offline Data (page read 2026-10-14)
Read the mechanism distinction. Do not generalize the cited model-scale comparisons into a universal ranking of algorithms.
- DPO: preferred-only and selection baselinesDirect Preference Optimization
arXiv:2305.18290v3, Section 6, Tasks, Evaluation and Methods
- SimPO: no-reference objectiveSimPO: Simple Preference Optimization with a Reference-Free Reward
arXiv:2405.14734v3, Sections 2.2 to 2.3, equations 3 to 6
Focus on
- Offline DPO differentiates a likelihood over fixed comparisons. Online policy gradients use newly sampled actions and reward feedback. Collecting on-policy pairs once does not make all subsequent offline epochs on-policy updates.
- Keep an untouched SFT checkpoint and a preferred-only fine-tuning control initialized from it. The latter receives the same chosen responses but no explicit rejected-response comparison or frozen-reference term.
- A reference-free raw-gap loss, , is a useful ablation. It is not full SimPO, whose scores are token means and whose logit includes a target margin.
- For SimPO use . Record whether an implementation's margin parameter is or ; otherwise comparisons silently change two scales.
Common mistakes · 3
- Attributing a gain to reference removal while also switching from sums to means, adding a margin and retuning learning rate.
- Calling preferred-only fine-tuning a fair control after giving it fewer chosen-response exposures or no tuning budget.
- Confusing best-of-many selection with a learned policy update. Selection changes the inference procedure without changing policy parameters.
Try it yourself
Closed-book, before checking anything
torch.float64, check SimPO on mean log probabilities -1 and -2 with and final logit offset : , loss 0.2014132779827524. The book's SimPOLoss takes instead, so pass gamma=0.25 there for the same ; with gamma=0.5 it computes and loss 0.3132616875182229. Keep the raw-gap ablation separate rather than labeling every no-reference loss SimPO.Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.Does DPO need freshly generated completions for each gradient step?Answer
No. Standard offline DPO reuses a fixed preference dataset. Iterative data recollection is a separate procedure.
2.Why retain both the original SFT checkpoint and preferred-only fine-tuning?Answer
The original measures change from initialization; preferred-only fine-tuning controls for additional training on chosen responses. They answer different questions.
3.Is replacing the reference by zero log scores an unchanged KL-regularized objective?Answer
No. It removes the learned reference anchor. On a finite action space it resembles a uniform-reference comparison, but it does not retain the original reference or its induced regularization.
You're done when
Your comparison table specifies every data and score difference, the SimPO oracle passes, and your baseline results disclose training exposure and tuning budgets.
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.
- 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.
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.
- 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.
- 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.