AI Fundamentals

DPO Guide

An engineering guide to DPO — how direct preference optimization aligns LLM behavior without a reward model or PPO, with the loss math, HuggingFace TRL code, an honest DPO vs RLHF comparison, and production deployment.

55 min readAdvancedLast reviewed: 21 July 2026
PrerequisitesFine-TuningLoRARLHF

Quick Summary

DPO aligns an instruction-tuned language model directly on preference pairs with a single classification loss, achieving RLHF-quality behavior alignment without a separate reward model or reinforcement learning loop.

One Analogy

DPO is teaching by side-by-side example instead of by scoreboard — you show the model the better answer next to the worse one and adjust it directly, rather than training a judge (reward model) and then coaching against that judge (PPO).

Engineering Rule

DPO refines behavior, it does not create capability — always SFT first so the reference model is competent, then use a low learning rate and modest β so alignment shifts preference without breaking fluency.

TL;DR

  • DPO optimizes the LLM directly on preference pairs (chosen vs. rejected responses) with a single classification loss — no separate reward model, no PPO, no reinforcement-learning loop.

  • DPO is mathematically derived from the RLHF objective. The KL-constrained reward-maximization problem has a closed-form optimal policy, and substituting it back yields a supervised loss on preference pairs. Same goal, far simpler mechanics.

  • You still need SFT first. DPO refines an already instruction-tuned model; it does not teach instruction following from scratch. The SFT model becomes the frozen reference.

  • DPO vs RLHF: comparable quality, roughly 10× less complexity — one training stage instead of three, one model in memory (with LoRA) instead of four. Most teams should default to DPO.

  • DPO aligns behavior, not knowledge. Like RLHF, it shifts what the model prefers to say; it cannot inject facts. Use RAG or data fine-tuning for missing knowledge.

On this page

Why This Matters

RLHF works, but it is an engineering burden: three training stages, up to four models in GPU memory, PPO hyperparameter sensitivity, reward hacking, and weeks of debugging RL instability. Teams routinely spend more effort fighting the training pipeline than improving model quality.

DPO, introduced by Rafailov et al. (2023), proved you can skip the reward model and PPO entirely. The insight: the RLHF objective has a closed-form optimal policy, and you can learn it directly with a simple classification loss on the same preference pairs RLHF uses. One training loop, same data, same goal.

That simplification changed practice. DPO is now the default alignment method for most open-weight chat models (Llama, Mistral Instruct, Zephyr, Tulu) and is widely used in production because it reuses ordinary supervised-training infrastructure. If you are aligning a custom model, DPO is where you should start — and only escalate to RLHF if you hit a genuine wall.

This guide sits in the LLM Concepts cluster next to generative AI and fine-tuning. Read RLHF first if you want to understand exactly what DPO replaces.

The Problem DPO Solves

RLHF's complexity creates concrete, recurring problems.

Engineering overhead. You manage an SFT model, a reward model, a reference model, and a policy simultaneously. When quality regresses, you must isolate which stage caused it. PPO's hyperparameters (KL coefficient, clip range, learning rate, reward scale) interact unpredictably.

Instability. PPO is notoriously fragile — reward rises while human-rated quality falls. Reward hacking, mode collapse, and distribution shift demand constant monitoring and careful early stopping.

Cost. Four model copies in GPU memory, plus human labeling for preferences and the engineering time to build and debug the RL loop.

DPO removes the reward model and the PPO loop. You provide preference pairs (prompt, chosen, rejected) and train with a single loss that raises the likelihood of chosen responses relative to rejected ones. It is supervised learning, not reinforcement learning — the same infrastructure you already use for SFT.

Pain point in RLHF How DPO addresses it
Separate reward-model training stage Reward is implicit in the loss — no RM to train
PPO instability / reward hacking Standard supervised convergence; no online sampling
4 models in GPU memory 1–2 (1 with LoRA, since reference = frozen base)
Many interacting hyperparameters Mainly β and learning rate
Hard RL debugging Ordinary loss curves and margins

How We Got Here

DPO is a direct descendant of the RLHF recipe — a mathematical shortcut through it rather than a new idea about what to optimize.

Diagram: From RLHF to direct optimization

timeline
    title The path to DPO
    2017 : Preference RL
         : Learn reward from comparisons
    2022 : InstructGPT / ChatGPT
         : SFT + reward model + PPO
    2023 : DPO (Rafailov et al.)
         : Closed-form policy, no RM, no PPO
    2023-2024 : Variants
              : IPO, KTO, ORPO, CPO
    2024-2026 : Production default
              : Open-weight chat models ship DPO

RLHF established the objective; DPO showed the objective has an exact solution you can train toward directly.

The core realization: RLHF maximizes expected reward under a KL constraint to a reference policy. That constrained optimization has an analytical optimum — the optimal policy is the reference reweighted by exponentiated reward. Rafailov et al. inverted that relationship to express reward in terms of the policy and reference, then plugged it into the reward-model training loss. The reward model cancels out, leaving a preference classification loss over the policy itself. No reward model needs to exist.

What Is DPO?

Direct Preference Optimization reframes RLHF alignment as a binary classification problem over preference pairs. Instead of the two-step "train reward model, then RL against it," DPO optimizes a single objective:

L_DPO = -log σ( β · [ log (π_θ(y_c|x) / π_ref(y_c|x))
                     - log (π_θ(y_r|x) / π_ref(y_r|x)) ] )

Where:

  • π_θ is the policy model being trained.
  • π_ref is the frozen reference model (the SFT model).
  • y_c, y_r are the chosen (preferred) and rejected responses.
  • β is a temperature controlling how far the policy may deviate from the reference.
  • σ is the sigmoid.

Intuitively: increase the probability of chosen responses and decrease the probability of rejected ones, relative to the reference model. The β term controls how aggressively the policy moves away from the reference. Like RLHF, DPO aligns behavior — it reshapes preferences over outputs, not the facts stored in weights.

How DPO Works

The mathematical connection to RLHF

RLHF optimizes max E[r(x,y)] - β · KL(π_θ || π_ref). This has a closed-form optimal policy where the implicit reward is:

r(x, y) = β · log( π*(y|x) / π_ref(y|x) ) + β · log Z(x)

The partition function Z(x) is the same for both responses to a given prompt, so it cancels in the pairwise Bradley–Terry loss. Substituting the implicit reward into that loss yields exactly L_DPO. The reward model disappears — its role is absorbed into the log-probability ratio between policy and reference.

What happens during training

For each preference pair:

  1. Compute log probabilities of chosen and rejected responses under the policy.
  2. Compute log probabilities of the same responses under the frozen reference.
  3. Form the implicit reward for each response: β · (log π_θ - log π_ref).
  4. Apply the sigmoid loss to push the chosen reward above the rejected reward.
  5. Backpropagate through the policy only — the reference gets no gradients.

Diagram: One DPO training step

flowchart LR
    Pair["Pair: prompt + chosen + rejected"] --> PC[Policy logprob chosen]
    Pair --> PR[Policy logprob rejected]
    Pair --> RC[Ref logprob chosen]
    Pair --> RR[Ref logprob rejected]
    PC --> MC[Implicit reward chosen]
    RC --> MC
    PR --> MR[Implicit reward rejected]
    RR --> MR
    MC --> Loss["Sigmoid loss: push chosen above rejected"]
    MR --> Loss
    Loss --> Upd[Update policy only]

No generation, no reward model, no reward sampling — just four forward passes and one gradient step per pair.

Direct Preference Optimization aligns models from pairwise human preferences without training a separate reward model or running RL.

DPO alignment overview: implicit reward as the log-ratio between policy and reference

Source: Rafailov et al., "Direct Preference Optimization" (Stanford)

The β parameter

β controls the strength of preference optimization and how far the policy may drift from the reference.

β value Effect When to use
0.01–0.1 Conservative; stays close to reference Safety-critical; minimal behavior change
0.1–0.5 Default range — good balance Most alignment tasks
0.5–2.0 Aggressive; strong preference signal Large preference gaps, robust reference

Too low and the model barely changes from the reference. Too high and it overfits the preference data, degrading fluency. Start at 0.1.

Architecture

A DPO setup is dramatically simpler than RLHF.

Component Role Notes
Policy model Being trained (with LoRA) Same architecture as the SFT model
Reference model Frozen SFT model for the log-ratio anchor With LoRA, this is just the frozen base
Preference dataset (prompt, chosen, rejected) triplets The same data RLHF uses for its reward model
DPOTrainer TRL trainer computing the loss Standard supervised training loop

With LoRA, the reference and policy share the same base weights: the policy is base + adapter, the reference is base. DPO with LoRA therefore needs one model copy in memory — versus up to four for RLHF's PPO stage. This is the single biggest practical reason DPO is cheaper to run.

Diagram: DPO vs RLHF memory topology

flowchart TB
    subgraph DPO[DPO with LoRA]
        BD[Frozen base weights]
        PD[Policy = base + adapter]
        BD --> PD
        BD --> RD[Reference = base]
    end
    subgraph RLHF[RLHF PPO stage]
        PP[Policy]
        RP[Reference]
        RM[Reward model]
        VP[Value model]
    end

One shared base plus a small adapter (DPO) versus four resident models (RLHF) — the difference between a single GPU and a multi-GPU node for a 7B model.

The stanford paper's pipeline view contrasts the multi-stage RLHF flow with DPO's single stage:

DPO pipeline: preference data flows straight into a single optimization stage

Source: Rafailov et al., "Direct Preference Optimization" (Stanford)

Step-by-Step Flow

  1. SFT the base model. Fine-tune on instruction–response demonstrations. This becomes the reference (π_ref) and the DPO starting point. You cannot skip this — DPO refines a competent model, it does not create one.
  2. Collect preference data. Generate multiple responses per prompt (from the SFT model or several models). Have humans or an AI judge pick the better one. Format as (prompt, chosen, rejected) triplets.
  3. Configure DPO. Set β (start at 0.1), a low learning rate (5e-7–5e-6, below SFT), and a LoRA config.
  4. Train with DPOTrainer. A standard training loop — no RL, no reward model, no generation during training. Monitor DPO loss and the implicit reward margin (rewards/chosen - rewards/rejected).
  5. Evaluate. Compare against the SFT-only baseline on alignment benchmarks and human eval. Watch for over-optimization (fluency degradation). See LLM Evaluation.
  6. Deploy. Merge the LoRA adapter and serve like any fine-tuned model — inference cost is unchanged.

Diagram: DPO run lifecycle

stateDiagram-v2
    [*] --> SFT
    SFT --> CollectPrefs: model can follow instructions
    CollectPrefs --> Training: (prompt, chosen, rejected)
    Training --> Training: minimize L_DPO, watch margin
    Training --> OverOpt: margin diverges / fluency drops
    OverOpt --> Training: lower β or LR, restore checkpoint
    Training --> Eval: converged
    Eval --> Deploy: beats SFT baseline
    Eval --> CollectPrefs: regresses, improve data
    Deploy --> [*]

Over-optimization is DPO's analog of reward hacking — the fix is lower β/learning rate and better preference data, not more epochs.

Real Production Example

Aligning a code assistant to prefer concise, correct solutions over verbose explanations, using DPO and LoRA.

from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import LoraConfig, get_peft_model
from trl import DPOTrainer, DPOConfig
from datasets import load_dataset

MODEL_ID = "meta-llama/Llama-3.1-8B-Instruct"

tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
tokenizer.pad_token = tokenizer.eos_token

# Policy model (will be trained)
model = AutoModelForCausalLM.from_pretrained(
    MODEL_ID,
    torch_dtype="bfloat16",
    device_map="auto",
    attn_implementation="flash_attention_2",
)

# Reference model (frozen SFT model). With LoRA you can omit this and
# TRL uses the frozen base as the reference automatically.
ref_model = AutoModelForCausalLM.from_pretrained(
    MODEL_ID, torch_dtype="bfloat16", device_map="auto",
)

lora_config = LoraConfig(
    r=16,
    lora_alpha=32,
    target_modules=["q_proj", "k_proj", "v_proj", "o_proj"],
    lora_dropout=0.05,
    task_type="CAUSAL_LM",
)
model = get_peft_model(model, lora_config)
model.print_trainable_parameters()

# Preference dataset: {prompt, chosen, rejected}
dataset = load_dataset("json", data_files={
    "train": "code_preferences_train.jsonl",
    "test": "code_preferences_eval.jsonl",
})

# Example preference pair:
# {
#   "prompt": "Write a Python function to check if a string is a palindrome.",
#   "chosen": "def is_palindrome(s):\n    return s == s[::-1]",
#   "rejected": "Great question! A palindrome is a word that reads the same..."
# }

dpo_config = DPOConfig(
    output_dir="./code-assistant-dpo",
    num_train_epochs=1,            # DPO overfits faster than SFT
    per_device_train_batch_size=2,
    gradient_accumulation_steps=8,
    learning_rate=5e-7,            # far lower than SFT
    beta=0.1,                      # deviation-from-reference temperature
    bf16=True,
    logging_steps=10,
    eval_strategy="steps",
    eval_steps=50,
    save_strategy="steps",
    save_steps=100,
    max_length=2048,
    max_prompt_length=1024,
    loss_type="sigmoid",           # standard DPO; try "ipo" for noisy prefs
)

trainer = DPOTrainer(
    model=model,
    ref_model=ref_model,
    args=dpo_config,
    train_dataset=dataset["train"],
    eval_dataset=dataset["test"],
    processing_class=tokenizer,
)

trainer.train()
model.save_pretrained("./code-assistant-dpo/adapter")

# Evaluate: compare SFT vs DPO outputs on a fixed prompt
test_prompt = "Implement binary search in Python."
inputs = tokenizer(test_prompt, return_tensors="pt").to(model.device)
dpo_output = tokenizer.decode(
    model.generate(**inputs, max_new_tokens=200)[0],
    skip_special_tokens=True,
)

Results on their eval set (200 coding prompts, human-rated):

Metric SFT only DPO (β=0.1) RLHF (PPO)
Correctness 82% 89% 90%
Conciseness (human pref) 61% 84% 83%
Training time 3 hrs 5 hrs 28 hrs
Engineering effort 1 day 2 days 3 weeks

DPO matched RLHF quality at a fraction of the cost, so the team shipped DPO. This is the typical outcome for standard behavior alignment, which is why DPO is the recommended default.

Design Decisions

Decision Option A Option B When to choose
β value 0.1 (conservative) 0.5 (aggressive) 0.1 default; raise if the model barely shifts from reference
Reference model Separate copy Shared base (LoRA diff) LoRA sharing saves memory; separate copy only if not using LoRA
Loss type sigmoid (standard DPO) IPO / hinge sigmoid for most cases; IPO for noisy or over-optimizing preferences
Learning rate 5e-7 5e-6 Lower than SFT; start at 5e-7, raise if loss plateaus
Preference source Human labelers AI judge (RLAIF) Human for safety-critical; AI for scale and iteration speed
Epochs 1 2–3 1 by default; DPO overfits faster than SFT

DPO variants worth knowing

Method Difference from DPO When to consider
IPO Adds regularization to resist overfitting noisy preferences Noisy or inconsistent labels
ORPO Folds SFT and preference optimization into one stage; no reference model Skip a separate SFT pass
KTO Works with binary good/bad labels instead of pairs Cheaper, easier data collection
CPO Contrastive objective with a simpler loss Research and ablation settings

When should I use this?

Prefer DPO Prefer RLHF
Offline preference pairs are available You need an explicit reward model
You want simpler training than PPO Online RL loop is already productionized
Post-SFT style and safety alignment Reward-model-based monitoring is required
Most product preference-tuning cases Specialized RLHF research setups

Comparisons

DPO against RLHF and plain SFT — the honest trade-offs.

Dimension DPO RLHF (PPO) Fine-tuning (SFT)
Training stages 2 (SFT → DPO) 3 (SFT → RM → PPO) 1
Models in memory 1–2 (1 with LoRA) up to 4 1
Training type Supervised (offline) Reinforcement (online) Supervised (offline)
Reward model Not needed (implicit) Required Not applicable
Hyperparameter sensitivity Low (mainly β, LR) High Low
Stability High Low (reward hacking) High
Wall-clock time Hours Days Hours
GPU memory (7B) ~16–24 GB ~56 GB+ ~16–24 GB
Online learning No (fixed set) Yes No
Multi-objective rewards No Yes No
Aligns Behavior Behavior Behavior + format
Debugging Easy (loss curves) Hard (RL metrics) Easy

Common Mistakes

  1. Skipping SFT. DPO refines an instruction-tuned model; it does not create one. Running DPO on a base model gives poor results because the reference cannot follow instructions.
  2. Using SFT learning rates. DPO needs 5e-7–5e-6, well below SFT's 1e-5–2e-4. Too high and the policy diverges from the reference too aggressively.
  3. β too high. Above ~1.0 the model overfits the preference signal and fluency degrades. Start at 0.1 and raise only if it barely shifts.
  4. Noisy preference data. DPO amplifies labeling errors. If annotators disagree on 30% of pairs, the model learns contradictory preferences. Audit label quality before training.
  5. Not monitoring the reward margin. rewards/chosen - rewards/rejected should grow then stabilize. If it diverges while eval quality drops, you are over-optimizing — stop early or switch to IPO.
  6. Too many epochs. One epoch is usually enough; DPO overfits faster than SFT because the loss pushes toward specific responses.
  7. Choosing DPO when you need online RL. DPO trains on a fixed offline set. If the model must explore and generate its own signal, use RLHF.
  8. Ignoring reference-model memory. Without LoRA, a separate reference doubles GPU memory. With LoRA the reference is the frozen base — near free.

Where It Breaks Down

Noisy or inconsistent preferences. DPO assumes preferences are coherent. When labelers disagree, or preferences encode conflicting objectives (concise vs. thorough), DPO learns an average that satisfies nobody.

Large capability gaps. DPO only shifts probability among responses the model can already produce. If the SFT model cannot generate a good answer at all, DPO cannot conjure one — fix the base with better SFT first.

Multi-objective alignment. DPO handles one preference dimension per dataset. Balancing helpfulness, safety, and honesty needs a carefully balanced dataset or sequential DPO rounds — this is where RLHF's weighted rewards have an edge.

Quality of rejected responses. If rejected examples are obviously bad, the model learns little. Rejected responses should be plausible but inferior, so the model must learn subtle distinctions.

Extrapolation beyond the data. DPO only optimizes on prompt types present in the preference set. Novel prompts may see little alignment benefit.

When NOT to Use DPO

Prefer another approach when:

  • You need online RL — the model must generate and learn from its own outputs during training. DPO is offline; use RLHF.
  • You need multi-objective weighted rewards — separate, tunable signals for helpfulness, safety, and conciseness. A single preference dimension cannot express this cleanly.
  • The problem is missing knowledge — use RAG or fine-tune on domain data. DPO aligns behavior, not facts.
  • You have no SFT model yet — do SFT first (or consider ORPO, which folds SFT and alignment together).
  • You need hard guarantees — DPO reduces but never eliminates unsafe outputs. Layer guardrails at runtime rather than trusting alignment alone.

Running in Production

Best Practice

Keep the SFT model as an instant rollback, version the SFT model / preference dataset / β / adapter as one bundle, monitor the reward margin during training, and gate promotion on a fixed golden evaluation set.

Dimension Consideration
Scaling Standard supervised training — same infra as SFT; use LoRA for memory efficiency
Latency No inference overhead; a DPO-aligned model serves identically to the SFT model
Cost Preference labeling $5K–$30K; GPU $100–$1K (hours, not days); engineering days, not weeks
Monitoring Track DPO loss, reward margin (chosen − rejected), and quality on a golden set
Evaluation A/B test against the SFT model; human eval on helpfulness, safety, task completion
Security DPO-aligned models are not jailbreak-proof; pair with guardrails
Versioning Bundle SFT model, preference dataset, β, and DPO adapter for reproducibility

Important

Always keep the SFT model as a fallback. If DPO degrades quality you can revert instantly. A/B test DPO vs. SFT in production before full rollout.

Inside LLM Concepts:

  • RLHF — the predecessor DPO simplifies; read it to understand what DPO replaces
  • Fine-tuning — SFT is the required first stage before DPO
  • Generative AI — where alignment fits in training vs inference
  • Large Language Models — the models DPO aligns
  • LoRA · PEFT — memory-efficient DPO training

Adjacent clusters:

Tools: Hugging Face · TRL · PEFT · Axolotl

Interview Questions

  1. How does DPO eliminate the reward model? The KL-constrained RLHF objective has a closed-form optimal policy; inverting it expresses reward as the log-ratio between policy and reference. Substituting that into the preference loss cancels the reward model, leaving a supervised loss on preference pairs.

  2. Why must you SFT before DPO? DPO refines behavior by shifting probability among responses the model can already produce, and the SFT model serves as the frozen reference. Without SFT, the reference cannot follow instructions and there is nothing good to shift toward.

  3. What does the β parameter control? How far the policy may deviate from the reference. Low β stays conservative; high β optimizes preferences aggressively at the risk of fluency loss. Default ~0.1.

  4. Does DPO add knowledge to a model? No — it aligns behavior. New facts require retrieval or data fine-tuning, not preference optimization.

  5. What is the DPO analog of reward hacking? Over-optimization: the reward margin keeps growing while fluency and general quality drop. Mitigate with lower β/learning rate, fewer epochs, IPO loss, and cleaner data.

  6. How many models does DPO keep in memory, and why fewer than RLHF? One with LoRA (the reference is the frozen base; the policy is base + adapter), or two without. RLHF's PPO stage holds up to four (policy, reference, reward, value).

  7. When should you choose RLHF over DPO? When you need online RL (self-generated training data), multi-objective weighted rewards, or reward shaping that pairwise preferences cannot express.

  8. How do ORPO and KTO differ from DPO? ORPO merges SFT and preference optimization into one stage without a reference model; KTO trains on binary good/bad labels instead of pairs, easing data collection.

Key Takeaways

  • DPO aligns behavior in a single supervised stage — no reward model, no PPO, no RL debugging.
  • It is mathematically derived from RLHF but roughly 10× simpler and far more stable to train.
  • Requires SFT first, then preference pairs, then training with β≈0.1 and a low learning rate.
  • Use LoRA so the reference is the frozen base — one model copy, single-GPU friendly for 7B.
  • Default to DPO for standard alignment; escalate to RLHF only for online RL or multi-objective rewards.

FAQs

What is DPO?

DPO (Direct Preference Optimization) aligns LLMs by training directly on preference pairs (chosen vs. rejected responses) with a classification loss. No reward model or reinforcement learning is required.

How is DPO different from RLHF?

RLHF trains a reward model then uses PPO to optimize against it. DPO skips both — it optimizes the LLM directly on preferences with a supervised loss. Same goal, far simpler implementation. See RLHF.

Is DPO as good as RLHF?

On most alignment benchmarks (AlpacaEval, MT-Bench), DPO matches RLHF quality. RLHF retains an edge for online RL and multi-objective rewards, but for standard alignment DPO is the better default.

Does DPO teach the model new facts?

No. DPO aligns behavior, not knowledge — it shifts which responses the model prefers, not the facts it knows. Use RAG or fine-tuning for new information.

Do I need SFT before DPO?

Yes. DPO refines an instruction-tuned model and uses it as the reference (π_ref). Running DPO on a base model without SFT produces poor results.

How much preference data does DPO need?

Roughly 10,000–100,000 pairs for general alignment; 1,000–5,000 for focused tasks (tone, format). Label quality matters more than quantity — inconsistent labels hurt more than scarce data.

What should β be?

Start at 0.1. Raise to 0.3–0.5 if the model barely shifts from the reference; lower to 0.01–0.05 for safety-critical uses where you want minimal behavior change.

What learning rate should I use for DPO?

5e-7 to 5e-6 — significantly lower than SFT (1e-5 to 2e-4). DPO makes smaller, more precise updates to avoid diverging from the reference.

Can I use DPO with LoRA?

Yes, and it is recommended. With LoRA the reference is the frozen base weights, so only one model copy sits in memory. This is the standard production setup.

How do I collect preference data?

Generate 2–4 responses per prompt from your SFT model, then have humans rank them — or use an AI judge (RLAIF) for scale. Store as {prompt, chosen, rejected} JSONL.

How many epochs of DPO training?

One is the default. DPO overfits faster than SFT because the loss optimizes for specific responses. Monitor the reward margin and stop if it diverges while eval quality drops.

What is the DPO loss function?

L = -log σ(β · [log π(y_c|x)/π_ref(y_c|x) - log π(y_r|x)/π_ref(y_r|x)]). It raises the relative log-probability of chosen over rejected responses, anchored to the reference.

Can DPO handle multiple preference dimensions?

Not in a single run. DPO optimizes one preference signal per dataset. For multi-objective alignment, balance the dataset carefully or run sequential DPO rounds — or use RLHF.

What are ORPO and KTO?

Alternative alignment methods. ORPO merges SFT and preference optimization into one stage (no reference model); KTO works with binary good/bad labels instead of pairs, easing data collection.

How do I evaluate DPO quality?

Compare the DPO model vs. SFT-only on automated benchmarks (AlpacaEval, MT-Bench), human side-by-side preference, task metrics, and safety evals — then A/B test in production. See LLM Evaluation.

References

Further Reading

Next Topics

Learning Path

Continue Learning

Related Guides

Related Tools

ToolCategoryPurposeWebsiteBest For
Hugging Face Transformers
Python SDK
frameworksLibrary for using pretrained transformers in Python and beyond.huggingface.coModel fine-tuning