Part XVII — LLM Post-Training: SFT, DPO, GRPO & Reasoning / Test-Time Compute · Chapter 5

Advanced preference alignment (KTO & SimPO)

Hook

DPO needs two things RLHF also needed: PAIRED preference data ("A beats B," not just "A is good") and a frozen REFERENCE model to measure drift against. Both are real costs. What happens if a method drops one of them?

Intuition

The same 3 comparisons DPO's chapter used — "B beats A," "B beats C," "C beats A" — but relabeled as 6 completely independent judgments: each response is just "desirable" or "undesirable," on its own, with no memory of which other response it was compared against. Step through them one at a time.

Formalize

KTO (short for Kahneman-Tversky Optimization) keeps DPO's reference-relative log-ratio and its logistic loss shape, but scores ONE response at a time instead of a pair:

LKTO=logσ(λβ[logπ(y)logπref(y)]),λ={+1y desirable1y undesirable\mathcal{L}_{\text{KTO}} = -\log\sigma\Big(\lambda\,\beta\big[\log\pi(y) - \log\pi_{\text{ref}}(y)\big]\Big), \quad \lambda = \begin{cases}+1 & y \text{ desirable} \\ -1 & y \text{ undesirable}\end{cases}

SimPO (short for Simple Preference Optimization) keeps DPO's pairing, but drops the reference model entirely — the implicit reward is a response's OWN length-normalized log-probability, compared against a fixed target margin γ\gamma:

LSimPO=logσ(βywlogπ(yw)βyllogπ(yl)γ)\mathcal{L}_{\text{SimPO}} = -\log\sigma\Big(\frac{\beta}{|y_w|}\log\pi(y_w) - \frac{\beta}{|y_l|}\log\pi(y_l) - \gamma\Big)
  • λ\lambda — KTO's sign flip: +1+1 for a desirable response, 1-1 for an undesirable one — the only place pairing information used to live.
  • yy — the single response being judged, in KTO; ywy_w, yly_l — the winning and losing responses of a pair, in SimPO.
  • πref\pi_{\text{ref}} — the frozen reference model DPO and KTO both compare against; SimPO has no such term at all.
  • y|y| — the response's length in tokens, used to normalize its log-probability so longer responses aren't penalized just for being longer.
  • γ\gamma — SimPO's fixed target reward margin, replacing the role a reference model's baseline would otherwise play.
  1. KTO drops PAIRING

    Each of DPO's comparisons becomes two independent examples: the winner labeled desirable, the loser labeled undesirable. Only one response's log-ratio is touched per update — there's no "loser" to simultaneously push down in the same step, because pairing information was thrown away.

  2. SimPO drops the REFERENCE MODEL

    Instead of logπ(y)logπref(y)\log\pi(y) - \log\pi_{\text{ref}}(y), SimPO uses logπ(y)\log\pi(y) alone, divided by length. No second frozen copy of the model needs to be kept in memory during training at all.

  3. Both keep DPO's core trick

    Neither method needs a separately trained reward model — like DPO, the loss is computed directly on the policy's own log-probabilities.

Play

Both variants still recover roughly DPO's ranking — BB preferred, then CC, then AA — using strictly less machinery than DPO started with: KTO drops the paired structure, SimPO drops the reference model. Neither is strictly "better" than DPO; each is a different cost DPO's original formulation was willing to pay, removed.

Worked example

KTO's very first example, "BB is desirable," starting from a uniform policy:

  1. At initialization, the policy IS the reference

    π(B)=πref(B)=1/3\pi(B) = \pi_{\text{ref}}(B) = 1/3, so the log-ratio is 00. With λ=+1\lambda=+1 for "desirable," z=β0=0z = \beta \cdot 0 = 0, so σ(z)=0.5\sigma(z) = 0.5.

  2. The update touches ONLY B

    θB0+0.5×(10.5)×0.5×1=0.125\theta_B \to 0 + 0.5 \times (1-0.5) \times 0.5 \times 1 = 0.125 — identical in magnitude to DPO's very first update, but θA\theta_A and θC\theta_C are untouched here; DPO's paired update would have pushed a loser DOWN by the same amount in the same step.

  3. After all 6 examples

    The same one-response-at-a-time update, run through the remaining 5 examples in order:

    • Example 2, "AA undesirable": π(A)0.319\pi(A)\approx0.319 (softmax has already shifted after BB's update), log-ratio =ln(0.319)ln(1/3)0.043=\ln(0.319)-\ln(1/3)\approx-0.043, z=(1)(0.5)(0.043)0.022z=(-1)(0.5)(-0.043)\approx0.022, σ(z)0.505\sigma(z)\approx0.505, update =0.5(10.505)(0.5)(1)0.124θA0.124=0.5(1-0.505)(0.5)(-1)\approx-0.124 \Rightarrow \theta_A\approx-0.124
    • Example 3, "BB desirable" again: π(B)0.376\pi(B)\approx0.376, log-ratio 0.119\approx0.119, z0.060z\approx0.060, σ(z)0.515\sigma(z)\approx0.515, update +0.121θB0.246\approx+0.121 \Rightarrow \theta_B\approx0.246
    • Example 4, "CC undesirable": π(C)0.316\pi(C)\approx0.316, log-ratio 0.053\approx-0.053, z0.026z\approx0.026, σ(z)0.507\sigma(z)\approx0.507, update 0.123θC0.123\approx-0.123 \Rightarrow \theta_C\approx-0.123
    • Example 5, "CC desirable": π(C)0.290\pi(C)\approx0.290, log-ratio 0.139\approx-0.139, z0.069z\approx-0.069, σ(z)0.483\sigma(z)\approx0.483, update +0.129θC0.006\approx+0.129 \Rightarrow \theta_C\approx0.006
    • Example 6, "AA undesirable" again: π(A)0.279\pi(A)\approx0.279, log-ratio 0.178\approx-0.178, z0.089z\approx0.089, σ(z)0.522\sigma(z)\approx0.522, update 0.119θA0.243\approx-0.119 \Rightarrow \theta_A\approx-0.243

    Final values:

    • θB0.246\theta_B \approx 0.246
    • θC0.006\theta_C \approx 0.006
    • θA0.243\theta_A \approx -0.243

    The same B>C>AB > C > A ordering DPO found, recovered without ever using a preference pair.

Checkpoint

After KTO training on the 6 unpaired examples derived from 3 comparisons, find the arm with the lowest preference parameter.

Pick an arm to try it
Summary
LKTO=logσ(λβ[logπ(y)logπref(y)])LSimPO=logσ(βywlogπ(yw)βyllogπ(yl)γ)\mathcal{L}_{\text{KTO}} = -\log\sigma\big(\lambda\beta[\log\pi(y)-\log\pi_{\text{ref}}(y)]\big) \qquad \mathcal{L}_{\text{SimPO}} = -\log\sigma\Big(\tfrac{\beta}{|y_w|}\log\pi(y_w)-\tfrac{\beta}{|y_l|}\log\pi(y_l)-\gamma\Big)

DPO, KTO, and SimPO are three points on the same spectrum, not three unrelated ideas: DPO needs paired data and a reference model; KTO trades pairing for the ability to use ordinary desirable/undesirable labels; SimPO trades the reference model for a length-normalized reward and a fixed target margin. Every one of them still needs preference OR feedback data collected up front. The next chapters move to a different source of signal entirely — reward that can be checked by a program, not judged by a person.