preference-optimization
यह क्या करती है
यह टूल प्रेफरेंस डेटा की मदद से AI मॉडल को बेहतर बनाने में मदद करता है। यह मॉडल को इंसानी पसंद के हिसाब से ढालने के लिए उसे फाइन-ट्यून करता है, और इसके लिए DPO, ORPO, KTO या SimPO जैसे तरीकों का इस्तेमाल करता है।
कब इस्तेमाल करें
- ✓जब आपके पास प्रेफरेंस जोड़ियां हों, या थम्स-अप/थम्स-डाउन फीडबैक हो।
- ✓जब DPO, ORPO, KTO और SimPO जैसे अलग-अलग तरीकों में से चुनना हो।
- ✓जब DPO ट्रेनिंग को हाइपरपैरामीटर ट्यूनिंग या डीबगिंग की ज़रूरत हो।
Skill का लिंक
https://github.com/wshobson/agents/blob/main/plugins/llm-finetuning/skills/preference-optimization/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मैं फीडबैक डेटा का इस्तेमाल करके अपने मॉडल को छोटे और ज़्यादा मददगार जवाब पसंद करना कैसे सिखाऊं?”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
यह टूल अलग-अलग जवाबों की तुलना करता है और आपके फीडबैक का इस्तेमाल करके मॉडल को सबसे अच्छा विकल्प चुनना सिखाता है। यह आपके प्रेफरेंस डेटा के प्रकार के आधार पर सबसे उपयुक्त तरीका चुनता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
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.
Method Selection
| Data shape | Method | Key parameters |
|---|---|---|
| Preference pairs, default case | DPO | β=0.1, LR 5e-7–1e-6, 1–2 epochs |
| Memory-bound or no SFT checkpoint | ORPO | reference-free, fused SFT+preference in one loss |
| Unpaired thumbs-up/down | KTO | binary label per example, no pairing needed |
| Length bias observed, sweep budget available | SimPO | reference-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.
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.
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.
Production Pattern: Iterative On-Policy DPO
A single offline DPO pass on a static preference dataset is a starting point, not the production
…
अक्सर पूछे जाने वाले सवाल
अगर मेरे पास हर जवाब पर थम्स-अप/थम्स-डाउन है, लेकिन जवाब जोड़ियों में नहीं हैं, तो कौन सा तरीका इस्तेमाल करूं?
KTO इस्तेमाल करें। यह ऐसे अनपेयर्ड फीडबैक के लिए बना है, जहां हर जवाब को अलग से रेटिंग मिली होती है।
DPO को डिफ़ॉल्ट तरीका क्यों माना जाता है?
DPO एक भरोसेमंद विकल्प है, जो पेयर्ड प्रेफरेंस डेटा के साथ ज़्यादातर मामलों में अच्छा काम करता है। इसमें शुरुआत के लिए सुझाई गई डिफ़ॉल्ट सेटिंग्स दी गई होती हैं।
'लेंथ बायस' क्या है और इसकी चिंता कब करनी चाहिए?
लेंथ बायस का मतलब है कि मॉडल लंबे जवाबों को सिर्फ लंबे होने की वजह से पसंद कर सकता है, इसलिए नहीं कि वे बेहतर हैं। अगर यह समस्या हो और टेस्टिंग के लिए संसाधन हों, तो SimPO मदद कर सकता है।
जानकारी
लेखक का मूल विवरण
Align a fine-tuned model with preference data using DPO, ORPO, KTO, or SimPO. Use when preference pairs or thumbs-up/down feedback exist, when choosing between preference-optimization methods, or when a DPO run needs hyperparameters or debugging.
repo: wshobson/agents
लोकप्रियता
- GitHub स्टार
- 41k
- रैंकिंग में स्थान
- #6734
- लाइसेंस
- MIT
- अपडेट की गई
- 15/10/2026
कमेंट
- …
इस repository की और skills
screen-reader-testing
41kआपके एजेंट को screen readers का इस्तेमाल करके वेबसाइटों की जांच करने देता है, ताकि यह पक्का हो सके कि वे accessible हैं।
wcag-audit-patterns
41kआपके एजेंट को वेबसाइटों का accessibility audit करने और WCAG guidelines के हिसाब से समस्याएं ठीक करने में मदद करता है।
multi-reviewer-patterns
41kआपके एजेंट को कई code reviews को एक साथ चलाने देता है। यह एक जैसे findings हटाता है और सारी रिपोर्ट को एक जगह जोड़ता है।
parallel-debugging
41kआपके एजेंट को parallel जांच के साथ जटिल समस्याओं को debug करने और root cause analysis में मदद करता है।
मिलती-जुलती skills
add-model-provider
394kयह आपके एजेंट को सुरक्षित कमांड से OpenClaw में नया AI मॉडल प्रोवाइडर जोड़ने, API कीज़ को सादे टेक्स्ट से बचाने और लाइव टेस्ट चलाने देती है।
acp-router
394kयह आपके एजेंट को OpenClaw के ज़रिए Claude Code या Cursor जैसे कोडिंग असिस्टेंट को काम भेजने देती है, ताकि काम उसी टूल में चले।
browser-automation
394kयह आपके एजेंट को लॉगिन, टैब और अटकी वेब पेज से उबरने समेत, वेबसाइट पर चरण-दर-चरण काम करना सिखाती है।