preference-optimization

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Preference Optimization

偏好优化

This skill assumes
finetuning-method-selection
already routed here because the data shape is preference pairs or unpaired thumbs-up/down feedback, not demonstrations (that's
lora-qlora-recipes
) or a verifiable reward signal (that's
grpo-rlvr-training
). What follows is method selection among the DPO family, the evidence for how much that selection actually matters, the production training pattern, and how to build the pairs in the first place.
Input: a routing decision (preference optimization) plus preference pairs or unpaired feedback, usually from an SFT checkpoint. Output format: a validated method choice plus a config — the kwarg values in
references/method-configs.md
, not free-form advice — that
llm-finetuning-training-engineer
consumes directly.
本技能假设
finetuning-method-selection
已将请求路由至此,因为数据形式为偏好对或未配对的点赞/点踩反馈,而非演示数据(对应
lora-qlora-recipes
)或可验证的奖励信号(对应
grpo-rlvr-training
)。以下内容将介绍DPO家族中的方法选择、该选择实际影响的相关依据、生产级训练模式,以及如何构建初始偏好对。
输入: 路由决策(偏好优化)加上偏好对或未配对反馈,通常来自SFT检查点。 输出格式: 经过验证的方法选择及配置——即
references/method-configs.md
中的关键字参数值,而非自由形式建议——供
llm-finetuning-training-engineer
直接使用。

Method Selection

方法选择

Data shapeMethodKey parameters
Preference pairs, default caseDPOβ=0.1, LR 5e-7–1e-6, 1–2 epochs
Memory-bound or no SFT checkpointORPOreference-free, fused SFT+preference in one loss
Unpaired thumbs-up/downKTObinary label per example, no pairing needed
Length bias observed, sweep budget availableSimPOreference-free; see sweep grid below
  • DPO is the safe default. Use β=0.1 and a learning rate of 5e-7 to 1e-6 for 1–2 epochs. This LR is lower than the SFT LR that produced the checkpoint being aligned — porting an SFT- scale LR into a DPO run is the most common misconfiguration here, not an edge case.
  • ORPO routes in when memory is the constraint, or when there's no separate SFT checkpoint to start from — it's reference-free and fuses the SFT and preference objectives into one loss, skipping the separate SFT pass and the reference-model memory cost DPO carries.
  • KTO routes in when feedback is unpaired binary signal (thumbs-up/down) rather than matched preference pairs — don't force unpaired feedback into synthetic pairs to use DPO instead.
  • SimPO fixes DPO's length bias but only pays off with disciplined sweeping — its published gains are a ceiling reported under a tuned sweep, not a baseline any single config will reproduce. Route here only when there's sweep budget; use DPO instead if there isn't.
  • Classic RLHF (reward model + PPO) is retired outside frontier labs. Don't reach for it in a production pipeline — every method above is cheaper and better-supported for the same data shapes.
数据形式方法关键参数
偏好对(默认场景)DPOβ=0.1,学习率5e-7–1e-6,1–2轮训练
内存受限或无SFT检查点ORPO无需参考模型,将SFT与偏好目标融合为单一损失函数
未配对的点赞/点踩反馈KTO每个样本对应二元标签,无需配对
存在长度偏差且有调参预算SimPO无需参考模型;详见下方调参网格
  • DPO是安全的默认选择。使用β=0.1,学习率设置为5e-7至1e-6,训练1–2轮。该学习率低于生成待对齐检查点的SFT学习率——将SFT级别的学习率直接用于DPO运行是最常见的配置错误,而非边缘情况。
  • ORPO适用于内存受限,或无独立SFT检查点的场景——它无需参考模型,将SFT和偏好目标融合为单一损失函数,省去了独立的SFT步骤以及DPO所需的参考模型内存开销。
  • KTO适用于反馈为未配对二元信号(点赞/点踩)而非匹配偏好对的场景——不要为了使用DPO而将未配对反馈强制转换为合成偏好对。
  • SimPO可解决DPO的长度偏差问题,但只有在规范调参的情况下才能见效——其公开的性能提升是调参后的上限结果,并非单一配置就能复现的基线水平。仅当有调参预算时才选择此方法;若无预算,建议使用DPO。
  • 传统RLHF(奖励模型+PPO)已被淘汰,仅前沿实验室仍在使用。不要在生产流水线中采用——上述所有方法在相同数据形式下成本更低且支持更完善。

Worked Examples

示例场景

  • "We have an SFT checkpoint and clean paired preference data, no length-bias complaints yet." → default case → DPO at β=0.1.
  • "Reviewers click thumbs-up/down per response; nothing is paired." → unpaired signal → KTO, not DPO — don't synthesize pairs to force DPO onto unpaired data.
  • "GPU budget doesn't cover a separate SFT pass plus a DPO reference model." → memory-bound, no separate checkpoint → ORPO.
  • "DPO output favors longer answers regardless of quality, and there's time to run a sweep." → length bias plus sweep budget → SimPO. Skip it if the sweep budget isn't actually there.
  • “我们有一个SFT检查点和干净的配对偏好数据,目前未发现长度偏差问题。” → 默认场景 → DPO,β=0.1。
  • “评审者对每个回复点击点赞/点踩;无配对数据。” → 未配对信号 → KTO,而非DPO——不要为了使用DPO而合成偏好对。
  • “GPU预算不足以支撑独立的SFT步骤加上DPO参考模型。” → 内存受限、无独立检查点 → ORPO
  • “DPO输出倾向于更长的答案,无论质量如何,且有时间进行调参。” → 存在长度偏差且有调参预算 → SimPO。若无调参预算,则跳过此方法。

The Low-Leverage Truth

低影响力真相

A 2026 240-H100-run study (arXiv 2603.19335) is the load-bearing evidence behind the table above: loss-function choice is worth roughly 1 percentage point of leverage, model scale is worth roughly 50. Zero of 20 DPO variants tested beat vanilla DPO. Rankings also invert with scale — a variant that wins in a small pilot can lose at deployment size.
Two practical consequences:
  • Don't spend a routing decision agonizing over DPO-variant bake-offs. The table above is sufficient; deeper variant selection is low-leverage compared to data quality and scale.
  • Validate at deployment scale before trusting a ranking. A method comparison run on a small pilot model doesn't transfer to the production size class — re-check the winner once scale changes.
This is also why the Method Selection table above is deliberately short: it encodes the ~1pp lever, not a ranking of DPO variants that the same study shows doesn't hold up across scale. Treat any variant-selection advice that isn't in that table — including advice that claims a specific variant "wins" — as unproven until it's been validated at the target deployment size.
2026年一项使用240个H100 GPU的研究(arXiv 2603.19335)是上述表格的核心依据:损失函数的选择仅能带来约1个百分点的性能提升,而模型规模的提升能带来约50个百分点的性能提升。测试的20种DPO变体均未击败原生DPO。此外,方法排名还会随模型规模反转——在小型试点模型中表现出色的变体,在部署级规模下可能表现不佳。
由此得出两个实际结论:
  • 不要在路由决策上纠结于DPO变体的优劣。上述表格已足够;与数据质量和模型规模相比,深入选择变体的影响力极低。
  • 在部署规模下验证后再信任排名。在小型试点模型上进行的方法对比结果,无法直接迁移到生产级规模——当模型规模变化时,需重新验证最优方法。
这也是上述方法选择表格故意设计得简洁的原因:它仅涵盖了约1个百分点的性能提升因素,而非DPO变体的排名——上述研究表明,此类排名无法在不同规模下保持一致。任何未包含在该表格中的变体选择建议——包括声称某特定变体“最优”的建议——在目标部署规模下验证之前,都应视为未经验证。

Production Pattern: Iterative On-Policy DPO

生产级模式:迭代式在线DPO

A single offline DPO pass on a static preference dataset is a starting point, not the production pattern. The policy drifts away from the distribution the pairs were sampled from as training proceeds, and a static dataset goes stale against that drift. Production pipelines run DPO iteratively and on-policy instead:
  1. Sample completions from the current policy checkpoint.
  2. Score or rank the completions (reward model, judge, or task grader).
  3. Run a DPO pass using the current checkpoint as the reference model.
  4. The resulting checkpoint becomes both the new policy and the new reference for the next round.
Repeat. Each round's reference model is the prior round's output, not a fixed initial checkpoint — that's what keeps the preference signal on-policy instead of scoring against an increasingly stale distribution.
A single-pass DPO run is still a reasonable first iteration — it just isn't the whole pipeline. Plan for at least one more round once the first checkpoint exists, rather than treating pass one as the finished artifact.
对静态偏好数据集进行单次离线DPO训练只是起点,而非生产级模式。随着训练推进,模型策略会逐渐偏离偏好对采样的分布,静态数据集也会因这种偏离而过时。生产流水线应采用迭代式在线DPO:
  1. 从当前策略检查点生成补全结果。
  2. 对补全结果进行评分或排名(使用奖励模型、人工评审或任务 grader)。
  3. 使用当前检查点作为参考模型,进行一轮DPO训练。
  4. 生成的新检查点同时作为下一轮的新策略新参考模型。
重复以上步骤。每一轮的参考模型都是上一轮的输出,而非固定的初始检查点——这能确保偏好信号始终与当前策略匹配,而非针对日益过时的分布进行评分。
单次DPO训练仍可作为合理的第一轮迭代——但这并非完整的流水线。一旦生成第一个检查点,应计划至少再进行一轮训练,而非将第一轮视为最终产物。

Pair Construction

偏好对构建

Build DPO/ORPO pairs from same-task passing-vs-failing trajectories — two attempts at the same underlying task, not unrelated best-and-worst examples pulled from different tasks. Within that trajectory set, select the rejected member at μ−2σ of the reward distribution, never the minimum. Naive best-vs-worst pair construction (max reward vs. absolute minimum) degrades as scale increases; the μ−2σ selection is more robust to the same scale sensitivity the low-leverage study surfaced above.
sorted_by_reward = sort(trajectories, key=reward)
chosen   = sorted_by_reward[-1]                # highest reward
mu, sigma = mean(rewards), stdev(rewards)
rejected = closest(sorted_by_reward, mu - 2 * sigma)
同任务的成功与失败轨迹中构建DPO/ORPO偏好对——即针对同一底层任务的两次尝试,而非从不同任务中抽取的无关最优/最差示例。在该轨迹集中,选择奖励分布处于μ−2σ的样本作为被拒绝样本,绝不要选最小值。简单的最优-最差偏好对构建(最高奖励 vs 绝对最低奖励)会随模型规模增大而性能下降;μ−2σ的选择方式对上述研究所揭示的规模敏感性更具鲁棒性。
sorted_by_reward = sort(trajectories, key=reward)
chosen   = sorted_by_reward[-1]                # 最高奖励
mu, sigma = mean(rewards), stdev(rewards)
rejected = closest(sorted_by_reward, mu - 2 * sigma)

NOT sorted_by_reward[0] — the absolute minimum

不要用sorted_by_reward[0]——绝对最小值是简单的最优-最差构建方式,会随规模增大而性能下降。

is the naive best-vs-worst construction that

degrades as scale increases.


For the mechanics of turning graded traces into
these pairs — including rejection sampling and
judge-scored delta selection — see
`trace-to-training-data`.

关于如何将评分轨迹转换为这类偏好对的具体机制——包括拒绝采样和人工评审得分差选择——请参考`trace-to-training-data`。

References

参考资料

Complete TRL config blocks per method —
DPOConfig
,
ORPOConfig
,
KTOConfig
, and the SimPO sweep grid — plus Unsloth wrappers and a catastrophic-forgetting note live in
references/method-configs.md
. Those configs use the same current-TRL API conventions established in
lora-qlora-recipes
's
references/unsloth-trl-mapping.md
(
processing_class
, not
tokenizer=
).
references/method-configs.md
also carries the catastrophic-forgetting note: a too-high learning rate is the usual cause when a preference-tuned checkpoint loses general capability, and the fix is almost always to drop the LR toward the low end of the range in the Method Selection table above before reaching for any other remediation.
Related skills:
finetuning-method-selection
routes here once preference pairs or unpaired feedback exist;
lora-qlora-recipes
produces the SFT checkpoint DPO/KTO/SimPO align (ORPO's fused path can skip it);
trace-to-training-data
converts passing/failing trajectories into the pairs this skill's Pair Construction section consumes.
各方法的完整TRL配置块——
DPOConfig
ORPOConfig
KTOConfig
以及SimPO调参网格——加上Unsloth封装和灾难性遗忘说明,均存储在
references/method-configs.md
中。这些配置遵循
lora-qlora-recipes
references/unsloth-trl-mapping.md
中确立的当前TRL API规范(使用
processing_class
而非
tokenizer=
)。
references/method-configs.md
还包含灾难性遗忘说明:当偏好微调后的检查点失去通用能力时,最常见的原因是学习率过高,解决方案几乎总是将学习率降至方法选择表格中的下限范围,而非尝试其他补救措施。
相关技能:当存在偏好对或未配对反馈时,
finetuning-method-selection
会将请求路由至此;
lora-qlora-recipes
生成供DPO/KTO/SimPO对齐的SFT检查点(ORPO的融合路径可跳过此步骤);
trace-to-training-data
将成功/失败轨迹转换为本技能偏好对构建部分所需的偏好对。