10.4 KTO, IPO, and Preference-Loss Variants
DPO는 paired preference를 가정합니다. 실제 feedback에는 단일 desirable/undesirable label, tie, noisy pair가 자주 섞입니다. KTO, IPO, conservative DPO는 통계적 가정과 loss를 바꾸지만 고정한 tokenizer, completion mask, reference policy, held-out evaluation의 필요성은 바꾸지 않습니다.
IPO: 유한한 Margin Target
Identity Preference Optimization (IPO)은 DPO와 동일한 Bradley–Terry reward-model 가정에만 의존하지 않고 preference optimization을 분석합니다 [1]. 흔히 쓰는 경험적 IPO 형태는 policy-reference log-ratio margin과 유한 target의 squared error를 최소화합니다.
입니다. 유한 target은 preference margin이 끝없이 커지는 것을 억제합니다. Label noise, length confound, overfitting을 자동으로 막지는 않습니다.
Margin이 0일 때 gradient는 일반적으로 유한 target을 향해 움직입니다. 특정하게 균형 잡힌 aggregate가 아니라면 margin 0을 보편적인 update cancellation으로 해석하는 것은 틀립니다. 동작은 label, 현재 margin, weight에 따라 달라집니다.
KTO: 짝이 없는 Desirable/Undesirable Feedback
Kahneman–Tversky Optimization (KTO)은 chosen/rejected pair 대신 하나의 completion에 붙은 label로 학습할 수 있습니다 [2].
Desirable과 undesirable sample은 반대 방향 logistic loss를 사용하며 class imbalance를 위해 다른 weight를 둘 수 있습니다. 중요한 은 KL 기준점(KL reference point) 이며 이미 변환한 desirability reward의 평균이 아닙니다.
Estimator를 정확히 문서화해야 합니다. 원래 구성은 독립적이거나 불일치(unmatched) 한 prompt/response sampling으로 policy-reference 로그 비율 기대값을 추정하는 관점을 사용합니다. Library는 별도 batch, permuted/mismatched batch, cached policy sample 또는 명시적으로 정의한 다른 estimator로 근사하고 nonnegative clamp를 적용할 수 있습니다. 이 선택들은 대수적으로 같은 것이 아닙니다. KTO를 쓰기 전에 현재 library의 정의, batch construction, distributed reduction, gradient detach 동작을 확인합니다.
교육용 분해는 다음과 같습니다.
# completion_logp는 policy와 reference에 같은 prompt/completion mask,
# EOS, padding, truncation, sum/mean 규약을 사용합니다.
log_ratio = policy_completion_logp - reference_completion_logp
# 고정한 KTO 구현 규약에 맞는 별도 또는 unmatched batch로 추정합니다.
# rewards.mean()으로 바꾸면 안 됩니다.
kl_reference_point = estimate_nonnegative_kl_reference(unmatched_batch).detach()
value = log_ratio - kl_reference_point
loss_desirable = -torch.nn.functional.logsigmoid(beta * value)
loss_undesirable = -torch.nn.functional.logsigmoid(-beta * value)
이는 semantic sketch이며 그대로 쓰는 trainer가 아닙니다. 실제 구현은 rank 간 sampling과 reduction을 명시해야 합니다.
Conservative DPO와 Label 불확실성
Conservative DPO (cDPO)는 관찰한 pair가 확률 으로 뒤집혔을 수 있다고 봅니다. 완벽한 label을 가정하는 대신 target을 부드럽게 합니다. 이면 label에 방향성 preference 정보가 없고 목적함수는 neutral margin을 선호합니다. 모든 margin의 모든 per-example gradient가 상쇄된다는 뜻은 아닙니다.
반복 annotation 또는 adjudication 데이터로 noise 가정을 정합니다. Tie와 abstention을 임의의 win으로 강제하지 말고 기록합니다. Unpaired binary feedback이 많으면 KTO, 신뢰할 수 있는 matched pair가 있으면 DPO/IPO, 다른 행동이 필요하면 supervised rejection이나 reward modeling을 비교합니다.
공통 데이터 및 실행 계약
모든 variant는 DPO의 통제를 이어받습니다.
- token 단위로 검사한 prompt/completion mask와 tokenizer-native chat template
- EOS, truncation, padding, variable-length, response-length 정책
- 정확한 reference checkpoint/tokenizer/template hash와 PEFT reference 의미론
- cluster split, annotator agreement, position randomization, tie/abstain, evaluation quarantine
- token-normalized batch, 와 class-weight sweep, seed, checkpoint/data cursor
- chosen/desirable·rejected/undesirable log probability, KL 기준점 추정값, margin, entropy, length, held-out win/acceptability, retention, safety slice
구현이 nonnegative KL을 약속하는데 음수이거나 nonfinite인 경우, distributed rank가 불일치하는 경우, class collapse, 통제되지 않은 length drift, retention/safety failure가 발생하면 중단합니다. Library upgrade는 fixed-batch equivalence를 입증할 때까지 objective change로 취급합니다.
Quizzes
Quiz 1: KTO와 DPO를 구분하는 실무적 차이는 무엇인가요?
KTO는 하나의 completion에 대한 desirable 또는 undesirable label을 사용할 수 있지만 DPO는 동일한 prompt의 두 response가 필요합니다. 따라서 sampling과 loss 가정이 다릅니다.
Quiz 2: rewards.mean()이 보편적인 KTO KL 기준점이 될 수 없는 이유는 무엇인가요?
기준점은 정의된 sampling scheme에서 policy-reference log-ratio 기대값을 추정합니다. 변환된 desirability reward 평균은 label weight와 loss term을 섞어 일반적으로 다른 양을 추정합니다.
Quiz 3: cDPO에서 epsilon이 0.5라는 것은 무엇을 뜻하나요?
관찰 label에 방향 정보가 없어 loss가 neutrality를 선호한다는 뜻입니다. 현재 margin이 0이 아닌 모든 경우에 gradient가 사라진다는 뜻은 아닙니다.
Quiz 4: KTO library upgrade를 회귀 테스트해야 하는 이유는 무엇인가요?
구현마다 KL batch, matching, clamping, detachment, distributed reduction이 다를 수 있습니다. 같은 방법 이름이라도 이 세부 사항이 실제 목적함수를 바꿉니다.
References
- Azar, M. G., et al. (2023). A General Theoretical Paradigm to Understand Learning from Human Preferences. arXiv:2310.12036.
- Ethayarajh, K., et al. (2024). KTO: Model Alignment as Prospect Theoretic Optimization. arXiv:2402.01306.
- Hugging Face. KTO Trainer. TRL documentation.